Mercurial > hg > octave-jordi
changeset 6162:b3c425131211
[project @ 2006-11-14 15:33:22 by jwe]
author | jwe |
---|---|
date | Tue, 14 Nov 2006 15:33:22 +0000 |
parents | 4d90ee4061ef |
children | 8614649c454c |
files | liboctave/CMatrix.cc liboctave/ChangeLog liboctave/dMatrix.cc test/ChangeLog test/fntests.m |
diffstat | 5 files changed, 43 insertions(+), 1 deletions(-) [+] |
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) {
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2006-11-14 Luis F. Ortiz <lortiz@interactivesupercomputing.com> + + * CMatrix.cc, dMatrix.cc: New tests. + 2006-11-13 Michael Goffioul <michael.goffioul@swing.be> * Array-d.cc, dDiagMatrix.h: Sprinkle with OCTAVE_API as needed.
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -2980,6 +2980,23 @@ // matrix by matrix -> matrix operations +/* Simple Dot Product, Matrix-Vector and Matrix-Matrix Unit tests +%!assert([1 2 3] * [ 4 ; 5 ; 6], 32, 1e-14) +%!assert([1 2 ; 3 4 ] * [5 ; 6], [17 ; 39 ], 1e-14) +%!assert([1 2 ; 3 4 ] * [5 6 ; 7 8], [19 22; 43 50], 1e-14) +*/ + +/* Test some simple identities +%!shared M, cv, rv +%! M = randn(10,10); +%! cv = randn(10,1); +%! rv = randn(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) +*/ + + Matrix operator * (const Matrix& m, const Matrix& a) {
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2006-11-14 Luis F. Ortiz <lortiz@interactivesupercomputing.com> + + * fntests.m: Include liboctave in the list of directories to test. + 2006-08-25 John W. Eaton <jwe@octave.org> * test_io.m (testls): Allow for small variance in loaded values
--- a/test/fntests.m +++ b/test/fntests.m @@ -23,7 +23,8 @@ src_tree = canonicalize_file_name (fullfile (topsrcdir, "src")); script_tree = canonicalize_file_name (fullfile (topsrcdir, "scripts")); -fundirs = {src_tree, script_tree}; +liboctave_tree = canonicalize_file_name (fullfile (topsrcdir, "liboctave")); +fundirs = {src_tree, liboctave_tree, script_tree}; function print_test_file_name (nm) filler = repmat (".", 1, 55-length (nm));