(42S) Cholesky decomposition and solve
|
08-19-2016, 09:02 AM
(This post was last modified: 06-15-2017 01:28 PM by Gene.)
Post: #1
|
|||
|
|||
(42S) Cholesky decomposition and solve
0.Abstract
The listed routines allow for decomposing a positive definite matrix A into: A = U'*U Where ' means real transpose or complex hermitian. Subsequently, a system of linear equations A*X=B may be solved. The routines use only the stack, and only the upper triangular part of A and U is referenced. A and U are NxN matrices, real or complex. In fact, U overwrites A. For accuracy reasons, matrix products have been used when possible, as they use higher intermediate precision on a real 42S. 1."u'u" - decomposition A=U'U, U upper triangular usage: X Y In : A Out: INFO U A and U are NxN real or complex matrices. U overwrites A (so A is lost). INFO=0 when ok, INFO=i when A was found not to be positive definite at step i. Stack levels Z and T are lost, but Y is preserved. 2."u/" and "u'/" - solve U*X=B and U'*X=B, respectively usage: X Y In : U B Out: U X U is the result of the decomposition with "u'u". B and X are NxM matrices. If U is complex, then so must B. 3."PD/" - all in one solve A*X=B with A positive definite usage: X Y In : A B Out: X A is NxN, real or complex. B and X are NxM. If A is complex and B is real, X will be complex. When A is not positive definite, execution stops with the message "Not Pos Def" 4.Source code Code: 00 { 332-Byte Prgm } And PD/: Code: 00 { 51-Byte Prgm } 5.Thoughts In case anyone is wondering: - the routines are slower than the built-in solving - they use up more space (if you keep the original A) - the results are less accurate, and that is actually a bit of a surprise. So why did I do it? Because I could ;-) And they are a nice example of how to code matrix routines on the 42S, and a prelude of things to come. As to the triangular solving, since the 42S factors a general matrix A into a lower triangular matrix L and an upper unit triangular matrix U, we can just call the builtin solve for U*X=B, and using a 'Mirror' permutation matrix M, we can do the same for U'X=B. The results are no better though - in fact, ever so slightly worse. 6.Attachment .raw code, annotated excel Cheers, Werner How can I align text (the In/out parts) without using Code? 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)