Thread Subject: How to judge a large matrix containing a Nan?

Subject: How to judge a large matrix containing a Nan?

From: zedong

Date: 1 Jan, 2009 07:12:05

Message: 1 of 3

I now have a sparse matrix which is computed by me(coming from a discretization of partial differential equation,I have used mex file ).
for example:A is a 10000 by 10000 sparse matrix.
x=A\b (in which b is a 10000 by 1 matrix).
I have found that there is some Nan in x.I guess maybe A also has some nan.How to judge that A(i,j) is Nan?Thank you all

Subject: How to judge a large matrix containing a Nan?

From: Brian Borchers

Date: 1 Jan, 2009 07:31:00

Message: 2 of 3

On Jan 1, 12:12 am, "zedong " <zdon...@gmail.com>
>How to judge that A(i,j) is Nan?

The isnan() function will do this for you. In particular,

nnz(isnan(A))

will tell you how many NaN's are in the matrix A, while

isnan(A)

will give you a sparse matrix with 1's in the same positions as the
NaN's in A.

Subject: How to judge a large matrix containing a Nan?

From: Rune Allnor

Date: 1 Jan, 2009 10:21:15

Message: 3 of 3

On 1 Jan, 08:12, "zedong " <zdon...@gmail.com> wrote:
> I now have a sparse matrix which is computed by me(coming from a discretization of partial differential equation,I have used mex file ).
> for example:A is a 10000 by 10000 sparse matrix.
> x=A\b (in which b is a 10000 by 1 matrix).
> I have found that there is some Nan in x.I guess maybe A also has some nan.How to judge that A(i,j) is Nan?Thank you all

ISNAN should tell you whether A contains NaNs. If it does, you would
want to have a look at the mex file which generates A to find out
why they occur.

Rune

Tags for this Thread

Everyone's Tags:

nan

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
nan zedong 1 Jan, 2009 02:15:10
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com