Connecting Tech Pros Worldwide Forums | Help | Site Map

weird bug w/ a template program

bluekite2000@gmail.com
Guest
 
Posts: n/a
#1: Aug 20 '05
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???


Victor Bazarov
Guest
 
Posts: n/a
#2: Aug 20 '05

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