Correction of My Post " inv() crash"

yaoyansi <[email protected]> Fri, 5 Mar 2010 14:27:28 +0800 (CST)
Newsgroups gmane.comp.lib.mtl.devel
Message-ID <[email protected]>
--===============0629920871==
Content-Type: multipart/alternative; boundary="0-133169938-1267770448=:56900"

--0-133169938-1267770448=:56900
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

HI, all
I have to make a correction of my post "MTL: inv() crash".
The original words:
Then, I yeild tM0 from  transP*P, then inv(tM0) crashes.
=0ABut when I assign tM0 with const number array, the inv(tM0) works fine.

should be changed to:
Then, I yeild tM0 from  transP*P, then inv(tM0) crashes.
But when I assign tM0 with const number array, the inv(tM0) works fine(in R=
elease mode only).=20


And here is final text.
hi, all
I am not sure whether it is a bug, but it seems very strange.
Here is the detail.

typedef dense2D<double> Matrix;
=A0=A0=A0 Matrix transP(trans(P));
=0A=A0=A0=A0 Matrix tM0(num_rows(transP), num_cols(P) );

Then, I yeild tM0 from  transP*P, then inv(tM0) crashes.
But when I assign tM0 with const number array, the inv(tM0) works fine(in R=
elease mode only). Note that the const number array is exactly the result o=
f   transP*P;
Here is the code:
=0A#ifdef SHOW_ERROR_CASE

=0A=A0=A0=A0 //section 1
=0A=A0=A0=A0 tM0 =3D transP*P;
=0A=A0=A0=A0 std::cout << "tM0:\n" << tM0<< std::endl;
=0A=A0=A0=A0 // you will see this tM0 is exactly as the tM0 in section 2.
=0A=A0=A0=A0 Matrix invM0(inv(tM0));// CRASH!
=0A=A0=A0=A0 std::cout << "invM0:\n" << invM0<< std::endl;=20

=0A#else
=0A
=0A=A0=A0=A0 //section 2
=0A=A0=A0=A0 tM0=3D 1.7e+002,=A0 15,=A0=A0 9,=A0 30,
=0A=A0=A0=A0 =A0=A0=A0 15, 1.8, 1.1, 3.5,
=0A=A0=A0=A0 =A0=A0=A0 9, 1.1, 0.63, 2.1,
=0A=A0=A0=A0 =A0=A0=A0 30, 3.5, 2.1, 7;
=0A=A0=A0=A0 Matrix invM0(inv(tM0));// OK.
=0A=A0=A0=A0 std::cout << "invM0:\n" << invM0<< std::endl;=20
=0A
=0A#endif

=0A
My VC++ project solution is attached.=20
use #define SHOW_ERROR_CASE to show the crash case,=20
or omit #define SHOW_ERROR_CASE, the tM0 will be assigned with const number=
 array, and it works fine.


Cheers
yaoyansi


=0A=0A=0A      
--0-133169938-1267770448=:56900
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;">HI, all<br>I have to make a correction of my =
post "MTL: inv() crash".<br>The original words:<br>Then, I yeild tM0 from  =
transP*P, then inv(tM0) crashes.<br>=0ABut when I assign tM0 with const num=
ber array, the inv(tM0) <span style=3D"background-color: rgb(0, 255, 255);"=
><span style=3D"background-color: rgb(255, 255, 255);">works fine.</span><b=
r><br><span style=3D"background-color: rgb(255, 255, 255);">should be chang=
ed to:</span><br></span>Then, I yeild tM0 from  transP*P, then inv(tM0) cra=
shes.<br>But when I assign tM0 with const number array, the inv(tM0) <span =
style=3D"background-color: rgb(0, 255, 255); text-decoration: underline;">w=
orks fine(</span><span style=3D"color: rgb(255, 0, 127); font-weight: bold;=
 background-color: rgb(0, 255, 255); text-decoration: underline;">in Releas=
e mode only</span><span style=3D"background-color: rgb(0, 255, 255); text-d=
ecoration: underline;">)</span><span style=3D"text-decoration: underline;">=
. </span><br><br><br>And here is final text.<br>hi, all<br>I am not sure wh=
ether it is a bug, but it seems very strange.<br>Here is the detail.<br><br=
><span style=3D"background-color: rgb(162, 162,
 162);">typedef dense2D&lt;double&gt; Matrix;</span><br style=3D"background=
-color: rgb(162, 162, 162);"><span style=3D"background-color: rgb(162, 162,=
 162);">&nbsp;&nbsp;&nbsp; Matrix transP(trans(P));</span><br style=3D"back=
