Mercurial > hg > octave-nkf
comparison liboctave/fMatrix.cc @ 9527:6a9fd5f653c9
make single prec. matrix mutliply tests really single
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sun, 16 Aug 2009 07:04:40 +0200 |
parents | 0ce82753dd72 |
children | ec066ba012c8 |
comparison
equal
deleted
inserted
replaced
9526:f3ebc728ffd7 | 9527:6a9fd5f653c9 |
---|---|
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 { |