I have a norm that is described by the matrix sigma
sigma <- matrix(c(1,0.5,0,0.5,1,0,0,0,1),3,3))
To compute the norm of a vector I compute
t(x) %*% sigma %*% x
which works fine for a vector e.g. x = 1:3
.
However i want to compute the norm of many vectors at the same time, that is I have
x <- t(matrix(rep(1:3, 10),3,10))
(of course filled with different entries).
Is there a way to compute the norm of each vector simultanuously? I.e. something like
lapply(1:10, function(i) t(x[i,]) %*% sigma %*% x[i,])