Connecting Tech Pros Worldwide Help | Site Map

weird bug w/ a template program

  #1  
Old August 20th, 2005, 01:55 AM
bluekite2000@gmail.com
Guest
 
Posts: n/a
I have 2 matrices Qex,R of type float which are returned from a
function (qr decomposition). I then do


Float_Matrix M=Qex*R; //wrong result

Float_Matrix Qex_copy(Qex);//copy constructor
Float_Matrix R_copy(R);//copy constructor

Float_Matrix Mcopy=Qex_copy*R_copy;//correct result

For some reason M is incorrect!

I do a cout<<Qex<<R; and cout<<Qex_copy<<R_copy;
to visually compare Qex with Qex_copy and R with R_copy and they are
equal!!!
However I think they are not really equal but cant figure out where.

I tried running the same program with type complex (Complex_Matrix) and
everything works fine.

Any idea? Can it be a misalignment issue???

  #2  
Old August 20th, 2005, 02:15 AM
Victor Bazarov
Guest
 
Posts: n/a

re: weird bug w/ a template program


bluekite2000@gmail.com wrote:[color=blue]
> I have 2 matrices Qex,R of type float which are returned from a
> function (qr decomposition). I then do
>
>
> Float_Matrix M=Qex*R; //wrong result
>
> Float_Matrix Qex_copy(Qex);//copy constructor
> Float_Matrix R_copy(R);//copy constructor
>
> Float_Matrix Mcopy=Qex_copy*R_copy;//correct result
>
> For some reason M is incorrect!
>
> I do a cout<<Qex<<R; and cout<<Qex_copy<<R_copy;
> to visually compare Qex with Qex_copy and R with R_copy and they are
> equal!!!
> However I think they are not really equal but cant figure out where.
>
> I tried running the same program with type complex (Complex_Matrix)
> and everything works fine.
>
> Any idea? Can it be a misalignment issue???[/color]

No idea. But I don't think it's "a misalignment issue". But do
check out FAQ 5.8.

V


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Building a Unicode application. =?Utf-8?B?Q3JhaWcgSm9obnN0b24=?= answers 5 October 19th, 2007 08:55 AM
Template function and const array of chars Milan Cvetkovic answers 5 March 22nd, 2006 10:35 PM
Weird Output alice answers 2 September 29th, 2005 09:25 PM
Need help with template problem. Jason Heyes answers 1 July 22nd, 2005 10:59 AM