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)
|
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?
|
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?).
|
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)
|
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 ()
|