These four functions are created when RcppEigen.package.skeleton() is invoked to create a skeleton packages.

rcppeigen_hello_world()
rcppeigen_outerproduct(x)
rcppeigen_innerproduct(x)
rcppeigen_bothproducts(x)

Arguments

x

a numeric vector

Value

rcppeigen_hello_world() does not return a value, but displays a message to the console.

rcppeigen_outerproduct() returns a numeric matrix computed as the outer (vector) product of x.

rcppeigen_innerproduct() returns a double computer as the inner (vector) product of x.

rcppeigen_bothproducts() returns a list with both the outer and inner products.

Details

These are example functions which should be largely self-explanatory. Their main benefit is to demonstrate how to write a function using the Eigen C++ classes, and to have to such a function accessible from R.

References

See the documentation for Eigen, and RcppEigen, for more details.

Author

Dirk Eddelbuettel

Examples

  x <- sqrt(1:4)
  RSAVS:::rcppeigen_innerproduct(x)
#> [1] 10
  RSAVS:::rcppeigen_outerproduct(x)
#>          [,1]     [,2]     [,3]     [,4]
#> [1,] 1.000000 1.414214 1.732051 2.000000
#> [2,] 1.414214 2.000000 2.449490 2.828427
#> [3,] 1.732051 2.449490 3.000000 3.464102
#> [4,] 2.000000 2.828427 3.464102 4.000000