Norm: (Weighted) L_p Norm

View source: R/basic_fcn_RD.R

NormR Documentation

(Weighted) L_p Norm

Description

Calculates rowwise ||x||_p for each row x of a matrix X.

Usage

Norm(X, p = 1, invw = 1)

Arguments

X

A numeric matrix.

p

Order of the norm; the default is p = 1 (L1 norm).

invw

Inverse weights for each component, with the length equal to either 1 or ncol(X); the default is invw = 1.

Details

X should be a matrix, not a vector.

Value

A vector of the dimension equal to the nrow(X).

Examples

X <- matrix(c(1, -2, -3, 4, 5, -6), nrow = 3, ncol = 2)
Norm(X)
weights <- c(1, 2)
Norm(X = X, invw = weights)

koohyun-kwon/rdadapt documentation built on May 8, 2022, 8:49 p.m.