Bugzilla – Attachment 338 Details for
Bug 603
Incorrect TriangularView<Strictly*> for sparse matrix
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
Test for TriangularView<Strictly*> with a sparse matrix
test_triangularView.cpp (text/x-c++src), 1.63 KB, created by
Kolja Brix
on 2013-05-22 11:05:29 UTC
(
hide
)
Description:
Test for TriangularView<Strictly*> with a sparse matrix
Filename:
MIME Type:
Creator:
Kolja Brix
Created:
2013-05-22 11:05:29 UTC
Size:
1.63 KB
patch
obsolete
>// Test for triangularView > >#include <iostream> >#include <cassert> > >#include <Eigen/Core> >#include <Eigen/SparseCore> > >int main() >{ > > Eigen::SparseMatrix < double, Eigen::Dynamic > M(4, 4); > M.reserve(8); > M.coeffRef(0, 0) = 5.2289368713698037e-01; > M.coeffRef(0, 1) = -2.5038590772102465e-01; > M.coeffRef(0, 3) = -7.1846596671288010e-02; > M.coeffRef(1, 0) = -6.3967231462905172e-01; > M.coeffRef(1, 1) = 9.2216518047923257e-01; > M.coeffRef(2, 2) = 5.5349543628405296e-01; > M.coeffRef(3, 2) = -8.1977519255454379e-01; > M.coeffRef(3, 3) = 1.1814529887186920e+00; > > Eigen::VectorXd x0(4); > x0(0) = 1.6229280400537460e-01; > x0(1) = 2.0786517141979544e-01; > x0(2) = 3.3868517289499633e-01; > x0(3) = 7.6880677694132837e-01; > > Eigen::VectorXd XL = M.triangularView < Eigen::StrictlyLower > () * x0; > Eigen::VectorXd XU = M.triangularView < Eigen::StrictlyUpper > () * x0; > > Eigen::VectorXd xL(4); > xL(0) = 0.0000000000000000e+00; > xL(1) = -1.0381421358575700e-01; > xL(2) = 0.0000000000000000e+00; > xL(3) = -2.7764570282536455e-01; > > Eigen::VectorXd xU(4); > xU(0) = -1.0728266005058837e-01; > xU(1) = 0.0000000000000000e+00; > xU(2) = 0.0000000000000000e+00; > xU(3) = 0.0000000000000000e+00; > > std::cout << "L=" << M.triangularView < Eigen::StrictlyLower > () << std::endl; > std::cout << "U=" << M.triangularView < Eigen::StrictlyUpper > () << std::endl; > > std::cout << "XL=" << XL << std::endl; > std::cout << "XU=" << XL << std::endl; > > assert(XL.size() == xL.size()); > assert((XL - xL).norm() < 1e-10); > > assert(XU.size() == xU.size()); > assert((XU - xU).norm() < 1e-10); > >}
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 603
: 338