lpnorm: Lp Norm

Description Usage Arguments Value Examples

View source: R/helpers.r

Description

Compute the Lp norm of a vector.

Usage

1
lpnorm(x, p = 2)

Arguments

x

x

p

p

Value

...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
lpnorm(1:10)
lpnorm(matrix(1:25, 5, 5))
lpnorm(split(1:25, rep(1:5, each = 5)))

lpnorm(1:10, 1)
lpnorm(matrix(1:25, 5, 5), 1)
lpnorm(split(1:25, rep(1:5, each = 5)), 1)

lpnorm(rnorm(10), 0)
lpnorm(matrix(rnorm(25), 5, 5), 0)
lpnorm(split(rnorm(25), rep(1:5, each = 5)), 0)

lpnorm(-5:5, Inf)
lpnorm(matrix(-25:-1, 5, 5), Inf)
lpnorm(split(-25:-1, rep(1:5, each = 5)), Inf)

Example output

Loading required package: mpoly
Loading required package: stringr
Set Macaulay2 path with setM2Path().
Set Bertini path with setBertiniPath().
Set LattE-integrale path with setLattePath().
Set 4ti2 path with setMarkovPath().
[1] 19.62142
[1] 29.24038 31.14482 33.09078 35.07136 37.08099
        1         2         3         4         5 
 7.416198 18.165902 29.240383 40.373258 51.526692 
[1] 55
[1] 55 60 65 70 75
  1   2   3   4   5 
 15  40  65  90 115 
[1] 10
[1] 5 5 5 5 5
1 2 3 4 5 
5 5 5 5 5 
[1] 5
[1] 25 24 23 22 21
 1  2  3  4  5 
25 20 15 10  5 

algstat documentation built on May 29, 2017, 10:34 p.m.

Related to lpnorm in algstat...