Boost logo

Ublas :

From: Adrien Schvalberg (adrien.schvalberg_at_[hidden])
Date: 2005-07-28 09:47:21


Hello ublasers,

I'm using ublas (boost 1.32.0) with VC++ 6.0

I can't have a banded-banded product work with a banded result directly.
a (m1,n1) l1,u1-banded matrix multiplied with a (n1,n2) l2,u2-banded matrix should
produces a (m1,n2) (l1+l2,u1+u2)-banded matrix.

With this simple code, it doesn't work. I always have a full matrix in return.

#include <iostream>

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

int main(char* argc, char** argv)
{
    size_t m1 = 9, n1 = 10;
    size_t m2 = 10, n2 = 11;
    size_t l1 = 0, u1 = 1;
    size_t l2 = 0, u2 = 1;

    boost::numeric::ublas::banded_matrix<double> M1(m1, n1, l1, u1);
    boost::numeric::ublas::banded_matrix<double> M2(m2, n2, l2, u2);

    for (size_t i1 = 0; i1 < m1; ++i1)
    {
       M1(i1, i1) = -1.;
       M1(i1, i1 + 1) = 1.;
    }
    for (size_t i2 = 0; i2 < m2; ++i2)
    {
       M2(i2, i2) = -1.;
       M2(i2, i2 + 1) = 1.;
    }

    std::cout << "M1=" << M1 << std::endl;
    std::cout << "M2=" << M2 << std::endl;

    boost::numeric::ublas::banded_matrix<double> M = prod(M1, M2);

    std::cout << "M=" << M << std::endl;

    return 0;
}

This is the error returned:
Assertion failed in file
D:\Datas\wnccad_dev\boost_1_32_0\boost/numeric/ublas/matrix_assign.hpp at line 797:
equals (m, cm)

Do you have any suggestions?

Adrien Schvalberg
PS: I can't use the CVS version of ublas since it's incompatible with VC++6