Boost logo

Ublas :

Subject: [ublas] different size for matrix addition
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-06-16 03:29:05


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