Re: [Lapackpp-devel] Latridiagatdouble
Status: Beta
Brought to you by:
cstim
From: Do bi <mrc...@ya...> - 2006-08-08 09:03:35
|
Thanks Chris for the small code. Brilliant! Christian Stimming <sti...@tu...> wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Do bi schrieb: > Hi. You briefly explained with enough code how to create a tridiagonal > matrix on > http://lapackpp.sourceforge.net/html/classLaTridiagMatDouble.html#_details > which is > LaVectorDouble newdiag(N); > newdiag(0) = ...; > LaTriagMatDouble triagmat(N); > triagmat.diag(0).inject(newdiag); // correct > // but don't write this: > triagmat.diag(0) = newdiag; // wrong! > and easily understood and very helpful. Can you please write a similar > size of code to solve a tridiagonal matrix? Sure: #include // for LaTridiagFactDouble class // define A LaTridiagMatDouble A(N); A.diag(0).inject(...); // fill the matrix with values // define X and B LaGenMatDouble B(N,1); B = ...; // fill B with values from somewhere // To solve Ax=b: LaTridiagFactDouble Afact; LaGenMatDouble X(N,1); LaTridiagMatFactorize(A, Afact); // calculate LU factorization LaLinearSolve(Afact, X, B); // solve; result is in X Regards, Christian -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBRNhIn2XAi+BfhivFAQLS0wP+MZEGreWLkbBGxk2EGVHAY86kL4YDiXfO uGgCXCu31hy/1kXRQI32GNpvZEhTgeiP3kA232Y651MBrXY1LjAgAMEcYKHf9DT+ OzUFsvNXnm4cTzepuphgr1jyqiDL0VjbQBmLdOf/e1RfB/kmxEmB/A4GQPAL3Lvw yueID2dzOPg= =aggs -----END PGP SIGNATURE----- --------------------------------- Do you Yahoo!? Next-gen email? Have it all with the all-new Yahoo! Mail Beta. |