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

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

[Octave-patch-tracker] [patch #10288] Implementation of Matlab function


From: Nicholas Jankowski
Subject: [Octave-patch-tracker] [patch #10288] Implementation of Matlab function tensorprod
Date: Sun, 23 Oct 2022 02:32:34 -0400 (EDT)

Follow-up Comment #4, patch #10288 (project octave):

Ok, I had wondered if that form would work. thanks for checking.  It would
probably be worth adding an error that catches when people try to call it with
NumDimensionsA=4 form, the message indicating something like"name=value syntax
arguments are not yet implemented in Octave".

Regarding the rest of the code the actual tensor product portion seems
mathematically correct. There are a lot of spots where error handling could be
improved, however, especially for input type-checking. These spots would
probably be easy to identify if you could add self tests to the end of the
function  (see https://wiki.octave.org/Tests, and you can look at most other
octave functions for some examples.) In particular:

some basic correct outputs should be tested in all of the different expected
calling forms.  (I got a 'dimA not defined" error with tensorprod(a,b,2) ). 
For compatibility, that usually should also include empty and NaN inputs of
different shapes, which could involve requesting a list of outputs from
someone with access to a recent version of matlab. 

anything expected to be an error should have an error test in an Input
Validation section.  If we expect something to produce an error, the function
should have an explicit check and sensible error message to explain it to the
user. Some in particular:

- calling with nargin > 6 (you can add a "|| nargin > 6" to you print_usage
check)
- calling with name=value form. 
- A and B not being single or double (isfloat() can check that)
- typechecking any varargin for not being an integer, "all", or
"NumDimensionsA".  e.g., checking for tensorprod(a,b,"foo") 

 



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?10288>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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