MTL 4: svd(A, tol)
boost::tie(S, V, D)= svd(A, 1.e-10)
Details: mtl::matrix::svd
#include <iostream> #include <boost/test/minimal.hpp> #include <boost/numeric/mtl/mtl.hpp> using namespace std; int test_main(int, char**) { mtl::dense2D<double> A(3, 4), A_t(3, 4), S(3, 3), V(3, 4), D(4,4); A= 0; A[0][0]=1; A[0][1]=1; A[0][2]=1; A[0][3]=4; A[1][0]=1; A[1][1]=2; A[1][2]=2; A[1][3]=3; A[2][0]=9; A[2][1]=3; A[2][2]=2; A[2][3]=4; std::cout<<"A=\n"<< A <<"\n"; boost::tie(S, V, D)= svd(A, 1.e-10)= svd(A); //second argument is optional (missmatch of upper R (A= Q*R)) std::cout<<"Matrix S=\n"<< S <<"\n"; std::cout<<"Matrix V=\n"<< V <<"\n"; std::cout<<"Matrix D=\n"<< D <<"\n"; A_t= S*V*trans(D); std::cout<<"Matrix A=S*V*D'=\n"<< A_t <<"\n"; return 0; }
Return to Overview Table of Content
svd(A, tol) -- MTL 4 -- Peter Gottschling and Andrew Lumsdaine
-- Gen. with
rev. 7542
on 7 Apr 2011 by doxygen 1.5.9 -- © 2010 by SimuNova UG.