[Top][All Lists]

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

sparse 2-D lookup

From: John W. Eaton
Subject: sparse 2-D lookup
Date: Tue, 25 Oct 2005 20:18:43 -0400

On 25-Oct-2005, Jeff Abrahamson wrote:

| I want an array of (x,y,z) triples.  The problem is that x and y come
| from the same very large set, but very few (x,y) pairs will actually
| be used.  The z value is computed based on x and y, so this is really
| a function f(x,y) = z.
| Naively I'd create a sparse array, but sparse arrays seem (it's not
| clear, though) to become regular arrays if I add elements to them.
| Thus,
|     v = sparse(10000000,10000000)
|     v =
|     Compressed Column Sparse (rows=10000000, cols=10000000, nnz=0)
|     octave:3> v(1,1) = 1 
| (and memory usage jumps to near 2 GB and my machine slows to a crawl).

You must be using the sparse code from octave-forge.  The sparse code
that is part of Octave 2.9.x does not have this problem.


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

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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