diff 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
line wrap: on
line diff
--- a/liboctave/CMatrix.cc
+++ b/liboctave/CMatrix.cc
@@ -3605,6 +3605,22 @@
   return tmp * a;
 }
 
+/* Simple Dot Product, Matrix-Vector and Matrix-Matrix Unit tests
+%!assert([1+i 2+i 3+i] * [ 4+i ; 5+i ; 6+i], 29+21i, 1e-14)
+%!assert([1+i 2+i ; 3+i 4+i ] * [5+i ; 6+i], [15 + 14i ; 37 + 18i], 1e-14)
+%!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)
+*/
+
+/* Test some simple identities
+%!shared M, cv, rv
+%! M = randn(10,10)+i*rand(10,10);
+%! cv = randn(10,1)+i*rand(10,1);
+%! rv = randn(1,10)+i*rand(1,10);
+%!assert([M*cv,M*cv],M*[cv,cv],1e-14)
+%!assert([rv*M;rv*M],[rv;rv]*M,1e-14)
+%!assert(2*rv*cv,[rv,rv]*[cv;cv],1e-14)
+*/
+
 ComplexMatrix
 operator * (const ComplexMatrix& m, const ComplexMatrix& a)
 {