1 : |
tdhock |
258 |
### A multi-line comment before a data item goes into the description
|
2 : |
|
|
### section of its Rd file. The items of this list are all norms,
|
3 : |
|
|
### which are functions that take a vector of N elements and return a
|
4 : |
|
|
### non-negative real number.
|
5 : |
|
|
norms <-
|
6 : |
|
|
structure(list(l0=function(x)sum(x!=0),
|
7 : |
|
|
l1=function(x)sum(abs(x)),
|
8 : |
|
|
l2=function(x)sqrt(sum(x^2)),
|
9 : |
|
|
linfty=function(x)max(abs(x))),
|
10 : |
|
|
ex=function(){
|
11 : |
|
|
m <- replicate(2,rnorm(10))
|
12 : |
|
|
cbind(m,sapply(norms,function(norm)apply(m,1,norm)))
|
13 : |
|
|
})
|
14 : |
|
|
.result <-
|
15 : |
tdhock |
259 |
list(norms = list(definition = "norms <-\n structure(list(l0=function(x)sum(x!=0),\n l1=function(x)sum(abs(x)),\n l2=function(x)sqrt(sum(x^2)),\n linfty=function(x)max(abs(x))),\n ex=function(){\n m <- replicate(2,rnorm(10))\n cbind(m,sapply(norms,function(norm)apply(m,1,norm)))\n })",
|
16 : |
tdhock |
258 |
description = "A multi-line comment before a data item goes into the description\nsection of its Rd file. The items of this list are all norms,\nwhich are functions that take a vector of N elements and return a\nnon-negative real number.",
|
17 : |
tdhock |
259 |
format = "", title = "norms", examples = "\nm <- replicate(2,rnorm(10))\ncbind(m,sapply(norms,function(norm)apply(m,1,norm)))\n"))
|