Mercurial > hg > octave-lyh
changeset 12064:8e8da2c36e7e release-3-2-x
make single prec. matrix mutliply tests really single
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sun, 23 Aug 2009 11:11:27 +0200 |
parents | 4c7b51b2541d |
children | 899122410ea5 |
files | liboctave/ChangeLog liboctave/fCMatrix.cc liboctave/fMatrix.cc |
diffstat | 3 files changed, 20 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2009-08-16 Jaroslav Hajek <highegg@gmail.com> + + * fMatrix.cc, fCMatrix.cc: Make tests use single precision. + 2009-08-16 Jaroslav Hajek <highegg@gmail.com> * CMatrix.cc (xgemm): Fix typo. Add test.
--- a/liboctave/fCMatrix.cc +++ b/liboctave/fCMatrix.cc @@ -3736,10 +3736,10 @@ } /* 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) -%!assert([1 i]*[i 0]', -i); +%!assert(single([1+i 2+i 3+i]) * single([ 4+i ; 5+i ; 6+i]), single(29+21i), 5e-7) +%!assert(single([1+i 2+i ; 3+i 4+i ]) * single([5+i ; 6+i]), single([15 + 14i ; 37 + 18i]), 5e-7) +%!assert(single([1+i 2+i ; 3+i 4+i ]) * single([5+i 6+i ; 7+i 8+i]), single([17 + 15i 20 + 17i; 41 + 19i 48 + 21i]), 5e-7) +%!assert(single([1 i])*single([i 0])', single(-i)); */ /* Test some simple identities @@ -3747,9 +3747,9 @@ %! 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) +%!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) */ static const char *
--- a/liboctave/fMatrix.cc +++ b/liboctave/fMatrix.cc @@ -3147,19 +3147,19 @@ // 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) +%!assert(single([1 2 3]) * single([ 4 ; 5 ; 6]), single(32), 5e-7) +%!assert(single([1 2 ; 3 4 ]) * single([5 ; 6]), single([17 ; 39 ]), 5e-7) +%!assert(single([1 2 ; 3 4 ]) * single([5 6 ; 7 8]), single([19 22; 43 50]), 5e-7) */ /* 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) +%! 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) */ static const char *