[SciPy-user] solving Ax=b, known L: A = L L^T
Steve Schmerler
elcorto@gmx....
Tue Aug 28 04:06:22 CDT 2007
dmitrey wrote:
> Hi all,
> suppose I have a system Ax=b and I know (Cholesky) triangular L: A = L L^T
> what's the simplest way to obtain x now?
> (I meant python code)
> is it solve(L^T, solve(L,b))?
> or I should somehow inform solve() about L is triangular or, maybe, use
> other func?
> Documentation of numpy.linalg.solve doesn't say anything.
> Afaik MATLAB's '\' determ type of matrix automatically.
> Regards, D.
>
I don't do linalg much, but I know of linalg.cho_factor() and linalg.cho_solve().
In [42]: A
Out[42]:
array([[ 5., 2., 1.],
[ 2., 5., 2.],
[ 1., 2., 5.]])
In [43]: b
Out[43]: array([ 1., 2., 3.])
In [44]: linalg.solve(A,b, sym_pos=0)
Out[44]: array([ 0.02272727, 0.18181818, 0.52272727])
In [45]: linalg.solve(A,b, sym_pos=1)
Out[45]: array([ 0.02272727, 0.18181818, 0.52272727])
In [46]: linalg.cho_solve(linalg.cho_factor(A), b)
Out[46]: array([ 0.02272727, 0.18181818, 0.52272727])
--
cheers,
steve
I love deadlines. I like the whooshing sound they make as they fly by. --
Douglas Adams
More information about the SciPy-user
mailing list