Learn R Programming

wedge (version 1.0-3)

inner: Inner product operator

Description

The inner product

Usage

inner(M)

Arguments

M

square matrix

Value

Returns a \(k\)-tensor, an inner product

Details

The inner product of two vectors \(\bold x\) and \(\bold y\) is usually written \(\left<\bold x,\bold y\right>\) or \(\bold x\cdot\bold y\), but the most general form would be \(\bold x^TM\bold y\) where \(M\) is a positive-definite matrix. Noting that inner products are symmetric, that is \(\left<\bold x,\bold y\right>=\left<\bold x,\bold y\right>\) (we are considering the real case only), and multilinear, that is \(\left<\bold x,a\bold y+b\bold z\right>=a\left<\bold x,\bold y\right>+b\left<\bold x,\bold z\right>\), we see that the inner product is indeed a multilinear map, that is, a tensor.

Function inner(m) returns the \(2\)-form that maps \(\bold x,\bold y\) to \(\bold x^TM\bold y\).

See Also

kform

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab