Boost logo

Ublas :

Subject: [ublas] Banded adaptor: copy assignment issue?
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2010-08-19 12:54:56


Dear all,

Take a look at the following code:

--- [code-snip] ---
ublas::matrix<double> A(5, 4);

// Initialized A ...

ublas::banded_adaptor< matrix<double> > B(A, 2, 1);

// Test copy-assignment
// - Case #1
ublas::banded_adaptor< matrix<double> > C(A, 2, 1);
C = B;
// - Case #2
ublas::banded_adaptor< matrix<double> > D(A);
D = B;
--- [/code-snip] ---

Now Case #1 works OK but Case #2 fails, with this error:

--- [error] ---
Check failed in file
/home/marco/tmp/boost-trunk/boost/numeric/ublas/detail/matrix_assign.hpp
at line 763:
detail::expression_type_check (m, cm)
--- [/error] ---

Is it what you would expect?

IMHO, Case #2 should work too, but maybe there is some rationale
underlying adaptor matrix assignment that I don't know.
Documentation simply says:
  banded_adaptor &operator = (const banded_adaptor &m) The assignment operator

Note: I didn't tried with other special matrix classes, but I suspect
the assignment works in a similar way.

The attachment contains a working test.

Thank you very much!!

Cheers,

-- Marco