## blitz-support

 [Blitz-support] TinyMatrix * double problem From: van den Bosch - 2003-11-04 16:41:47 ```Hello, I have a problem for multiplying a TinyMatrix with a double. Here is the code: #include #include #include #include #include using namespace blitz; int main (void) { double a = 3.0; TinyMatrix A, B; TinyVector x, y, z; A = 1.0, -2.0, 0.0, 2.0, 1.0, 0.0, 0.0, 0.0, 1.0; cout << A << endl; B = A * a; cout << B << endl; x = 2.0, 3.0, 4.0; cout << x << endl; y = product(A, x); cout << y << endl; z = y*2.0; cout << z << endl; } and here is the error compilation message : [denbosch@... TinyMatrix]\$ make g++ -c -O3 -I../../../blitz++/include tiny.cpp tiny.cpp: In function `int main()': tiny.cpp:20: no match for `blitz::TinyMatrix& * double&' operator ../../../blitz++/include/blitz/vecbops.cc:3736: candidates are: blitz::_bz_VecExpr, blitz::Range, blitz::_bz_Multiply > > blitz::operator*(long double, blitz::Range) ../../../blitz++/include/blitz/vecbops.cc:3651: blitz::_bz_VecExpr, blitz::Range, blitz::_bz_Multiply > > blitz::operator*(double, blitz::Range) ../../../blitz++/include/blitz/vecbops.cc:3566: blitz::_bz_VecExpr, blitz::Range, blitz::_bz_Multiply > > blitz::operator*(float, blitz::Range) ../../../blitz++/include/blitz/vecbops.cc:3237: blitz::_bz_VecExpr, blitz::_bz_Multiply > > blitz::operator*(blitz::Range, long double) ../../../blitz++/include/blitz/vecbops.cc:3220: blitz::_bz_VecExpr, blitz::_bz_Multiply > > blitz::operator*(blitz::Range, double) ../../../blitz++/include/blitz/vecbops.cc:3203: blitz::_bz_VecExpr, blitz::_bz_Multiply > > blitz::operator*(blitz::Range, float) ../../../blitz++/include/blitz/vecbops.cc:3169: blitz::_bz_VecExpr > > blitz::operator*(blitz::Range, blitz::Range) ../../../blitz++/include/blitz/meta/metaprog.h:58: T blitz::operator*(const T&, blitz::_bz_meta_nullOperand) [with T = blitz::TinyMatrix] make: *** [tiny.o] Error 1 [denbosch@... TinyMatrix]\$ Anyone has a clue about what's wrong in my code ? Thanks, Ides -- Ir Idesbald van den Bosch PhD Student 3, Place du Levant - Bâtiment Maxwell 1348 Louvain-la-Neuve tel.: +32 (0)10 47 81 06 fax : +32 (0)10 47 87 05 ```
 Re: [Blitz-support] TinyMatrix * double problem From: Navneet Dalal - 2003-11-04 18:15:33 ```TinyMatrix is not really fully supported in blitz. It lacks all unary and binary operators (like *, /, - +, +=, -=, *=, /=) for all type of arguments (e.g. double and TinyMatrix itself). You need to define these functions on your own in blitz/tinymat.h (blitz/tinyvec.h file may provide you a good starting template) Also, following two lines will not compile. TinyMatrix A(3.0); TinyMatrix B(A); So you may want to add corresponding constructors. -navneet On Tue, 4 Nov 2003 14:54:01 +0100, van den Bosch wrote: > Hello, > > I have a problem for multiplying a TinyMatrix with a double. Here is the > code: > > #include > #include > #include > #include > #include > > using namespace blitz; > > int main (void) { > double a = 3.0; > TinyMatrix A, B; > TinyVector x, y, z; > A = 1.0, -2.0, 0.0, > 2.0, 1.0, 0.0, > 0.0, 0.0, 1.0; > cout << A << endl; > B = A * a; > cout << B << endl; > > x = 2.0, 3.0, 4.0; > cout << x << endl; > > y = product(A, x); > cout << y << endl; > z = y*2.0; > cout << z << endl; > } > > and here is the error compilation message : > > [denbosch@... TinyMatrix]\$ make > g++ -c -O3 -I../../../blitz++/include tiny.cpp > tiny.cpp: In function `int main()': > tiny.cpp:20: no match for `blitz::TinyMatrix& * double&' > operator > .../../../blitz++/include/blitz/vecbops.cc:3736: candidates are: > blitz::_bz_VecExpr double>, blitz::Range, blitz::_bz_Multiply > > > blitz::operator*(long double, blitz::Range) > .../../../blitz++/include/blitz/vecbops.cc:3651: > blitz::_bz_VecExpr, > blitz::Range, blitz::_bz_Multiply > > > blitz::operator*(double, > blitz::Range) > .../../../blitz++/include/blitz/vecbops.cc:3566: > blitz::_bz_VecExpr, > blitz::Range, blitz::_bz_Multiply > > > blitz::operator*(float, > blitz::Range) > .../../../blitz++/include/blitz/vecbops.cc:3237: > blitz::_bz_VecExpr blitz::_bz_VecExprConstant, blitz::_bz_Multiply double> > > blitz::operator*(blitz::Range, long double) > .../../../blitz++/include/blitz/vecbops.cc:3220: > blitz::_bz_VecExpr blitz::_bz_VecExprConstant, blitz::_bz_Multiply > > > > blitz::operator*(blitz::Range, double) > .../../../blitz++/include/blitz/vecbops.cc:3203: > blitz::_bz_VecExpr blitz::_bz_VecExprConstant, blitz::_bz_Multiply > > > blitz::operator*(blitz::Range, float) > .../../../blitz++/include/blitz/vecbops.cc:3169: > blitz::_bz_VecExpr blitz::_bz_Multiply > > blitz::operator*(blitz::Range, > blitz::Range) > .../../../blitz++/include/blitz/meta/metaprog.h:58: T > blitz::operator*(const T&, blitz::_bz_meta_nullOperand) [with T = > blitz::TinyMatrix] > make: *** [tiny.o] Error 1 > [denbosch@... TinyMatrix]\$ > > Anyone has a clue about what's wrong in my code ? Thanks, > > Ides > -- Navneet DALAL http://www.inrialpes.fr/lear/people/Dalal INRIA Rhone-Alpes Ph(work): +33 (0)476 61 54 97 ZIRST-655, av. de l'Europe - 38334 FAX : +33 (0)476 61 54 54 Montbonnot St. Martin, France Mobile : +33 (0)677 54 33 33 ```