comparison liboctave/dMatrix.cc @ 6162:b3c425131211

[project @ 2006-11-14 15:33:22 by jwe]
author jwe
date Tue, 14 Nov 2006 15:33:22 +0000
parents ae09df27153f
children 3c92b8d892dd
comparison
equal deleted inserted replaced
6161:4d90ee4061ef 6162:b3c425131211
2978 return retval; 2978 return retval;
2979 } 2979 }
2980 2980
2981 // matrix by matrix -> matrix operations 2981 // matrix by matrix -> matrix operations
2982 2982
2983 /* Simple Dot Product, Matrix-Vector and Matrix-Matrix Unit tests
2984 %!assert([1 2 3] * [ 4 ; 5 ; 6], 32, 1e-14)
2985 %!assert([1 2 ; 3 4 ] * [5 ; 6], [17 ; 39 ], 1e-14)
2986 %!assert([1 2 ; 3 4 ] * [5 6 ; 7 8], [19 22; 43 50], 1e-14)
2987 */
2988
2989 /* Test some simple identities
2990 %!shared M, cv, rv
2991 %! M = randn(10,10);
2992 %! cv = randn(10,1);
2993 %! rv = randn(1,10);
2994 %!assert([M*cv,M*cv],M*[cv,cv],1e-14)
2995 %!assert([rv*M;rv*M],[rv;rv]*M,1e-14)
2996 %!assert(2*rv*cv,[rv,rv]*[cv;cv],1e-14)
2997 */
2998
2999
2983 Matrix 3000 Matrix
2984 operator * (const Matrix& m, const Matrix& a) 3001 operator * (const Matrix& m, const Matrix& a)
2985 { 3002 {
2986 Matrix retval; 3003 Matrix retval;
2987 3004