Thread Subject: Ill conditioned matrix makes linsolve crash

Subject: Ill conditioned matrix makes linsolve crash

From: Sebastiaan

Date: 29 Oct, 2009 13:18:03

Message: 1 of 8

Dear users,

I am trying to solve a very ill conditioned system with linsolve, but it makes Matlab hang.

The matrix A is symmetric and ill-conditioned:
>> rcond(A)
ans =
   5.7435e-21

>> max(max(abs(triu(A)-tril(A)')))
ans =
     0

I try to solve this using linsolve (with SYM=false it works):
linsolvopts =
       SYM: 1
    POSDEF: 0

Executing:
>> [x, rcond] = linsolve(A, b, linsolvopts);

makes Maltab unresponsive. Apparently, the LAPACK subroutine dsysv (which is the one used I think) crashes.

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.

I have tried it with 2009a/b x86_64 on Linux and on another machine with 2009a x68_32, Windows XP, all crash.

The matrix and vector can be downloaded here. It is a moderate 96x96 sized problem (76kiB):
http://www.xs4all.nl/~pukenmul/downloads/ProblemMat.mat

Thanks!
Sebastiaan

Subject: Ill conditioned matrix makes linsolve crash

From: Bobby Cheng

Date: 30 Oct, 2009 01:13:47

Message: 2 of 8

http://www.mathworks.com/support/bugreports/search_results?search_executed=1&keyword=573283&release_filter=Exists+in&release=168&selected_products=&commit=Search

See bug report 573283.

"Sebastiaan " <s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl> wrote in message
news:hcc4ma$rso$1@fred.mathworks.com...
> Dear users,
>
> I am trying to solve a very ill conditioned system with linsolve, but it
> makes Matlab hang.
>
> The matrix A is symmetric and ill-conditioned:
>>> rcond(A)
> ans =
> 5.7435e-21
>
>>> max(max(abs(triu(A)-tril(A)')))
> ans =
> 0
>
> I try to solve this using linsolve (with SYM=false it works):
> linsolvopts =
> SYM: 1
> POSDEF: 0
>
> Executing:
>>> [x, rcond] = linsolve(A, b, linsolvopts);
>
> makes Maltab unresponsive. Apparently, the LAPACK subroutine dsysv (which
> is the one used I think) crashes.
>
> 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.
>
> I have tried it with 2009a/b x86_64 on Linux and on another machine with
> 2009a x68_32, Windows XP, all crash.
>
> The matrix and vector can be downloaded here. It is a moderate 96x96 sized
> problem (76kiB):
> http://www.xs4all.nl/~pukenmul/downloads/ProblemMat.mat
>
> Thanks!
> Sebastiaan
>

Subject: Ill conditioned matrix makes linsolve crash

From: Sebastiaan

Date: 30 Oct, 2009 09:28:02

Message: 3 of 8

"Bobby Cheng" <bcheng@mathworks.com> wrote in message <hcdekc$bdc$1@fred.mathworks.com>...
> http://www.mathworks.com/support/bugreports/search_results?search_executed=1&keyword=573283&release_filter=Exists+in&release=168&selected_products=&commit=Search
>
> See bug report 573283.
>
Wow, thank you!

Is it possible to reply or ammend to a bug report? (I can only give quality feedback...)

The bugreport tells me:
----
The functions ldl and inv may hang MATLAB when the input matrix meets all of the following criteria:
    * Hermitian
    * ill-conditioned
    * full
    * the eigenvalues cluster around zero.
---
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 >1e6.

Do I have to file a new bug report?

Sebastiaan

Subject: Ill conditioned matrix makes linsolve crash

From: Bobby Cheng

Date: 30 Oct, 2009 17:43:18

Message: 4 of 8

I have not done this myself as I can change this from the inside. :)

But I think you can track the report update and comment of the content.
Again, I have not tried any on this.

I can assure you that it is the same issue in the bug report. I am
investigating the issue and have added your matrix into our tests. So thank
you for the test case.

---Bob.

"Sebastiaan " <s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl> wrote in message
news:hcebj2$7o5$1@fred.mathworks.com...
> "Bobby Cheng" <bcheng@mathworks.com> wrote in message
> <hcdekc$bdc$1@fred.mathworks.com>...
>> http://www.mathworks.com/support/bugreports/search_results?search_executed=1&keyword=573283&release_filter=Exists+in&release=168&selected_products=&commit=Search
>>
>> See bug report 573283.
>>
> Wow, thank you!
>
> Is it possible to reply or ammend to a bug report? (I can only give
> quality feedback...)
>
> The bugreport tells me:
> ----
> The functions ldl and inv may hang MATLAB when the input matrix meets all
> of the following criteria:
> * Hermitian
> * ill-conditioned
> * full
> * the eigenvalues cluster around zero.
> ---
> 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
> >1e6.
>
> Do I have to file a new bug report?
>
> Sebastiaan
>

Subject: Ill conditioned matrix makes linsolve crash

From: Steven Lord

Date: 30 Oct, 2009 19:00:07

Message: 5 of 8


"Bobby Cheng" <bcheng@mathworks.com> wrote in message
news:hcf8jm$9u5$1@fred.mathworks.com...
>I have not done this myself as I can change this from the inside. :)
>
> But I think you can track the report update and comment of the content.
> Again, I have not tried any on this.
>
> I can assure you that it is the same issue in the bug report. I am
> investigating the issue and have added your matrix into our tests. So
> thank you for the test case.
>
> ---Bob.

Sebastiaan,

In general, if you're looking to respond or amend the content in the bug
report (not feedback on the quality of the bug report) you should contact
Technical Support and reference the bug report number. So for this one, you
could have sent a message to support saying something like "I read bug
report 573283, and I think I have a similar problem but it's not exactly the
same. Here's my data ..."

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Ill conditioned matrix makes linsolve crash

From: Sebastiaan

Date: 2 Nov, 2009 09:00:04

Message: 6 of 8

I am glad to be of some help :)

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.

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.

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.

I fixed it by checking if the reciprocal condition is sufficient prior to solving the system.

Sebastiaan


"Bobby Cheng" <bcheng@mathworks.com> wrote in message <hcf8jm$9u5$1@fred.mathworks.com>...
> I have not done this myself as I can change this from the inside. :)
>
> But I think you can track the report update and comment of the content.
> Again, I have not tried any on this.
>
> I can assure you that it is the same issue in the bug report. I am
> investigating the issue and have added your matrix into our tests. So thank
> you for the test case.
>
> ---Bob.
>

Subject: Ill conditioned matrix makes linsolve crash

From: Greg Heath

Date: 2 Nov, 2009 12:15:30

Message: 7 of 8

On Nov 2, 5:00 am, "Sebastiaan "
<s.breedv...@erasmusmc.REMOVE.BOO.BOO.nl> wrote:
> I am glad to be of some help :)
>
> 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.
>
> 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.
>
> 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.
>
> I fixed it by checking if the reciprocal condition is sufficient prior to solving the system.
>
> Sebastiaan
>
>
>
> "Bobby Cheng" <bch...@mathworks.com> wrote in message <hcf8jm$9u...@fred.mathworks.com>...
> > I have not done this myself as I can change this from the inside. :)
>
> > But I think you can track the report update and comment of the content.
> > Again, I have not tried any on this.
>
> > I can assure you that it is the same issue in the bug report. I am
> > investigating the issue and have added your matrix into our tests. So thank
> > you for the test case.
>
> > ---Bob

