<br><br><div class="gmail_quote">On Mon, Apr 29, 2013 at 11:07 AM, Jordi Gutiérrez Hermoso <span dir="ltr"><<a href="mailto:jordigh@octave.org" target="_blank">jordigh@octave.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 29 April 2013 14:00, Jordi Gutiérrez Hermoso <<a href="mailto:jordigh@octave.org">jordigh@octave.org</a>> wrote:<br>
> And yes, sparse matrices can be indexed by a single index instead of<br>
> two, like any other matrix. Internally in Octave's source, the<br>
> assumption that a single index of octave_idx_type is available is used<br>
> throughout.<br>
<br>
</div>The specific case where this fails in this instance is octave_idx_type<br>
dim_vector::numel (), which is obtained simply by multiplying each of<br>
the dimensions of the matrix, even for sparse matrices (this is unlike<br>
nnz, so a workaround just for trace.m would be to use nnz instead of<br>
numel, but I think this would still leave some pretty broken sparse<br>
matrices lying around with other problems).<br>
<br>
We would have to change numel () to use some other type that can hold<br>
the result of a larger size, but this is a pretty fundamental function<br>
in Octave. The overall assumption is that you can linearly index up to<br>
numel (). Every place that calls this function would need to be<br>
checked to see what happens if we change its return type to be some<br>
special bigint.<br>
<br>
- Jordi G. H.<br>
</blockquote></div><br>I'm not proposing using anything but octave_idx_type for indexing or changing<div>the return type of numel() - I just question why numel() is used for sparse matrices.</div><div>It should be irrelevant for anything but ccs2full().</div>
<div>Rather than restrict the size of sparse matrices I think it would make more sense</div><div>to fix problems like this as they come up so that sparse storage is used as it</div><div>was intended - to reduce storage & op count.<br clear="all">
<div><br></div>-- <br>Ed Meyer<br>
</div>