Description Usage Arguments Details Value Author(s) See Also Examples
The inner product
1 | inner(M)
|
M |
square matrix |
The inner product of two vectors x and y is usually written <x,y> or x.y, but the most general form would be x'My where M is a positive-definite matrix. Noting that inner products are symmetric, that is <x,y>=<y,x> (we are considering the real case only), and multilinear, that is <x,ay+bz>=a<x,y>+b<x,z>, we see that the inner product is indeed a multilinear map, that is, a tensor.
Function inner(m)
returns the 2-form that maps x,y to x'My.
Returns a k-tensor, an inner product
Robin K. S. Hankin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | inner(diag(7))
inner(matrix(1:9,3,3))
## Compare the following two:
Alt(inner(matrix(1:9,3,3))) # An alternating k tensor
as.kform(inner(matrix(1:9,3,3))) # Same thing coerced to a kform
f <- as.function(inner(diag(7)))
X <- matrix(rnorm(14),ncol=2) # random element of (R^7)^2
f(X) - sum(X[,1]*X[,2]) # zero to numerical precision
## verify positive-definiteness:
g <- as.function(inner(crossprod(matrix(rnorm(56),8,7))))
stopifnot(g(kronecker(rnorm(7),t(c(1,1))))>0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.