comparison liboctave/fMatrix.cc @ 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 a9d20c890190
children 899122410ea5
comparison
equal deleted inserted replaced
12063:4c7b51b2541d 12064:8e8da2c36e7e
3145 } 3145 }
3146 3146
3147 // matrix by matrix -> matrix operations 3147 // matrix by matrix -> matrix operations
3148 3148
3149 /* Simple Dot Product, Matrix-Vector and Matrix-Matrix Unit tests 3149 /* Simple Dot Product, Matrix-Vector and Matrix-Matrix Unit tests
3150 %!assert([1 2 3] * [ 4 ; 5 ; 6], 32, 1e-14) 3150 %!assert(single([1 2 3]) * single([ 4 ; 5 ; 6]), single(32), 5e-7)
3151 %!assert([1 2 ; 3 4 ] * [5 ; 6], [17 ; 39 ], 1e-14) 3151 %!assert(single([1 2 ; 3 4 ]) * single([5 ; 6]), single([17 ; 39 ]), 5e-7)
3152 %!assert([1 2 ; 3 4 ] * [5 6 ; 7 8], [19 22; 43 50], 1e-14) 3152 %!assert(single([1 2 ; 3 4 ]) * single([5 6 ; 7 8]), single([19 22; 43 50]), 5e-7)
3153 */ 3153 */
3154 3154
3155 /* Test some simple identities 3155 /* Test some simple identities
3156 %!shared M, cv, rv 3156 %!shared M, cv, rv
3157 %! M = randn(10,10); 3157 %! M = single(randn(10,10));
3158 %! cv = randn(10,1); 3158 %! cv = single(randn(10,1));
3159 %! rv = randn(1,10); 3159 %! rv = single(randn(1,10));
3160 %!assert([M*cv,M*cv],M*[cv,cv],1e-14) 3160 %!assert([M*cv,M*cv],M*[cv,cv],5e-7)
3161 %!assert([rv*M;rv*M],[rv;rv]*M,1e-14) 3161 %!assert([rv*M;rv*M],[rv;rv]*M,5e-7)
3162 %!assert(2*rv*cv,[rv,rv]*[cv;cv],1e-14) 3162 %!assert(2*rv*cv,[rv,rv]*[cv;cv],5e-7)
3163 */ 3163 */
3164 3164
3165 static const char * 3165 static const char *
3166 get_blas_trans_arg (bool trans) 3166 get_blas_trans_arg (bool trans)
3167 { 3167 {