colNorm: Column norm of a matrix

Description Usage Arguments Details Value Author(s) References Examples

Description

colNorm provides a column norm of a matrix to provide an example of using RcppGSL with GNU GSL library.

Usage

1

Arguments

M

a numeric matrix.

Details

The column norm of M is returned.

This example reprises an example in section 8.4.13 of the GSL reference manual.

Value

colNorm returns a vector each element of which corresponds to the vector norm of the corresponding column of M.

Author(s)

The GNU GSL library is being written by team of authors with the overall development, design and implementation lead by Brian Gough and Gerard Jungman. RcppGSL is written by Romain Francois and Dirk Eddelbuettel.

References

GNU GSL project: http://www.gnu.org/software/gsl

Examples

1
2
3
4
5
6
  ## see Section 8.4.13 of the GSL manual
  ## create M as a sum of two outer products
  M <- outer(sin(0:9), rep(1,10), "*") + outer(rep(1, 10), cos(0:9), "*")
  print(colNorm(M))
  ## same result using just R
  print(apply(M, 2, function(x) sqrt(sum(x^2))))

mclements/purged documentation built on May 22, 2019, 3:12 p.m.