better to give the same size to x and y, filling x with extra zeros.
here z takes the size of y but is filled with wrong indices due to x having a smaller size.

By the way, I have never been so confortable with the idea of assuming zeros when adding 2 matrices of different sizes :-)

On Wed, Jun 16, 2010 at 09:29, Kraus Philipp <philipp.kraus@flashpixx.de> wrote:
Hi,

I have written this short code:
blas::matrix<int> x(2, 2, 2);
blas::matrix<int> y(3, 3, 0);

    

blas::matrix<int> z = y+x;
std::cout << y << std::endl;
std::cout << x << std::endl;
std::cout << z << std::endl;

with this output
[3,3]((0,0,0),(0,0,0),(0,0,0))
[2,2]((2,2),(2,2))
[3,3]((2,2,2),(2,2,0),(0,0,0))

on my mathematical thinking my z (third output) should be:
[3,3]((2,2,0),(2,2,0),(0,0,0))

Do I misunderstood the + operation?

Thanks

Phil

_______________________________________________
ublas mailing list
ublas@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: david.bellot@gmail.com



--
David Bellot, PhD
david.bellot@gmail.com
http://david.bellot.free.fr