octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #42422] ismatrix: Matlab is only true for 2 di


From: Rik
Subject: [Octave-bug-tracker] [bug #42422] ismatrix: Matlab is only true for 2 dimensions
Date: Wed, 28 May 2014 16:24:01 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0

Follow-up Comment #9, bug #42422 (project octave):

It is pretty clear that Matlab only uses ismatrix() for checking array
dimensions while Octave also tests that the argument is a "numeric" class
which includes numeric, logical, and character arrays.

A trivial implementation of ismatrix to match Matlab is


retval = (ndims (x) == 2);


But, as I expected, a lot of Octave core code is relying on also checking the
class of the argument.  Substituting the new ismatrix and running 'make check'
results in 47 new test failures.

The closest existing function is isreal() which returns true for numeric,
logical, and character matrices.  It would mean tracking down each of the 47
test failures and verifying that isreal could be substituted there. 
Alternatively, we could create a new function, some
is_close_enough_to_numeric_for_government_work() which includes numeric,
logical, and char types, and replace calls with that new function.

As for performance, I'll file a separate issue report about promoting some of
the frequently used predicate tests into C++ functions.  There is already a
patch report about doing that for isscalar but it should probably be
generalized to include all of the frequently used input validation tests.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42422>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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