[Top][All Lists]

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

Re: FYI: sparse indexed assignment rewritten

From: Jaroslav Hajek
Subject: Re: FYI: sparse indexed assignment rewritten
Date: Fri, 16 Apr 2010 13:06:12 +0200

On Fri, Apr 16, 2010 at 1:02 PM, David Bateman <address@hidden> wrote:
> 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

I don't see much reason to save nzmax > nnz. nzmax is tightly related
to memory, not to the actual value of the matrix. I suppose that when
saving, you want to save only as much data as needed. I'd say let's
save just nnz and the valid data, which is a non-disturbing change. If
anyone can bring forward arguments why saving also nzmax is desired,
it can be discussed and possibly changed.


RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

reply via email to

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