On Tue, Apr 30, 2013 at 6:37 AM, Jordi Gutiérrez Hermoso <jord...@octave.org > wrote:
> On 29 April 2013 17:51, Ed Meyer <eem2...@gmail.com> wrote: > > > I'm not saying numel() is to blame or should be changed, only that I > > see no reason to ever use numel when handling sparse matrices unless > > you are converting it to full in which case the current behavior is > > ok. > > Well, look at the current implementation of trace (), in which numel > is a perfectly reasonable function to call. If you don't want to ever > call numel () for sparse matrices, then you would need to rewrite this > function to check for sparsity as well as any other function that > calls numel (). > > I think I see why numel() is getting called from trace(). isempty() is called which calls is_empty() which should be virtual. Were it to call the sparse version of is_empty() there would be no problem because it tests the row & column dimensions instead of calling numel(). So shouldn't is_empty() be virtual? -- Ed Meyer