Blitz logo

Blitz Bugs :

From: Martin Wiebusch (martin.wiebusch_at_[hidden])
Date: 2003-06-17 12:31:36


Hi,

the following calculation gives wrong results.

Array<double, 2> M(3, 3);
// a 3x3 Matrix

M = 0, -1, 0,
     1, 0, 0,
     0, 0, 2;
// or any other Matrix

Array<double, 2> l(5, 3);
// as a "list" of 5 Vectors (3-dimensional)

l = 11, 12, 13,
     21, 22, 23,
     31, 32, 33,
     41, 42, 43,
     51, 52, 53;

firstIndex i;
secondIndex j;
thirdIndex k;

l = sum(M(j,k)*l(i,k) , k);
// this should apply M to each vector in the list

std::cout << l << std::endl;

I couldn't figure out what is calculated there, but the results are
wrong. On the other hand this works:

Array<double, 3> A(5, 3, 3);
A = M(j,k)*l(i,k);
l = sum(A, k);

Is this a bug or my mistake?

Regards,
Martin.