Wed 28 May 2014 03:26:01 PM UTC, comment #9:
Sorry I missed that. I added your tests in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/ff613b6a7b6f). I did a few tweaks for Octave coding conventions. We prefer the double quote to the single quote for example. I also added tests for recursive structures and cells since that is an important part of isequal.
While testing I found that isequal doesn't work with java objects. I'll file a separate bug report about that.
|
Wed 28 May 2014 06:39:37 AM UTC, comment #8:
At the bottom of this page "Attached Files" I can see the file I uploaded:
https://savannah.gnu.org/bugs/download.php?file_id=31423
Did I set wrong visibility attributes or alike?
|
Wed 28 May 2014 01:36:01 AM UTC, comment #7:
"All previous test cases are contained in my changeset"
Did you upload a changeset? I don't see anything attached to the bug report.
|
Tue 27 May 2014 11:03:08 PM UTC, comment #6:
Thank you for the fix Rik. Was it possible to add some of my test cases to isequal.m in the folder above? This might avoid someone to break this desired behavior with another change. All previous test cases are contained in my changeset and all my tests are fulfilled.
Regards,
Kai
|
Tue 27 May 2014 09:17:21 PM UTC, comment #5:
I made Octave Matlab compatible with respect to character/numeric comparisons in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/1f170b211be3). This is on the development branch so you will need to get the file _isequal_.m from Mercurial if you need the fix sooner than the 4.2 release.
|
Sun 25 May 2014 09:31:23 PM UTC, comment #4:
Here the results for MATLAB 2013b again:
|
Sun 25 May 2014 05:39:07 PM UTC, comment #3:
I checked in a change that matches the return sizes Matlab uses for uncommon inputs (like 0x1, 1x0, 1x1 (but empty)) (http://hg.savannah.gnu.org/hgweb/octave/rev/a5286fb173cd). That takes care of the first problem which is the worst.
The other two comparisons are because Matlab seems to internally promote characters to a numeric class. Could you try running these experiments?
|
Sun 25 May 2014 12:37:42 PM UTC, comment #2:
Hi Rik,
I think you are right, here the output from MATLAB 2013b:
>> x = sparse ([])
x =
All zero sparse: 0-by-0
>> f_x = find (x)
f_x =
[]
>> size (f_x)
ans =
0 0
>> x = ones (0,100,2)
x =
Empty array: 0-by-100-by-2
>> f_x = find (x)
f_x =
Empty matrix: 0-by-1
>> size (f_x)
ans =
0 1
What do you suggest to overcome this issue?
Best,
Kai
|
Fri 23 May 2014 03:48:33 PM UTC, comment #1:
Confirmed.
Since you have access to Matlab, could you try the following?
The problem seems to be that Octave returns a [](0x1) matrix from find() when the input is empty rather than a [](0x0) matrix.
|
Fri 23 May 2014 02:19:33 PM UTC, original submission:
Hello,
I encountered incorrect results for the equality comparison of empty sparse matrices, which results in a hard error and the comparison for alphanumerical values.
In Octave:
octave:2> isequal (sparse([]),[])
error: _isequal_: mx_el_eq: nonconformant arguments (op1 is 0x1, op2 is 0x0)
error: evaluating argument list element number 1
error: called from:
error: /usr/local/share/octave/4.1.0+/m/general/private/__isequal__.m at line 161, column 11
error: /usr/local/share/octave/4.1.0+/m/general/isequal.m at line 31, column 10
octave:2> isequal (83, char(83))
ans = 0
octave:3> isequal (83, 'S')
ans = 0
-verbatim-
In MATLAB:
I will submit a patch with more test cases shortly.
Regards,
Kai
|