MATLAB: Symmetric Matrix-Vector Multiplication with only lower triangular stored

matrix multiplication

I have a very big (n>1000000) sparse symmetric positive definite matrix A and I want to multiply it efficiently by a vector x. Only the lower triangular of matrix A is stored with function "sparse". Is there any function inbuilt or external that anyone knows of that takes as input only the lower triangular and performs the complete operation Ax without having to recover whole A (adding the strict upper triangular again)?
Thank you very much,
Jan

Best Answer

Plese check if this is efficient in your case:
A = rand(5, 5);
A = A + A'; % Symmetric example matrix
B = tril(A); % Left triangular part
x = rand(5, 1);
y1 = A * x;
y2 = B * x + B.' * x - diag(B) .* x;
y1 - y2
ans = 5×1
1.0e+-15 * 0 0 -0.4441 0 0
I assume that Matlab's JIT can handle B.' * x without computing B.' explicitly. Alternative:
y2 = B * x + B.' * x - diag(diag(B)) * x;