Bugzilla – Attachment 715 Details for
Bug 707
In-Place decompositions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
Usage example
lu_inplace.cpp (text/x-csrc), 1.68 KB, created by
Gael Guennebaud
on 2016-06-23 16:33:40 UTC
(
hide
)
Description:
Usage example
Filename:
MIME Type:
Creator:
Gael Guennebaud
Created:
2016-06-23 16:33:40 UTC
Size:
1.68 KB
patch
obsolete
>#include <iostream> >#include <Eigen/Dense> >using namespace Eigen; >using namespace std; > >int main() >{ > MatrixXd A0 = MatrixXd::Random(10,10); > A0 = A0.transpose() * A0; > MatrixXd A1 = A0; > VectorXd b = VectorXd::Random(10), x(10); > > A0 = A1; > PartialPivLU<Ref<MatrixXd> > lu(A0); > cout << "Check that A0 has been modified: " << (A0-A1).norm()/A0.norm() << endl; > x = lu.solve(b); > cout << "Error: " << (A1*x-b).norm()/b.norm() << endl; > > A0 = A1; > FullPivLU<Ref<MatrixXd> > flu(A0); > cout << "Check that A0 has been modified: " << (A0-A1).norm()/A0.norm() << endl; > x = flu.solve(b); > cout << "Error: " << (A1*x-b).norm()/b.norm() << endl; > > A0 = A1; > HouseholderQR<Ref<MatrixXd> > qr(A0); > cout << "Check that A0 has been modified: " << (A0-A1).norm()/A0.norm() << endl; > x = qr.solve(b); > cout << "Error: " << (A1*x-b).norm()/b.norm() << endl; > > A0 = A1; > ColPivHouseholderQR<Ref<MatrixXd> > cpqr(A0); > cout << "Check that A0 has been modified: " << (A0-A1).norm()/A0.norm() << endl; > x = cpqr.solve(b); > cout << "Error: " << (A1*x-b).norm()/b.norm() << endl; > > A0 = A1; > FullPivHouseholderQR<Ref<MatrixXd> > fpqr(A0); > cout << "Check that A0 has been modified: " << (A0-A1).norm()/A0.norm() << endl; > x = fpqr.solve(b); > cout << "Error: " << (A1*x-b).norm()/b.norm() << endl; > > A0 = A1; > LLT<Ref<MatrixXd> > llt(A0); > cout << "Check that A0 has been modified: " << (A0-A1).norm()/A0.norm() << endl; > x = llt.solve(b); > cout << "Error: " << (A1*x-b).norm()/b.norm() << endl; > > A0 = A1; > LDLT<Ref<MatrixXd> > ldlt(A0); > cout << "Check that A0 has been modified: " << (A0-A1).norm()/A0.norm() << endl; > x = ldlt.solve(b); > cout << "Error: " << (A1*x-b).norm()/b.norm() << endl; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 707
:
714
| 715