[Bug 400] New: Cholesky decomposition

For more information about this bug, visit
A new bug was added:
Summary: Cholesky decomposition
Product: BFL
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: core
AssignedTo: bfl [..] ...
ReportedBy: wim [dot] meeussen [..] ...

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 (see below).
The matrixwrapper also contains an implementation cholesky_semidefinite. I
suggest to remove the current cholesky implementation, and only use the
(working) cholesky_semidefinite implementation.

Wim

- 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

wmeeusse's picture

[Bug 400] Cholesky decomposition

For more information about this bug, visit

wim [dot] meeussen [..] ... changed:

What |Removed |Added
---------------------------------------------------------------------------
Resolution| |FIXED
Status|NEW |RESOLVED

------- Comment #8 from wim [dot] meeussen [..] ... 2007-05-15 08:33

patch applied in revision 28127.

[Bug 400] Cholesky decomposition

For more information about this bug, visit
A comment was added:
------- Comment #7 from tinne [dot] delaet [..] ... 2007-05-11 15:39

Ok, I agree with your patch. So feel free to apply it.
Let's keep the name cholesky_semidefinit since it is informative and prevents
confusion with ordirnary cholesky.

wmeeusse's picture

[Bug 400] Cholesky decomposition

For more information about this bug, visit
A comment was added:
------- Comment #6 from wim [dot] meeussen [..] ... 2007-05-11 15:30

> > the LTI implementation as a ground truth for definite matrices.
> > At the time, the LTI implementation worked fine!

> This issue is fixed in rev 28108. The problem was that Lti symmetric matrices
> only like access to elements in the _upper_ triangle, not the lower triangle.

However, the lti chol returs an upper triangle matrix, while the other matrix
libs return a lower triangle matrix.

wmeeusse's picture

[Bug 400] Cholesky decomposition

For more information about this bug, visit
A comment was added:
------- Comment #5 from wim [dot] meeussen [..] ... 2007-05-11 15:29

> Maybe we could just call the cholesky_semidefinite cholesky then, or would
> this cause confusion.

The name cholesky_semidefinite is of course more informative, but either way is
good.

> Did you also compare the efficiency of the home made cholesky_semidefinite
> and the cholesky factorisation proposed by lti,boost, newmat?

No. We could have done then when we replaced all the cholesky calls in BFL by
cholesky_semidefinite calls.

wmeeusse's picture

[Bug 400] Cholesky decomposition

For more information about this bug, visit
A comment was added:
------- Comment #4 from wim [dot] meeussen [..] ... 2007-05-11 15:24

(In reply to comment #3)
> I also want to remark that I am surprized by your tests.
> When I implemented the cholesky for semidefinite matrices I compared it with
> the LTI implementation as a ground truth for definite matrices.
> At the time, the LTI implementation worked fine!

This issue is fixed in rev 28108. The problem was that Lti symmetric matrices
only like access to elements in the _upper_ triangle, not the lower triangle.

[Bug 400] Cholesky decomposition

For more information about this bug, visit
A comment was added:
------- Comment #3 from tinne [dot] delaet [..] ... 2007-05-11 15:12

I also want to remark that I am surprized by your tests.
When I implemented the cholesky for semidefinite matrices I compared it with
the LTI implementation as a ground truth for definite matrices.
At the time, the LTI implementation worked fine!

[Bug 400] Cholesky decomposition

For more information about this bug, visit
A comment was added:
------- Comment #2 from tinne [dot] delaet [..] ... 2007-05-11 15:05

In your proposal you replace all cholesky calls by cholesky_semidefinite calls
and you remove the cholesky function from the matrix-wrapper classes.
Maybe we could just call the cholesky_semidefinite cholesky then, or would this
cause confusion.
Did you also compare the efficiency of the home made cholesky_semidefinite and
the cholesky factorisation proposed by lti,boost, newmat?

Tinne

wmeeusse's picture

[Bug 400] Cholesky decomposition

For more information about this bug, visit
A comment was added:
------- Comment #1 from wim [dot] meeussen [..] ... 2007-05-11 12:55

Created an attachment (id=127)
--> (http://www.fmtc.be/orocos-bugzilla/attachment.cgi?id=127&action=view)
proposed patch