bugGNU Octave - Bugs: bug #42487, issymmetric incompatible with...

 
 

bug #42487: issymmetric incompatible with Matlab

Submitted by:  CarnĂ« Draug <carandraug>
Submitted on:  Mon 02 Jun 2014 11:03:07 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Thu 15 Dec 2016 04:27:26 PM UTC, comment #7:

This issue is still present in Octave 4.2.0.

The Octave version of issymmetric.m is still expecting a numerical value as second parameter, as opposed to Matlab.

There is a PATCH proposed in comment #6.

Hartmut <hardy>
Tue 23 Sep 2014 07:18:59 PM UTC, comment #6:

First, I've figured out that the option in Matlab is called "nonskew" and not "noskew".

Seconds, Matlab issymmetric function doesn't support logical inputs. It returns

I've attached a suggestion for issymmetric which kept the backward compatibility for numeric tolerance input from Octave Version 3.8.2 and is compatible with Matlab char based input arguments 'skew' and 'nonskew'.

(file #32174)

Markus Bergholz <markuman>
Sun 21 Sep 2014 11:07:52 AM UTC, comment #5:

You're right again. It depends on the fact that logical matrices returned 0 when tested with issymmetric, much like what happens for ishermitian, where instead of
one has

I added islogical in order to be consistent with istril, istriu, isbanded and bandwidth, but I didn't notice the problem with ishermitian at that time.

I think that both ishermitian and issymmetric should have the same behaviour. They could return false either when the matrix is boolean or when the matix is boolena AND a tolerance parameter is specified.

Any suggestions or ideas?

Massimiliano Fasi <mfasi>
Sun 21 Sep 2014 08:44:24 AM UTC, comment #4:

Now I can apply and confirm the results.

One last failure whitch works in 3.8.2 but no more with your patch

with your patch

>> issymmetric(logical(eye(2)),1)
error: xnorm: wrong type argument 'bool matrix'
error: called from:
error: /home/markus/git/octave/scripts/linear-algebra/issymmetric.m at line 71, column 16
>>

octave 3.8.2

octave:2> issymmetric (logical (eye (2)),1)
ans = 0

Because this syntax should be matlab incompatible, I don't know if this should be fixed (backward compatible) or if it's just nice to have (matlab compatiblity has a higher priority?).

Markus Bergholz <markuman>
Sun 21 Sep 2014 08:18:09 AM UTC, comment #3:

Hello Markus,

you were right, the patch didn't work since the source had changed in the meanwhile. I have modified the changeset and attached the new version, thank you for your feedback.

I don't have matlab 2014 to run the tests you suggested, but I asked to run some on IRC when I published the patch and, as far as I remember, it worked fine. Thus, I suspect that the behaviour was changed after 3.8.2 because there was no issymmetric function in Matlab before.

I tried the patched version of issymmetric against the examples from the website, and they seem to work fine for me. Can you detail the issue a bit?

(file #32154)

Massimiliano Fasi <mfasi>
Sun 21 Sep 2014 07:33:09 AM UTC, comment #2:

I cannot apply this patch. I did it manually, but some of the asserts are failing. Furthermore, the Matlab example results from their website doesn't match to the results from this patch (or with any other Version of octave).

Furthermore, it seems like this patch is partly used already, because the issymmetric version in 3.8.2 differs from the current hg version.

Octave 3.8.2

octave:1> issymmetric (logical (eye (2)))
ans = 0

Current hg version

>> issymmetric (logical (eye (2)))
ans = 1

What are the results in Matlab?

%!assert (issymmetric (1))
%!assert (issymmetric (1), 'noskew')
%!assert (! issymmetric ([1, 2]))
%!assert (issymmetric ([]))
%!assert (issymmetric ([]), 'noskew')
%!assert (issymmetric ([1, 2; 2, 1]))
%!assert (! (issymmetric ("test")))
%!assert (issymmetric ([1, 2.1; 2, 1.1], 0.2))
%!assert (issymmetric ([1, 2i; 2i, 1]))
%!assert (issymmetric ([1, 2i; 2i, 1], 'noskew'))
%!assert (! (issymmetric ("t")))
%!assert (! (issymmetric (["te"; "et"])))
%!assert (issymmetric (speye (100000)))
%!assert (issymmetric (speye (100000), 'noskew'))
%!assert (issymmetric (logical (eye (2))))
%!assert (issymmetric (logical (eye (2)), 'skew'))

%!test
%! a = [0, 2; -2, 0];
%! assert (issymmetric (a, 'skew'))
%! assert (! issymmetric (a, 'noskew'))

%!test
%! s.a = 1;
%! assert (! issymmetric (s));

%!error issymmetric ([1, 2; 2, 1], 0, 0)
%!error issymmetric ()

Markus Bergholz <markuman>
Tue 08 Jul 2014 12:30:29 PM UTC, comment #1:

As for Octave the second parameter is a number while for Matlab is a string, I think it's possible to add the feature maintaining compatibility with older versions of Octave. I submitted a patch that implement my idea.

(file #31690)

Massimiliano Fasi <mfasi>
Mon 02 Jun 2014 11:03:07 AM UTC, original submission:

Seems like Matlab has added the issymmetric function to their repertoire with version 2014a (according to http://www.dynare.org/DynareWiki/MatlabVersionsCompatibility ). hg log shows that our version has been around since 2002 with cset 8cb8eff3f44c

Their implementation takes a different second input argument.

Carnë Draug <carandraug>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #32174:  bug_42487_3.patch added by markuman (5KiB - text/x-patch)
file #32154:  bugfix_42487.patch added by mfasi (4KiB - text/x-diff)
file #31690:  bugfix_42487.patch added by mfasi (4KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by hardy (Posted a comment)
  • -unavailable- added by markuman (Posted a comment)
  • -unavailable- added by mfasi (Updated the item)
  • -unavailable- added by carandraug (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 23 Sep 2014 07:18:59 PM UTCmarkumanAttached File-=>Added bug_42487_3.patch, #32174
    Sun 21 Sep 2014 08:18:09 AM UTCmfasiAttached File-=>Added bugfix_42487.patch, #32154
    Tue 08 Jul 2014 12:30:29 PM UTCmfasiAttached File-=>Added bugfix_42487.patch, #31690

    Back to the top


    Powered by Savane 3.1-cleanup1