Why not try rcond, backslash and pinv ?

Greg

Subject: Ill conditioned matrix makes linsolve crash

From: Sebastiaan

Date: 3 Nov, 2009 09:40:06

Message: 8 of 8

Greg Heath <heath@alumni.brown.edu> wrote in message <4ca2c11d-c63e-40b8-a04f-58330c624c65@h2g2000vbd.googlegroups.com>...
> On Nov 2, 5:00?am, "Sebastiaan "
> <s.breedv...@erasmusmc.REMOVE.BOO.BOO.nl> wrote:
> > I am glad to be of some help :)
> >
> > 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.
> >
> > 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.
> >
> > 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.
> >
> > I fixed it by checking if the reciprocal condition is sufficient prior to solving the system.
> >
> > Sebastiaan
> >
> >
> >
> > "Bobby Cheng" <bch...@mathworks.com> wrote in message <hcf8jm$9u...@fred.mathworks.com>...
> > > I have not done this myself as I can change this from the inside. :)
> >
> > > But I think you can track the report update and comment of the content.
> > > Again, I have not tried any on this.
> >
> > > I can assure you that it is the same issue in the bug report. I am
> > > investigating the issue and have added your matrix into our tests. So thank
> > > you for the test case.
> >
> > > ---Bob
>
> Why not try rcond, backslash and pinv ?
>
> Greg

Interesting suggestion, I was unaware of the pseudoinverse method. I will have a look at it.

Thank you!
Sebastiaan

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
linsolve Sebastiaan 29 Oct, 2009 09:19:09
crash Sebastiaan 29 Oct, 2009 09:19:09
lapack Sebastiaan 29 Oct, 2009 09:19:09
illconditioning Sebastiaan 29 Oct, 2009 09:19:09
rssFeed for this Thread

Contact us at files@mathworks.com