[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compatibility of plotting with sparse matrices
From: |
Ben Abbott |
Subject: |
Re: compatibility of plotting with sparse matrices |
Date: |
Thu, 13 Dec 2012 15:22:47 -0500 |
On Dec 13, 2012, at 3:13 PM, John W. Eaton wrote:
> Can someone confirm that Matlab returns false for the issparse call
> below?
>
> x = sprand (2000, 1, 0.1);
> y = 2*x;
> h = line (x, y);
> issparse (get (h, 'xdata))
x = sprand (2000, 1, 0.1);
y = 2*x;
h = line (x, y);
issparse (get (h, 'xdata'))
ans =
0
> Also, what happens for setting sparse xdata, ydata, and cdata elements
> for images? For example, what is the result of
>
> x = sprand (200, 200, 0.1);
> h = image (x);
> set (h, 'cdata', 2*x);
> issparse (get (h, 'cdata'))
x = sprand (200, 200, 0.1);
h = image (x);
set (h, 'cdata', 2*x);
issparse (get (h, 'cdata'))
ans =
0
> If these properties are stored as full matrices, should we copy this
> behavior?
They are full.
> If we do, then plotting of sparse matrices will just "work" the same
> as plotting full matrices does now. But we will potentially waste a
> lot of memory.
>
> If we instead attempt to save memory by preserving sparsity of the
> property values, we have to handle sparsity in several different
> places in the plotting "backends" (so gnuplot and opengl both must be
> fixed to plot sparse arrays correctly). And we'll introduce an
> incompatibility with Matlab, though maybe it is not important -- does
> anyone actually rely on the values returned by "get" being full
> matrices if they are set with sparse matrices?
I don't think it necessary to copy the behavior Matlab here (maybe only for
--brain-dead). Fixing the gnuplot backend should be fairly easy, by converting
the properties to full matrices when needed.
Ben