# HG changeset patch # User Jaroslav Hajek # Date 1251018687 -7200 # Node ID 8e8da2c36e7e58872ff7c81f8ce5fba3bb13d49a # Parent 4c7b51b2541de738f641b7629ca031dcec3abb29 make single prec. matrix mutliply tests really single diff -r 4c7b51b2541d -r 8e8da2c36e7e liboctave/ChangeLog --- a/liboctave/ChangeLog Sun Aug 23 11:10:35 2009 +0200 +++ b/liboctave/ChangeLog Sun Aug 23 11:11:27 2009 +0200 @@ -1,3 +1,7 @@ +2009-08-16 Jaroslav Hajek + + * fMatrix.cc, fCMatrix.cc: Make tests use single precision. + 2009-08-16 Jaroslav Hajek * CMatrix.cc (xgemm): Fix typo. Add test. diff -r 4c7b51b2541d -r 8e8da2c36e7e liboctave/fCMatrix.cc --- a/liboctave/fCMatrix.cc Sun Aug 23 11:10:35 2009 +0200 +++ b/liboctave/fCMatrix.cc Sun Aug 23 11:11:27 2009 +0200 @@ -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 * diff -r 4c7b51b2541d -r 8e8da2c36e7e liboctave/fMatrix.cc --- a/liboctave/fMatrix.cc Sun Aug 23 11:10:35 2009 +0200 +++ b/liboctave/fMatrix.cc Sun Aug 23 11:11:27 2009 +0200 @@ -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 *