473,388 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

weird bug w/ a template program

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???

Aug 20 '05 #1
1 1179
bl**********@gmail.com wrote:
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???


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

V
Aug 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Saki Arkoudopoulos | last post by:
Hi, I keep getting this weird error when trying to compile a program: CMainWindowDer.o(.text+0x3666): In function `CMainWindowDer::OpenProjectOpties()':...
3
by: modemer | last post by:
Hello, I got weird compiling message similar like following when I compiled my simple code on Sun 5.8 with CC WorkShop 6 update 2 C++ 5.3. CC -g -o myclass.o -c myclass.cpp CC -g -o main.o...
6
by: RainBow | last post by:
Greetings!! I introduced the so-called "thin-template" pattern for controlling the code bloat caused due to template usage. However, one of the functions in the template happens to be virtual...
2
by: alice | last post by:
Hi, When I compiles the following program with g++, it gives the following output: # g++ -o list list.C list.C: In function `int main()': list.C:116: jump to case label list.C:110: crosses...
2
by: Hendrik Schober | last post by:
Hi, I have some expression template code that I want to get to work. I had a typo in it and just spent two hours to find it, because VC7.1 gave a really weird error message for it. This is the...
2
by: keepyourstupidspam | last post by:
Hi, I have a strange build problem. I am building an exe, this exe links to a number of static libraries maybe 20 in all and all are built from my code. I am using the gmake build system...
8
by: nickyeng | last post by:
I have written 3 files, i dont know whether i do it correctly or wrongly but somehow it compiled well and can run. My simple aim is to display the terrain.txt file into the terrain array, and then...
5
by: Lars Hillebrand | last post by:
Hello, i discovered a weird behaviour if i use templates together with virtual inheritance and method over. I managed to reproduce my problem with a small example: // *********** <code...
2
by: TamaThps | last post by:
Hi, I'm using visual studio 2008 and normally when I get an error it shows what line it is on and which file etc. The error I'm getting I don't know how to solve or even what the problem is. This...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.