I need to evaluate many times the following function:
x,y are real numbers and
A,Bare large NxN symmetric matrices of real numbers (e.g. 1000x1000). I am trying to optimize this function. Compiling the function does not seem to help. However, as the matrices are symmetric, it is redundant to sum all the $N^2$ terms; it would be enough to sum the relevant $N(N+1)/2$ terms. Does someone know how to efficiently do this?
UPDATE: As suggested by bill s, one could store the following flatten versions of the upper triangular parts:
and then do:
Is there an efficient way to map the vector
fup[x,y] into a symmetric matrix?
I have found this thread but I cannot understand well R.