# Ublas :

From: Karl Meerbergen (karl.meerbergen_at_[hidden])
Date: 2008-08-22 02:14:22

Hi,

1 2 3
4 5 6
7 8 9
This is a singular matrix. You can do a factorization but not a solve
afterwards.

Best regards,

Karl

Ð˜Ð²Ð¾Ð»Ð³Ð¸Ð½ ÐÑ€Ð´Ð°Ð»Ð¸Ð¾Ð½ wrote:
> Hello, everybody!
>
> I found a page about LU-decomposition on Effective uBLAS wiki. Everything looked neat, and I decided to write simple example like this below:
>
> #include <boost/numeric/ublas/io.hpp>
> #include <boost/numeric/ublas/lu.hpp>
>
> using namespace boost::numeric::ublas;
>
> int main () {
> matrix<int> A(3,3), B(identity_matrix<int>(3));
> for (int i=0; i<3; ++i)
> for (int j=0; j<3; ++j)
> A(i,j)=3*i+j+1;
>
> std::cout << A << std::endl;
> std::cout << B << std::endl;
>
> permutation_matrix<> pm(3);
>
> lu_factorize<matrix<int>, permutation_matrix<> >(A, pm);
> lu_substitute(A, pm, B);
>
> std::cout << A << std::endl;
> std::cout << B << std::endl;
>
> return EXIT_SUCCESS;
> }
>
> But when I try to run the compiled executable, I got a run-time assertion with this text:
>
> Check failed in .../include/boost/numeric/ublas/lu.hpp at line 157:
> singular != 0 || detail::expression_type_check (prod (triangular_adaptor<matrix_type, unit_lower> (m), triangular_adaptor<matrix_type, upper> (m)), cm)
>