# Ublas :

From: Karl Meerbergen (karl.meerbergen_at_[hidden])
Date: 2008-08-24 03:40:41

It is possible that ublas' lu_factorize does not factor singular matrices.
Are you sure you want to solve a singular system.

Karl

Ð˜Ð²Ð¾Ð»Ð³Ð¸Ð½ ÐÑ€Ð´Ð°Ð»Ð¸Ð¾Ð½ wrote:
> Nope. I get a run-time assertion from function lu_factorize. Besides that I tried different matrixes.
>
> Anyway. Thanks for the reaction.)
>
>
>> Karl Meerbergen wrote:
>> Hi,
>> I guess your matrix is
>> 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)
>>>