R Under development (unstable) (2026-07-07 r90210 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "natcpp" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > options(pager = "console") > base::assign(".ExTimings", "natcpp-Ex.timings", pos = 'CheckExEnv') > base::cat("name\tuser\tsystem\telapsed\n", file=base::get(".ExTimings", pos = 'CheckExEnv')) > base::assign(".format_ptime", + function(x) { + if(!is.na(x[4L])) x[1L] <- x[1L] + x[4L] + if(!is.na(x[5L])) x[2L] <- x[2L] + x[5L] + options(OutDec = '.') + format(x[1L:3L], digits = 7L) + }, + pos = 'CheckExEnv') > > ### * > library('natcpp') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("c_EdgeListFromSegList") > ### * c_EdgeListFromSegList > > flush(stderr()); flush(stdout()) > > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: c_EdgeListFromSegList > ### Title: Turn a segment list into an edgelist suitable for constructing > ### an ngraph > ### Aliases: c_EdgeListFromSegList > > ### ** Examples > > > ## Not run: > ##D library(nat) > ##D # make a neuron with multiple subtrees > ##D n=prune_vertices(Cell07PNs[[1]], 48L) > ##D # Must use flatten=T if including all subtrees > ##D sl=as.seglist(n, all = TRUE, flatten = TRUE) > ##D c_EdgeListFromSegList(sl) > ## End(Not run) > > > > base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") > base::cat("c_EdgeListFromSegList", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") > cleanEx() > nameEx("c_ListofMatrixRows") > ### * c_ListofMatrixRows > > flush(stderr()); flush(stdout()) > > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: c_ListofMatrixRows > ### Title: Convert a matrix into list of row vectors > ### Aliases: c_ListofMatrixRows > > ### ** Examples > > ## Not run: > ##D library(nat) > ##D xyz=xyzmatrix(Cell07PNs) > ##D mat2list = function(m) { > ##D um=unname(m) > ##D lapply(1:nrow(um), function(i) um[i,]) > ##D } > ##D bench::mark(rcpp=c_ListofMatrixRows(xyz), r=mat2list(xyz)) > ## End(Not run) > > > > base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") > base::cat("c_ListofMatrixRows", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") > cleanEx() > nameEx("c_weighted_jaccard_sparse") > ### * c_weighted_jaccard_sparse > > flush(stderr()); flush(stdout()) > > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: c_weighted_jaccard_sparse > ### Title: Sparse weighted Jaccard similarity via C++ > ### Aliases: c_weighted_jaccard_sparse > > ### ** Examples > > ## Not run: > ##D library(Matrix) > ##D m <- sparseMatrix(i = c(1,2,1,2,3,3), j = c(1,1,2,2,2,3), > ##D x = c(4,2,1,3,3,1), dims = c(3,3)) > ##D c_weighted_jaccard_sparse(m) > ## End(Not run) > > > > base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") > base::cat("c_weighted_jaccard_sparse", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") > ### *