Skip to content
/ strider Public

❗ This is a read-only mirror of the CRAN R package repository. strider — Strided Iterator and Range. Homepage: https://github.com/thk686/strider Report bugs for this package: https://github.com/thk686/strider/issues

License

Notifications You must be signed in to change notification settings

cran/strider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Strider

Timothy H. Keitt 2018-09-13

"I don't think he knows about second breakfast" - Meriadoc 'Merry' Brandybuck

Adapting multidimensional legacy buffers to the C++ standard library is difficult owing to a lack of strided (address-skipping) iterators. Strider provides an address-skipping pointer adapter. It can be used to scan multidimensional data along any desired margin using the standard library algorithms.

This code snippet computes row sums of a matrix.

  for_each(make_strided(begin(x), nr), make_strided(end(x)), [&](const double& y) {
    transform(&y, &y + nr, begin(res), begin(res), plus<double>()); });

It is cache and compiler friendly and runs nearly four times faster than R's built-in rowSums function. See the vignette for details.

The header file is stand-alone and can be used separate from R. It relies on the Boost iterator library.

Installation

devtools::install_github("thk686/strider")

Travis build status AppVeyor Build Status Coverage status DOI

About

❗ This is a read-only mirror of the CRAN R package repository. strider — Strided Iterator and Range. Homepage: https://github.com/thk686/strider Report bugs for this package: https://github.com/thk686/strider/issues

Resources

License

Stars

Watchers

Forks

Packages

No packages published