octave-maintainers
[Top][All Lists]
Advanced

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

compatibility of plotting with sparse matrices


From: John W. Eaton
Subject: compatibility of plotting with sparse matrices
Date: Thu, 13 Dec 2012 15:13:10 -0500

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))

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'))

?

If these properties are stored as full matrices, should we copy this
behavior?

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?

jwe

  


reply via email to

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