# Matrixwrapper Cholesky

 Submitted by wmeeusse on Thu, 2007-05-10 14:25

Hi,

I started from a matrix A = [3 2 1; 2 2 1; 1 1 1] and calculated the cholisky.
With the different backend matrix libs, I got different results:

- with Boost:
1.73205 0.000000 0.000000
1.1547 0.816497 0.000000
0.57735 0.408248 0.707107

- with lti:
1.73205 0.000000 0.000000
0.000000 1.41421 0.000000
0.000000 0.000000 1.000000))

- with newmat:
1.732051 0.000000 0.000000
1.154701 0.816497 0.000000
0.577350 0.408248 0.707107

- with octave (not matrixwrapper):
1.73205 1.15470 0.57735
0.00000 0.81650 0.40825
0.00000 0.00000 0.70711

Does it matter for our algorithms if we get an upper or lower traingular
matrix? It looks like the lti version still has some issues... Any
suggestions?

Wim
_______________________________________________
I hereby promise not to top-post on the
BFL mailing list
BFL [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/bfl

### Matrixwrapper Cholesky

It makes a DIFFERENCE for the code using it....

To add to the confusion, I've found an implementation of cholesky
in cholesky_semidefinite() in matrixwrapper :
==> wrappers/matrix/matrix_wrapper.cpp

What is the difference of cholesky and cholesky_semidefinite ?

I suppose the emphasis is on semi-, in that cholesky_semidefinite is supposed
to handle the case when there is a 0 element on the diagonal of the lower
triangular result.

cholesky_semidefinite uses a LOWER TRIANGULAR matrix.

grep -r cholesky * shows that cholesky is only used in
filter/SRiteratedextendedkalmanfilter.cpp:
(prior->CovarianceGet()).cholesky(JP);

when applied to a state covariance matrix.

Can't we (or shouldn't we) use cholesky_semidefinite here ? Then we are can
remove the specific calls to the different matrix libraries.

PS. :
1) In wrappers/matrix/matrix_wrapper.cpp should it not
be a(k,k) < epsilon (very small value) instead of a(k,k) < 0 ?

Erwin

On Thursday 10 May 2007 16:18:58 Wim Meeussen wrote:
> Hi,
>
> I started from a matrix A = [3 2 1; 2 2 1; 1 1 1] and calculated the
> cholisky. With the different backend matrix libs, I got different results:
>
> - with Boost:
> 1.73205 0.000000 0.000000
> 1.1547 0.816497 0.000000
> 0.57735 0.408248 0.707107
>
> - with lti:
> 1.73205 0.000000 0.000000
> 0.000000 1.41421 0.000000
> 0.000000 0.000000 1.000000))

Perhaps this comes from a upper/lower triangular confusion somewhere..
>
> - with newmat:
> 1.732051 0.000000 0.000000
> 1.154701 0.816497 0.000000
> 0.577350 0.408248 0.707107
>
> - with octave (not matrixwrapper):
or with chol(A,'lower') the same as Boost and newmat.
> 1.73205 1.15470 0.57735
> 0.00000 0.81650 0.40825
> 0.00000 0.00000 0.70711
>
> Does it matter for our algorithms if we get an upper or lower traingular
> matrix? It looks like the lti version still has some issues... Any
> suggestions?
>
> Wim
> _______________________________________________
> I hereby promise not to top-post on the
> BFL mailing list
> BFL [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/bfl

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

_______________________________________________
I hereby promise not to top-post on the
BFL mailing list
BFL [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/bfl

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm