<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453</link>
    <title>MATLAB Central Newsreader - Ill conditioned matrix makes linsolve crash</title>
    <description>Feed for thread: Ill conditioned matrix makes linsolve crash</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 29 Oct 2009 13:18:03 -0400</pubDate>
      <title>Ill conditioned matrix makes linsolve crash</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453#690643</link>
      <author>Sebastiaan </author>
      <description>Dear users,&lt;br&gt;
&lt;br&gt;
I am trying to solve a very ill conditioned system with linsolve, but it makes Matlab hang. &lt;br&gt;
&lt;br&gt;
The matrix A is symmetric and ill-conditioned:&lt;br&gt;
&amp;gt;&amp;gt; rcond(A)&lt;br&gt;
ans =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;5.7435e-21&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; max(max(abs(triu(A)-tril(A)')))&lt;br&gt;
ans =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&lt;br&gt;
&lt;br&gt;
I try to solve this using linsolve (with SYM=false it works):&lt;br&gt;
linsolvopts = &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SYM: 1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;POSDEF: 0&lt;br&gt;
&lt;br&gt;
Executing:&lt;br&gt;
&amp;gt;&amp;gt; [x, rcond] = linsolve(A, b, linsolvopts);&lt;br&gt;
&lt;br&gt;
makes Maltab unresponsive. Apparently, the LAPACK subroutine dsysv (which is the one used I think) crashes.&lt;br&gt;
&lt;br&gt;
I know I should not try to solve these kind of ill-conditioned matrices, but I use rcond result from linsolve to check if the result may make sense. However, I do not believe dsysv is supposed to crash.&lt;br&gt;
&lt;br&gt;
I have tried it with 2009a/b x86_64 on Linux and on another machine with 2009a x68_32, Windows XP, all crash.&lt;br&gt;
&lt;br&gt;
The matrix and vector can be downloaded here. It is a moderate 96x96 sized problem (76kiB):&lt;br&gt;
&lt;a href=&quot;http://www.xs4all.nl/~pukenmul/downloads/ProblemMat.mat&quot;&gt;http://www.xs4all.nl/~pukenmul/downloads/ProblemMat.mat&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Thanks!&lt;br&gt;
Sebastiaan</description>
    </item>
    <item>
      <pubDate>Fri, 30 Oct 2009 01:13:47 -0400</pubDate>
      <title>Re: Ill conditioned matrix makes linsolve crash</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453#690862</link>
      <author>Bobby Cheng</author>
      <description>&lt;a href=&quot;http://www.mathworks.com/support/bugreports/search_results?search_executed=1&amp;keyword=573283&amp;release_filter=Exists+in&amp;release=168&amp;selected_products=&amp;commit=Search&quot;&gt;http://www.mathworks.com/support/bugreports/search_results?search_executed=1&amp;keyword=573283&amp;release_filter=Exists+in&amp;release=168&amp;selected_products=&amp;commit=Search&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
See bug report 573283.&lt;br&gt;
&lt;br&gt;
&quot;Sebastiaan &quot; &amp;lt;s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl&amp;gt; wrote in message &lt;br&gt;
news:hcc4ma$rso$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; Dear users,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am trying to solve a very ill conditioned system with linsolve, but it &lt;br&gt;
&amp;gt; makes Matlab hang.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; The matrix A is symmetric and ill-conditioned:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; rcond(A)&lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt;   5.7435e-21&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; max(max(abs(triu(A)-tril(A)')))&lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt;     0&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I try to solve this using linsolve (with SYM=false it works):&lt;br&gt;
&amp;gt; linsolvopts =&lt;br&gt;
&amp;gt;       SYM: 1&lt;br&gt;
&amp;gt;    POSDEF: 0&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Executing:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; [x, rcond] = linsolve(A, b, linsolvopts);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; makes Maltab unresponsive. Apparently, the LAPACK subroutine dsysv (which &lt;br&gt;
&amp;gt; is the one used I think) crashes.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I know I should not try to solve these kind of ill-conditioned matrices, &lt;br&gt;
&amp;gt; but I use rcond result from linsolve to check if the result may make &lt;br&gt;
&amp;gt; sense. However, I do not believe dsysv is supposed to crash.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I have tried it with 2009a/b x86_64 on Linux and on another machine with &lt;br&gt;
&amp;gt; 2009a x68_32, Windows XP, all crash.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; The matrix and vector can be downloaded here. It is a moderate 96x96 sized &lt;br&gt;
&amp;gt; problem (76kiB):&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.xs4all.nl/~pukenmul/downloads/ProblemMat.mat&quot;&gt;http://www.xs4all.nl/~pukenmul/downloads/ProblemMat.mat&lt;/a&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks!&lt;br&gt;
&amp;gt; Sebastiaan&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Fri, 30 Oct 2009 09:28:02 -0400</pubDate>
      <title>Re: Ill conditioned matrix makes linsolve crash</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453#690909</link>
      <author>Sebastiaan </author>
      <description>&quot;Bobby Cheng&quot; &amp;lt;bcheng@mathworks.com&amp;gt; wrote in message &amp;lt;hcdekc$bdc$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.mathworks.com/support/bugreports/search_results?search_executed=1&amp;keyword=573283&amp;release_filter=Exists+in&amp;release=168&amp;selected_products=&amp;commit=Search&quot;&gt;http://www.mathworks.com/support/bugreports/search_results?search_executed=1&amp;keyword=573283&amp;release_filter=Exists+in&amp;release=168&amp;selected_products=&amp;commit=Search&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; See bug report 573283.&lt;br&gt;
&amp;gt; &lt;br&gt;
Wow, thank you!&lt;br&gt;
&lt;br&gt;
Is it possible to reply or ammend to a bug report? (I can only give quality feedback...)&lt;br&gt;
&lt;br&gt;
The bugreport tells me:&lt;br&gt;
----&lt;br&gt;
The functions ldl and inv may hang MATLAB when the input matrix meets all of the following criteria:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Hermitian&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* ill-conditioned&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* full&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* the eigenvalues cluster around zero.&lt;br&gt;
---&lt;br&gt;
It hangs with ldl and inv too, but the last criterion is not met. A few (5) eigenvalues are in the order of 1, 33 in the order of 100 and 32 are &amp;gt;1e6.&lt;br&gt;
&lt;br&gt;
Do I have to file a new bug report?&lt;br&gt;
&lt;br&gt;
Sebastiaan</description>
    </item>
    <item>
      <pubDate>Fri, 30 Oct 2009 17:43:18 -0400</pubDate>
      <title>Re: Ill conditioned matrix makes linsolve crash</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453#691027</link>
      <author>Bobby Cheng</author>
      <description>I have not done this myself as I can change this from the inside. :)&lt;br&gt;
&lt;br&gt;
But I think you can track the report update and comment of the content. &lt;br&gt;
Again, I have not tried any on this.&lt;br&gt;
&lt;br&gt;
I can assure you that it is the same issue in the bug report. I am &lt;br&gt;
investigating the issue and have added your matrix into our tests. So thank &lt;br&gt;
you for the test case.&lt;br&gt;
&lt;br&gt;
---Bob.&lt;br&gt;
&lt;br&gt;
&quot;Sebastiaan &quot; &amp;lt;s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl&amp;gt; wrote in message &lt;br&gt;
news:hcebj2$7o5$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &quot;Bobby Cheng&quot; &amp;lt;bcheng@mathworks.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;hcdekc$bdc$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; &lt;a href=&quot;http://www.mathworks.com/support/bugreports/search_results?search_executed=1&amp;keyword=573283&amp;release_filter=Exists+in&amp;release=168&amp;selected_products=&amp;commit=Search&quot;&gt;http://www.mathworks.com/support/bugreports/search_results?search_executed=1&amp;keyword=573283&amp;release_filter=Exists+in&amp;release=168&amp;selected_products=&amp;commit=Search&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; See bug report 573283.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; Wow, thank you!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is it possible to reply or ammend to a bug report? (I can only give &lt;br&gt;
&amp;gt; quality feedback...)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; The bugreport tells me:&lt;br&gt;
&amp;gt; ----&lt;br&gt;
&amp;gt; The functions ldl and inv may hang MATLAB when the input matrix meets all &lt;br&gt;
&amp;gt; of the following criteria:&lt;br&gt;
&amp;gt;    * Hermitian&lt;br&gt;
&amp;gt;    * ill-conditioned&lt;br&gt;
&amp;gt;    * full&lt;br&gt;
&amp;gt;    * the eigenvalues cluster around zero.&lt;br&gt;
&amp;gt; ---&lt;br&gt;
&amp;gt; It hangs with ldl and inv too, but the last criterion is not met. A few &lt;br&gt;
&amp;gt; (5) eigenvalues are in the order of 1, 33 in the order of 100 and 32 are &lt;br&gt;
&amp;gt;  &amp;gt;1e6.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Do I have to file a new bug report?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Sebastiaan&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Fri, 30 Oct 2009 19:00:07 -0400</pubDate>
      <title>Re: Ill conditioned matrix makes linsolve crash</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453#691055</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Bobby Cheng&quot; &amp;lt;bcheng@mathworks.com&amp;gt; wrote in message &lt;br&gt;
news:hcf8jm$9u5$1@fred.mathworks.com...&lt;br&gt;
&amp;gt;I have not done this myself as I can change this from the inside. :)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; But I think you can track the report update and comment of the content. &lt;br&gt;
&amp;gt; Again, I have not tried any on this.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I can assure you that it is the same issue in the bug report. I am &lt;br&gt;
&amp;gt; investigating the issue and have added your matrix into our tests. So &lt;br&gt;
&amp;gt; thank you for the test case.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ---Bob.&lt;br&gt;
&lt;br&gt;
Sebastiaan,&lt;br&gt;
&lt;br&gt;
In general, if you're looking to respond or amend the content in the bug &lt;br&gt;
report (not feedback on the quality of the bug report) you should contact &lt;br&gt;
Technical Support and reference the bug report number.  So for this one, you &lt;br&gt;
could have sent a message to support saying something like &quot;I read bug &lt;br&gt;
report 573283, and I think I have a similar problem but it's not exactly the &lt;br&gt;
same.  Here's my data ...&quot;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com&lt;br&gt;
comp.soft-sys.matlab (CSSM) FAQ: &lt;a href=&quot;http://matlabwiki.mathworks.com/MATLAB_FAQ&quot;&gt;http://matlabwiki.mathworks.com/MATLAB_FAQ&lt;/a&gt; </description>
    </item>
    <item>
      <pubDate>Mon, 02 Nov 2009 09:00:04 -0500</pubDate>
      <title>Re: Ill conditioned matrix makes linsolve crash</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453#691420</link>
      <author>Sebastiaan </author>
      <description>I am glad to be of some help :)&lt;br&gt;
&lt;br&gt;
This bug reminds me of something that happend in 2008a. I think it is this bug as well, but it depended on the runtime of the Matlab session.&lt;br&gt;
&lt;br&gt;
My work involves mathematical optimization, in which linear systems are solved hundreds of times for 1 problem. The problem was that in a long batch (~1 day) for solving many problems, Matlab crashed somewhere. However, if I restarted that single problem, Matlab did not crash.&lt;br&gt;
&lt;br&gt;
So the bug was reproducable for the long run, on different systems (and maybe I have even tried 2007b). However, the matrix which made Matlab crash, did not crash a fresh session.&lt;br&gt;
&lt;br&gt;
I fixed it by checking if the reciprocal condition is sufficient prior to solving the system.&lt;br&gt;
&lt;br&gt;
Sebastiaan&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Bobby Cheng&quot; &amp;lt;bcheng@mathworks.com&amp;gt; wrote in message &amp;lt;hcf8jm$9u5$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have not done this myself as I can change this from the inside. :)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But I think you can track the report update and comment of the content. &lt;br&gt;
&amp;gt; Again, I have not tried any on this.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can assure you that it is the same issue in the bug report. I am &lt;br&gt;
&amp;gt; investigating the issue and have added your matrix into our tests. So thank &lt;br&gt;
&amp;gt; you for the test case.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ---Bob.&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Mon, 02 Nov 2009 12:15:30 -0500</pubDate>
      <title>Re: Ill conditioned matrix makes linsolve crash</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453#691465</link>
      <author>Greg Heath</author>
      <description>On Nov 2, 5:00&#160;am, &quot;Sebastiaan &quot;&lt;br&gt;
&amp;lt;s.breedv...@erasmusmc.REMOVE.BOO.BOO.nl&amp;gt; wrote:&lt;br&gt;
&amp;gt; I am glad to be of some help :)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This bug reminds me of something that happend in 2008a. I think it is this bug as well, but it depended on the runtime of the Matlab session.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; My work involves mathematical optimization, in which linear systems are solved hundreds of times for 1 problem. The problem was that in a long batch (~1 day) for solving many problems, Matlab crashed somewhere. However, if I restarted that single problem, Matlab did not crash.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So the bug was reproducable for the long run, on different systems (and maybe I have even tried 2007b). However, the matrix which made Matlab crash, did not crash a fresh session.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I fixed it by checking if the reciprocal condition is sufficient prior to solving the system.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Sebastiaan&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &quot;Bobby Cheng&quot; &amp;lt;bch...@mathworks.com&amp;gt; wrote in message &amp;lt;hcf8jm$9u...@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I have not done this myself as I can change this from the inside. :)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; But I think you can track the report update and comment of the content.&lt;br&gt;
&amp;gt; &amp;gt; Again, I have not tried any on this.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I can assure you that it is the same issue in the bug report. I am&lt;br&gt;
&amp;gt; &amp;gt; investigating the issue and have added your matrix into our tests. So thank&lt;br&gt;
&amp;gt; &amp;gt; you for the test case.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ---Bob&lt;br&gt;
&lt;br&gt;
Why not try rcond, backslash and pinv ?&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 09:40:06 -0500</pubDate>
      <title>Re: Ill conditioned matrix makes linsolve crash</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264453#691662</link>
      <author>Sebastiaan </author>
      <description>Greg Heath &amp;lt;heath@alumni.brown.edu&amp;gt; wrote in message &amp;lt;4ca2c11d-c63e-40b8-a04f-58330c624c65@h2g2000vbd.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Nov 2, 5:00?am, &quot;Sebastiaan &quot;&lt;br&gt;