ground-color: rgb(162, 162, 162);"><span style=3D"background-color: rgb(162=
, 162, 162);">=0A&nbsp;&nbsp;&nbsp; Matrix tM0(num_rows(transP), num_cols(P=
) );</span><br><br>Then, I yeild tM0 from  transP*P, then inv(tM0) crashes.=
<br>But when I assign tM0 with const number array, the inv(tM0) <span style=
=3D"background-color: rgb(0, 255, 255);">works fine(</span><span style=3D"c=
olor: rgb(255, 0, 127); font-weight: bold; background-color: rgb(0, 255, 25=
5);">in Release mode only</span><span style=3D"background-color: rgb(0, 255=
, 255);">)</span>. Note that the const number array is exactly the result o=
f   transP*P;<br>Here is the code:<br>=0A<span style=3D"background-color: r=
gb(162, 162, 162);">#ifdef SHOW_ERROR_CASE</span><br><br style=3D"backgroun=
d-color: rgb(162, 162, 162);"><span style=3D"background-color: rgb(162, 162=
, 162);">=0A&nbsp;&nbsp;&nbsp; //section 1</span><br style=3D"background-co=
lor: rgb(162, 162, 162);"><span style=3D"background-color: rgb(162, 162, 16=
2);">=0A&nbsp;&nbsp;&nbsp; tM0 =3D transP*P;</span><br style=3D"background-=
color: rgb(162, 162, 162);"><span style=3D"background-color: rgb(162, 162, =
162);">=0A&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; "tM0:\n" &lt;&lt; tM0&lt;&l=
t; std::endl;</span><br style=3D"background-color: rgb(162, 162, 162);"><sp=
an style=3D"background-color: rgb(162, 162, 162);">=0A&nbsp;&nbsp;&nbsp; //=
 you will see this tM0 is exactly as the tM0 in section 2.</span><br style=
=3D"background-color: rgb(162, 162, 162);"><span style=3D"background-color:=
 rgb(162, 162, 162);">=0A&nbsp;&nbsp;&nbsp; Matrix invM0(inv(tM0));// CRASH=
!</span><br style=3D"background-color: rgb(162, 162, 162);"><span style=3D"=
background-color: rgb(162, 162, 162);">=0A&nbsp;&nbsp;&nbsp; std::cout &lt;=
&lt; "invM0:\n" &lt;&lt; invM0&lt;&lt; std::endl; </span><br><br style=3D"b=
ackground-color: rgb(162, 162, 162);"><span style=3D"background-color: rgb(=
162, 162, 162);">=0A#else</span><br style=3D"background-color: rgb(162, 162=
, 162);">=0A<br style=3D"background-color: rgb(162, 162, 162);"><span style=
=3D"background-color: rgb(162, 162, 162);">=0A&nbsp;&nbsp;&nbsp; //section =
2</span><br style=3D"background-color: rgb(162, 162, 162);"><span style=3D"=
background-color: rgb(162, 162, 162);">=0A&nbsp;&nbsp;&nbsp; tM0=3D 1.7e+00=
2,&nbsp; 15,&nbsp;&nbsp; 9,&nbsp; 30,</span><br style=3D"background-color: =
rgb(162, 162, 162);"><span style=3D"background-color: rgb(162, 162, 162);">=
=0A&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 15, 1.8, 1.1, 3.5,</span><br style=
=3D"background-color: rgb(162, 162, 162);"><span style=3D"background-color:=
 rgb(162, 162, 162);">=0A&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 9, 1.1, 0.63=
, 2.1,</span><br style=3D"background-color: rgb(162, 162, 162);"><span styl=
e=3D"background-color: rgb(162, 162, 162);">=0A&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp; 30, 3.5, 2.1, 7;</span><br style=3D"background-color: rgb(162, 16=
2, 162);"><span style=3D"background-color: rgb(162, 162, 162);">=0A&nbsp;&n=
bsp;&nbsp; Matrix invM0(inv(tM0));// OK.</span><br style=3D"background-colo=
r: rgb(162, 162, 162);"><span style=3D"background-color: rgb(162, 162, 162)=
;">=0A&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; "invM0:\n" &lt;&lt; invM0&lt;&l=
t; std::endl; </span><br style=3D"background-color: rgb(162, 162, 162);">=
=0A<br style=3D"background-color: rgb(162, 162, 162);"><span style=3D"backg=
round-color: rgb(162, 162, 162);">=0A#endif</span><br><br>=0A<br>My VC++ pr=
oject solution is attached. <br>use #define SHOW_ERROR_CASE to show the cra=
sh case, <br>or omit #define SHOW_ERROR_CASE, the tM0 will be assigned with=
 const number array, and it works fine.<br><br><br>Cheers<br>yaoyansi<br><d=
iv class=3D"plainMail"><a href=3D"http://www.osl.iu.edu/MailArchives/mtl-de=
vel/" target=3D"_blank"><br></a></div><br></td></tr></table><br>=0A=0A=0A=
=0A      &nbsp;
--0-133169938-1267770448=:56900--

--===============0629920871==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
--===============0629920871==--