help-octave
[Top][All Lists]
Advanced

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

Re: How can one get the size of a sparse matrix ?


From: David Bateman
Subject: Re: How can one get the size of a sparse matrix ?
Date: Thu, 6 Jan 2005 14:02:34 +0100
User-agent: Mutt/1.5.6i

According to Schloegl Alois <address@hidden> (on 01/06/05):
> 
> 
> I'm using Andy Adlers Sparse toolbox using Octave-forge.
> 
> octave:10> which sparse
> sparse is the dynamically-linked function from the file
> /usr/local/libexec/octave/2.1.64/site/oct/i686-pc-linux-gnu/octave-forge/sparse.oct
> 
> When I try to obtain number of rows and columns of a sparse matrix, I get 
> always
> -1.
> 
> octave:11> X = sparse(2:5,1:4,1);
> octave:12> size(X),
> ans =
> 
>   -1  -1
> 
> 
> How can one obtain the size of a sparse matrix ?

With Andy's toolbox, I'm not seeing this behavious

octave:1> version
ans = 2.1.64
octave:2> OCTAVE_FORGE_VERSION 
ans = 20041116
octave:3> X = sparse(2:5,1:4,1);
octave:4> size(X), 
ans =

  5  4

Fsize returns rep->dims(), which in the case of Andy's package is the

  dim_vector dims (void) const {dim_vector dv (rows(), cols()); return dv; }

which are

int octave_sparse::rows    (void) const {
   return X.nrow;
}
int octave_sparse::columns (void) const {
   return X.ncol;
}

Where X is the SuperLU matrix. Frankly, I can see no reason for this to 
fail in the way you show... What seems to be happening for you is that
octave_sparse::dims isn't being used as rep->dims, and the default version

dim_vector octave_base_value::dims (void) const { return dim_vector (-1, -1); }

is being returned... Again, I see no reason for this looking at Andy's code..

Regards
David

-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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