From: Stéphane on 9 Apr 2010 14:06 "Stéphane " <jalisastef(a)yahoo.ca> wrote in message <hpnpph$6ii$1(a)fred.mathworks.com>... > "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hpnorh$idd$1(a)fred.mathworks.com>... > > "Stéphane " <jalisastef(a)yahoo.ca> wrote in message <hpnmqc$gu7$1(a)fred.mathworks.com>... > > > Hello, > > > Matlab's algorithm compensates this rounding error amplification. > > > > Not that I'm aware of (in the strict sense). However Matlab uses BLAS for full matrix product, and there is one thing you should pay attention is the so called "floating point control word" (FPCW) that control the precision on the internal computation inside the (Intel) processor. There is an compilation option on MSVC to allow to switch the FPCW between two states, otherwise you can control finer within the program. I believe Matlab by default uses 53-bit internal calculation. You should at least use as much. > > > > Bruno > > Hello Bruno, > > you're right about the 53 bits... it is the same for MSVC however, the double format has a 53 bits mantissa. > Thank for the clue about MSVC, I changed the precision from precise to strict in the floating point optimization option. I will let you know about it, tests are under process right now. > > Stéphane Hello James, I am not asking for code, all I want to know is if matlab's algorithm compensates rounding errors amplifications or not. I could not find any clue about it on the web. Thanks for the answer though. :) Stéphane
From: Stéphane on 9 Apr 2010 14:12 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hpnpta$8ca$1(a)fred.mathworks.com>... > "Stéphane " <jalisastef(a)yahoo.ca> wrote in message <hpnmqc$gu7$1(a)fred.mathworks.com>... > > > > I am currently working on my own implementation in C++ of Strassen's fast matrix multiplication algorithm. > > Everything works fine, except for big matrices full of big float numbers. Neither my new algorithm nor the former (O(n^3)) can stand the comparison with the matlab's result, the delta is just way too big for every and each element. > > Can you provide a short code sample that generates the matrices that are giving you problems? > > James Tursa Here is the matlab code: temp1 = rand(2000, 2000); temp2 = rand(2000, 2000); A = 25000 * temp1; B = 25000 * temp2; C = A * B; fichier = fopen('A.txt', 'w+'); fprintf(fichier, '%16f;', A); fclose(fichier); fichier = fopen('B.txt', 'w+'); fprintf(fichier, '%16f;', B); fclose(fichier); fichier = fopen('C.txt', 'w+'); fprintf(fichier, '%16f;', C); fclose(fichier); Then, I launch my program on these matrices: A and B to perform the multiplication, which is then compared to result C. Stéphane
From: Bruno Luong on 9 Apr 2010 14:17 "Stéphane " <jalisastef(a)yahoo.ca> wrote in message <hpnqad$ebj$1(a)fred.mathworks.com>... > > > > > you're right about the 53 bits... it is the same for MSVC however, the double format has a 53 bits mantissa. Sthéphane, To avoid any confusion, the FPCW is an independent control on top of the size of the mantissa of the floating points. It controls how the processor perform internally the round off when operating on the floating point. For example, you could force the internal calculation to be 64-bits on 53-bit-mantissa numbers. Bruno
From: Bruno Luong on 9 Apr 2010 14:23 Take a look at this link if you are not familiar with the FPCW: http://msdn.microsoft.com/en-us/library/aa289157%28VS.71%29.aspx Bruno
From: Stéphane on 9 Apr 2010 14:40 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hpnra9$s8r$1(a)fred.mathworks.com>... > Take a look at this link if you are not familiar with the FPCW: > > http://msdn.microsoft.com/en-us/library/aa289157%28VS.71%29.aspx > > Bruno Yes I was on this page, that's why I told you about fp:fast, fp:strict and fp:precise (strict and precise :) ) in a previous message :) No change though... :( thank you, Stéphane
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: using mex/fftw for "xcorr", faster than 2010A "xcorr" Next: Fitting ellipses with dispersion |