Hi,

Assume that L is the lower Cholesky factor of a symmetric p.d. matrix A, 
such that A = LL'. I am trying to calculate L^(-1)B for some matrix B, but 
my current way of doing it is extremely slow.

Here is an example:
using Distances
n=1000
A=exp(-pairwise(Euclidean(),[1:n]',[1:n]')/n*50)
B=rand(n,n)
L=chol(A,:L)  # lower cholesky factor of A
@time L\B  # this is what I want, but it is slow (1.2 seconds on my 
computer)

Compare this to the time it takes to solve the following (harder) problem 
of computing A^(-1)B=L'^(-1)(L^(-1)B):
Achol=cholfact(A,:L)  # cholesky representation of A = LL'
@time Achol\B  # this is much faster (.04 seconds), even though it solves 
the harder problem L'^(-1)(L^(-1)B)
@time Achol[:L]\B # again, this is what I want, but computation is slow 
(1.3 seconds)

I suspect this discrepancy in timing is because Achol\B uses 
back-/forward-solves that exploit the triangular structure of Cholesky 
factors, whereas L\B does not. Is there any way I can obtain L^(-1)B much 
faster?

Thank you!

Reply via email to