R/norm2.R

Defines functions norm2

Documented in norm2

#' Compute the l2 norm of a vector.
#'
#' @param u A vector of numerics.
#' @return The weighted l2 norm of \eqn{u}: \eqn{\sqrt{\sum_i w_i u_i^2}}.
#' @examples
#' norm2(c(0, 0,-0.5, 0.5))
#' @export
norm2 <- function(u) sqrt(sum(u**2))
vguillemot/sparseMCA documentation built on Nov. 5, 2019, 12:02 p.m.