lp_norm {LambertW} | R Documentation |
lp norm of a vector
Description
Computes the norm of an n-dimensional (real/complex)
vector
where is the absolute value of
. For
this is Euclidean norm; for
it is Manhattan norm. For
it is defined as the number of non-zero elements in
; for
it is the maximum of the absolute
values of
.
The norm of equals
if and only if
.
Usage
lp_norm(x, p = 2)
Arguments
x |
n-dimensional vector (possibly complex values) |
p |
which norm? Allowed values |
Value
Non-negative float, the norm of .
Examples
kRealVec <- c(3, 4)
# Pythagoras
lp_norm(kRealVec)
# did not know Manhattan,
lp_norm(kRealVec, p = 1)
# so he just imagined running in circles.
kComplexVec <- exp(1i * runif(20, -pi, pi))
plot(kComplexVec)
sapply(kComplexVec, lp_norm)
[Package LambertW version 0.6.9-1 Index]