comparison liboctave/CMatrix.cc @ 6162:b3c425131211

[project @ 2006-11-14 15:33:22 by jwe]
author jwe
date Tue, 14 Nov 2006 15:33:22 +0000
parents ced23ae2b5cc
children 3c92b8d892dd
comparison
equal deleted inserted replaced
6161:4d90ee4061ef 6162:b3c425131211
3603 { 3603 {
3604 ComplexMatrix tmp (m); 3604 ComplexMatrix tmp (m);
3605 return tmp * a; 3605 return tmp * a;
3606 } 3606 }
3607 3607
3608 /* Simple Dot Product, Matrix-Vector and Matrix-Matrix Unit tests
3609 %!assert([1+i 2+i 3+i] * [ 4+i ; 5+i ; 6+i], 29+21i, 1e-14)
3610 %!assert([1+i 2+i ; 3+i 4+i ] * [5+i ; 6+i], [15 + 14i ; 37 + 18i], 1e-14)
3611 %!assert([1+i 2+i ; 3+i 4+i ] * [5+i 6+i ; 7+i 8+i], [17 + 15i 20 + 17i; 41 + 19i 48 + 21i], 1e-14)
3612 */
3613
3614 /* Test some simple identities
3615 %!shared M, cv, rv
3616 %! M = randn(10,10)+i*rand(10,10);
3617 %! cv = randn(10,1)+i*rand(10,1);
3618 %! rv = randn(1,10)+i*rand(1,10);
3619 %!assert([M*cv,M*cv],M*[cv,cv],1e-14)
3620 %!assert([rv*M;rv*M],[rv;rv]*M,1e-14)
3621 %!assert(2*rv*cv,[rv,rv]*[cv;cv],1e-14)
3622 */
3623
3608 ComplexMatrix 3624 ComplexMatrix
3609 operator * (const ComplexMatrix& m, const ComplexMatrix& a) 3625 operator * (const ComplexMatrix& m, const ComplexMatrix& a)
3610 { 3626 {
3611 ComplexMatrix retval; 3627 ComplexMatrix retval;
3612 3628