&amp;gt; &amp;lt;s.breedv...@erasmusmc.REMOVE.BOO.BOO.nl&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; I am glad to be of some help :)&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; This bug reminds me of something that happend in 2008a. I think it is this bug as well, but it depended on the runtime of the Matlab session.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; My work involves mathematical optimization, in which linear systems are solved hundreds of times for 1 problem. The problem was that in a long batch (~1 day) for solving many problems, Matlab crashed somewhere. However, if I restarted that single problem, Matlab did not crash.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; So the bug was reproducable for the long run, on different systems (and maybe I have even tried 2007b). However, the matrix which made Matlab crash, did not crash a fresh session.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I fixed it by checking if the reciprocal condition is sufficient prior to solving the system.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Sebastiaan&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &quot;Bobby Cheng&quot; &amp;lt;bch...@mathworks.com&amp;gt; wrote in message &amp;lt;hcf8jm$9u...@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I have not done this myself as I can change this from the inside. :)&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; But I think you can track the report update and comment of the content.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Again, I have not tried any on this.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I can assure you that it is the same issue in the bug report. I am&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; investigating the issue and have added your matrix into our tests. So thank&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; you for the test case.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ---Bob&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why not try rcond, backslash and pinv ?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Greg&lt;br&gt;
&lt;br&gt;
Interesting suggestion, I was unaware of the pseudoinverse method. I will have a look at it.&lt;br&gt;
&lt;br&gt;
Thank you!&lt;br&gt;
Sebastiaan</description>
    </item>
  </channel>
</rss>

