conv.m and MATLAB incompatibility.

Robert T. Short octave at phaselockedsystems.com
Wed Jul 15 13:46:21 CDT 2009


John W. Eaton wrote:
> On 28-Jun-2009, Robert T. Short wrote:
>
> | Attached is a patch to conv.m that fixes a MATLAB incompatibility.  I 
> | also added a couple of tests.
> | 
> | Summarizing:  if the input vectors are the same length, but one is a row 
> | vector and the other is a column vector, the octave version returns the 
> | correct answer but with a different orientation than MATLAB.  In other 
> | words octave will return a row vector when MATLAB returns a column 
> | vector and octave will return a column vector when MATLAB returns a row 
> | vector.
> | 
> | 
> | WARNING.  APPLYING THIS PATCH COULD CAUSE SCRIPT BREAKAGE!
> | 
> | Scripts that depend on the row/column nature of the result will no 
> | longer work.  This might be a good reason not to apply this patch.  
> | Folks (like me) that want MATLAB compatibility can keep this version in 
> | their path.
>
> I checked in this patch but had to make a few additional changes to
> allow the tests to run.
>
> You had
>
>   %!test
>   %! ...
>   %! error conv (...);
>
> but that's a syntax error.  The error directive generates a separate
> test, so must be written as
>
>   %!error conv (...);
>
> Also, I think it is probably better to write
>
>   %! assert (conv (...), [...])
>
> instead of
>
>   %! assert (all (conv (...) == [...]))
>
> If you want each assert to count as a separate test, you can write
>
>   %!shared ...
>   %! variable definitions..
>   %!assert (...)
>   %!assert (...)
>   %!...
>
> instead of
>
>   %!test
>   %! variable definitions...
>   %! assert (...)
>   %! assert (...)
>   %! ...
>
> jwe
>
>
>   
Thanks.  I copied the structure from the someplace.  I will take a look 
at what you did and and learn.

Is having separate tests important or more of a philosophical nicety?

Bob


More information about the Octave-maintainers mailing list