![]() |
Blitz Support : |
From: Google Poster (googleposter_at_[hidden])
Date: 2004-01-05 09:31:06
Please forgive my ignorance - I am not a
mathematician.
I am involved in a project that requires high
performance math. I have been replacing the old
legacy routines with blitz++ and have been
experiencing encouraging results thus far. I have hit
a problem with matrix multiplication and I am sure the
root cause is my lack of understand.
I *think*.
A matrix with dimensions A x B can be multiplied by a
matrix with dimensions B x C to produce a matrix of
dimensions A x C.
For this code:
// ---------------------------------------------
#include <blitz/array.h>
using namespace blitz;
int main(int argc, char* argv[])
{
double* t = new double[100];
double* t2 = new double[2400];
Array<double,2> m1( t , shape( 1 , 100 ) ,
neverDeleteData );
Array<double,2> m2( t2 , shape( 100 , 24 ) ,
neverDeleteData ,blitz::ColumnMajorArray<2>() );
blitz::firstIndex iw;
m1 = iw;
m2 = iw;
cout << m1 << endl;
cout << m2 << endl;
Array<double,2> m3( m1 * m2 );
cout << m3 << endl;
}
// ----------------------------------------
M3 is a matrix of 1 x 1 - I would expect 1 x 24
matrix.
Any assistance would be gratefully appreciated.
-- gp __________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/