Boost logo

Ublas :

Subject: [ublas] LU factorisation of symmetric_matrix
From: Vitaly Budovski (vbudovski+news_at_[hidden])
Date: 2011-11-19 00:18:25


Hi,

There seems to be an issue with the lu_factorize function when
factorising symmetric_matrix matrices.
Please see the code below. An assertion is triggered when attempting
to factorise m1.

Any ideas?

Thanks.

#include <boost/numeric/ublas/lu.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/symmetric.hpp>
#include <boost/numeric/ublas/io.hpp>

int main()
{
    using namespace boost::numeric;

    ublas::symmetric_matrix<double> m1(3, 3);
    m1.clear();

    m1(0, 0) = 1;
    m1(0, 1) = 2;
    m1(0, 2) = 3;
    m1(1, 1) = 5;
    m1(1, 2) = 4;
    m1(2, 2) = 7;

    std::cout << "m1: " << m1 << std::endl;

    ublas::matrix<double> m2(m1);

    std::cout << "m2: " << m2 << std::endl;

    ublas::permutation_matrix<std::size_t> pm(m1.size1());

    std::cout << "LU factorisation of m2\n";
    lu_factorize(m2, pm);
    std::cout << "LU factorisation of m1\n";
    lu_factorize(m1, pm);

    return 0;
}