octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: sparse indexed assignment rewritten


From: David Bateman
Subject: Re: FYI: sparse indexed assignment rewritten
Date: Fri, 16 Apr 2010 13:02:56 +0200
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706)

Jaroslav Hajek wrote:
On Wed, Apr 14, 2010 at 3:44 PM, John W. Eaton <address@hidden> wrote:
On 13-Apr-2010, Jaroslav Hajek wrote
| 3. simple grep query shows that the interpreter uses nzmax at
| suspiciously many places. I bet some of those usages are wrong and
| should be nnz, but it requires individual approach. So get ready for
| mysterious crashes, just in case.

I guess we need to look at all nzmax uses and decide whether they
should be nnz instead.  Are there any simple rules for when nzmax is
required?

nzmax is now (as it should have always been) just the amount of space
allocated for nz elements. So probably anything that merely reads the
matrix wants to use nnz(). An exception is conversion (conversions
should preserve nzmax because of spalloc), but I think I already
handled that.

I started to look at this and have a question. For the octave file formats do we want to save the sparse matrix in a way that preserves the values of nzmax if it is different than nnz? If we do, then we need to change the format as only one of these values is currently saved. A similar issue exists for the matlab file format.. They save the value of nzmax in the tag and nnz can be derived from the element length (given in bytes). However as I no longer have access to matlab I'm unsure if matlab uses this to save the value of nzmax or not.. What does

s = spalloc (10,10,10);
save -v6 f.mat s
clear all
load f.mat
nzmax(s)

give in a recent version of matlab?

Cheers
David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]