# HG changeset patch # User Jaroslav Hajek # Date 1250403924 -7200 # Node ID ec066ba012c845b0a0ea6ca021ab14078618df83 # Parent 6a9fd5f653c99864b5931e5d447672b9a991a0d2 more fixes & tests for matrix multiply diff -r 6a9fd5f653c9 -r ec066ba012c8 liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc Sun Aug 16 07:04:40 2009 +0200 +++ b/liboctave/CMatrix.cc Sun Aug 16 08:25:24 2009 +0200 @@ -3755,7 +3755,11 @@ %! 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([M.'*cv,M.'*cv],M.'*[cv,cv],1e-14) +%!assert([M'*cv,M'*cv],M'*[cv,cv],1e-14) %!assert([rv*M;rv*M],[rv;rv]*M,1e-14) +%!assert([rv*M.';rv*M.'],[rv;rv]*M.',1e-14) +%!assert([rv*M';rv*M'],[rv;rv]*M',1e-14) %!assert(2*rv*cv,[rv,rv]*[cv;cv],1e-14) */ @@ -3853,7 +3857,7 @@ b.data (), 1, 0.0, c, 1 F77_CHAR_ARG_LEN (1))); } - else if (a_nr == 1 && ! conja) + else if (a_nr == 1 && ! conja && ! conjb) { const char *crevtransb = get_blas_trans_arg (! transb, conjb); F77_XFCN (zgemv, ZGEMV, (F77_CONST_CHAR_ARG2 (crevtransb, 1), diff -r 6a9fd5f653c9 -r ec066ba012c8 liboctave/ChangeLog --- a/liboctave/ChangeLog Sun Aug 16 07:04:40 2009 +0200 +++ b/liboctave/ChangeLog Sun Aug 16 08:25:24 2009 +0200 @@ -1,3 +1,9 @@ +2009-08-16 Jaroslav Hajek + + * dMatrix.cc, fMatrix.cc, CMatrix.cc, fCMatrix.cc: Add more tests. + * CMatrix.cc (xgemm): Fix vector * matrix case. + * fCMatrix.cc (xgemm): Ditto. + 2009-08-16 Jaroslav Hajek * fMatrix.cc, fCMatrix.cc: Make tests use single precision. diff -r 6a9fd5f653c9 -r ec066ba012c8 liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc Sun Aug 16 07:04:40 2009 +0200 +++ b/liboctave/dMatrix.cc Sun Aug 16 08:25:24 2009 +0200 @@ -3159,7 +3159,9 @@ %! cv = randn(10,1); %! rv = randn(1,10); %!assert([M*cv,M*cv],M*[cv,cv],1e-14) +%!assert([M'*cv,M'*cv],M'*[cv,cv],1e-14) %!assert([rv*M;rv*M],[rv;rv]*M,1e-14) +%!assert([rv*M';rv*M'],[rv;rv]*M',1e-14) %!assert(2*rv*cv,[rv,rv]*[cv;cv],1e-14) */ diff -r 6a9fd5f653c9 -r ec066ba012c8 liboctave/fCMatrix.cc --- a/liboctave/fCMatrix.cc Sun Aug 16 07:04:40 2009 +0200 +++ b/liboctave/fCMatrix.cc Sun Aug 16 08:25:24 2009 +0200 @@ -3744,12 +3744,16 @@ /* 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],5e-7) -%!assert([rv*M;rv*M],[rv;rv]*M,5e-7) -%!assert(2*rv*cv,[rv,rv]*[cv;cv],5e-7) +%! M = single(randn(10,10))+i*single(rand(10,10)); +%! cv = single(randn(10,1))+i*single(rand(10,1)); +%! rv = single(randn(1,10))+i*single(rand(1,10)); +%!assert([M*cv,M*cv],M*[cv,cv],5e-6) +%!assert([M.'*cv,M.'*cv],M.'*[cv,cv],5e-6) +%!assert([M'*cv,M'*cv],M'*[cv,cv],5e-6) +%!assert([rv*M;rv*M],[rv;rv]*M,5e-6) +%!assert([rv*M.';rv*M.'],[rv;rv]*M.',5e-6) +%!assert([rv*M';rv*M'],[rv;rv]*M',5e-6) +%!assert(2*rv*cv,[rv,rv]*[cv;cv],5e-6) */ static const char * @@ -3846,7 +3850,7 @@ b.data (), 1, 0.0, c, 1 F77_CHAR_ARG_LEN (1))); } - else if (a_nr == 1 && ! conja) + else if (a_nr == 1 && ! conja && ! conjb) { const char *crevtransb = get_blas_trans_arg (! transb, conjb); F77_XFCN (cgemv, CGEMV, (F77_CONST_CHAR_ARG2 (crevtransb, 1), diff -r 6a9fd5f653c9 -r ec066ba012c8 liboctave/fMatrix.cc --- a/liboctave/fMatrix.cc Sun Aug 16 07:04:40 2009 +0200 +++ b/liboctave/fMatrix.cc Sun Aug 16 08:25:24 2009 +0200 @@ -3157,9 +3157,11 @@ %! M = single(randn(10,10)); %! cv = single(randn(10,1)); %! rv = single(randn(1,10)); -%!assert([M*cv,M*cv],M*[cv,cv],5e-7) -%!assert([rv*M;rv*M],[rv;rv]*M,5e-7) -%!assert(2*rv*cv,[rv,rv]*[cv;cv],5e-7) +%!assert([M*cv,M*cv],M*[cv,cv],5e-6) +%!assert([M'*cv,M'*cv],M'*[cv,cv],5e-6) +%!assert([rv*M;rv*M],[rv;rv]*M,5e-6) +%!assert([rv*M';rv*M'],[rv;rv]*M',5e-6) +%!assert(2*rv*cv,[rv,rv]*[cv;cv],5e-6) */ static const char *