sumcpp: Sum of Vector Elements (C++)

View source: R/RcppExports.R

sumcppR Documentation

Sum of Vector Elements (C++)

Description

This function uses the accu() function from the Armadillo library, a C++ library for linear algebra and scientific computing. For double-Precision vectors, the run time of this function is faster than the base sum() function, making it better suited for summing the weight variable with > 3000 elements.

Usage

sumcpp(x)

Arguments

x

A numeric vector.

Value

A numeric vector.

Examples


# Summing a double vector
x <- runif(1000000, 0.0000001, 1.99999999)
sumcpp(x)


YangWu1227/citizenr documentation built on June 18, 2022, 12:17 p.m.