bugGNU Octave - Bugs: bug #33518, Lots of major and minor...

 
 

bug #33518: Lots of major and minor compatibility issues

Submitted by:  Arnaud Delorme <arnodelorme>
Submitted on:  Sat 11 Jun 2011 04:18:53 AM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: DuplicateAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.4.0Operating System: Mac OS

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)

Sat 11 Jun 2011 09:08:38 PM UTC, comment #6:

Thanks. Closing this bug per submitter's request.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Sat 11 Jun 2011 03:52:32 PM UTC, comment #5:

I have submitted separate bugs for each issue so this bug may be closed.

Arnaud Delorme <arnodelorme>
Sat 11 Jun 2011 03:18:23 PM UTC, comment #4:

Yes, I will submit different bug for each issue. I just did not want to submit too many bugs.

And thank you for the comment on && and &. I agree that & should not be treated as && in Matlab.

Arnaud Delorme <arnodelorme>
Sat 11 Jun 2011 06:32:37 AM UTC, comment #3:

It would help a lot if you could submit one bug report for each separate issue rather than one bug report with all of them. Doing it the way you did makes it difficult to track the separate items. If you are not willing to take the time to do this, perhaps someone else will. If these items are not split up. it is likely that we will have considerable difficulty tracking which ones are fixed and which ones are not.

John W. Eaton <jwe>
Project Administrator
Sat 11 Jun 2011 06:14:57 AM UTC, comment #2:

(oops, typo truncated part of my previous message)

Just a comment about one of these (not sure about the rest of the
things you mention, from a quick random sampling, they all seem like
valid reports assuming they are indeed different from Matlab).

> 2) parsing of &&
> Matlab treats "&" as "&&" (ignore additional inputs) but Octave does
> not


I believe that by "ignore additional inputs" you are referring to
short-circuiting. This is in fact a longstanding Matlab bug (so long
standing, that there is so much code that depends on it that the
Mathworks can't afford to fix it, but we can). It is not correct that
& and && are the same in Matlab. They are only the same inside a
condition but not outside. That is, the parsing rules for

and

are different. That this is a bug is obvious because the Matlab
language has another operator, namely &&, that short circuits, but
when they implemented the semantics for &, they forgot to make it not
short circuit when it's inside a condition. In other words, there is
no way in Matlab to avoid short circuiting inside a condition; you
must place the boolean evaluation outside of a condition if you want
the non-short-ciruiting behaviour.

Octave recently enabled support for this Matlab bug in the 3.4.x
series. If you need this bug, enable the

option in Octave.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Sat 11 Jun 2011 06:11:23 AM UTC, comment #1:

Just a comment about one of these (not sure about the rest of the
things you mention, from a quick random sampling, they all seem like
valid reports assuming they are indeed different from Matlab).

> 2) parsing of &&
> Matlab treats "&" as "&&" (ignore additional inputs) but Octave does
> not


I believe that by "ignore additional inputs" you are referring to
short-circuiting. This is in fact a longstanding Matlab bug (so long
standing, that there is so much code that depends on it that the
Mathworks can't afford to fix it, but we can). It is not correct that
& and && are the same in Matlab. They are only the same inside a
condition but not outside. That is, the parsing rules for

and

are different. That this is a bug is obvious because the Matlab
language has another operator, namely &&, that short circuits, but
when they implemented the semantics for &, they forgot to make it not
short circuit when it's inside a condition.

Octave recently enabled support for this Matlab bug in the 3.4.x
series. If you need this bug, enable the

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Sat 11 Jun 2011 04:18:53 AM UTC, original submission:

I have just ported 50 000 lines of Matlab code to be compabile with Octave. This is a list of all of the issues I have encountered. I have also encountered minor problems with the Octave language itself which I will post in a separate bug.

Congratulation on this project. It took me one week to convert all my code but it did run in the end.

A. Delorme

1) Dimention missing
P = rand(2,2);
Pori = mean(P, 3);
crashes if P is only 2 dim (works fine under Matlab)

2) parsing of &&
Matlab treats "&" as "&&" (ignore additional inputs) but Octave does not

3) int2str([]) crashes under Matlab

4) spline: requires at least 3 points udder Octave but not Matlab

5) legendre(2, [0.5 0.5; 0.5 0.5]); % works in Matlab but not in Octave

6) order of variable important for load command
TMPVAR = load(filename, '-mat'); does not work under Octave (but Matlab ok)
TMPVAR = load('-mat', filename); works

7) parsing of cell array (THIS IS A MAJOR ONE AS IT IS QUITE COMMON TO DECLARE MATRICES IN THIS WAY IN MATLAB)
{ 'test' { 'on' 'off' } } %does not work under octave
{ 'test' { 'on'; 'off' } } %does work

8) use of nargin
if (~nargin) return; end; % crashes under Octave

9) min requires numerical input in Octave but not in Matlab
min(char(1)); % crashes under Octave

10) ismember does not convert logical value to numerical values when necessary
ismember([0 1], [0 1]); % OK
ismember(2 < 3, [0 1]); % crashes (Matlab OK)

11) std() function cannot process empty entry
std([]) % crashes

12) tmp = strvcat; % return '' under Matlab and crashes under Octave

13) recycle() function missing. A dummy function could be made

14) fopen crashes when only one parameter is given
[IN, message] = fopen(filename); % works under Matlab

15) strread function is very poorly implemented and has multiple issues including returning different results (and incorrect ones as well) compared to Matlab
str = '[Common Infos]';
strread(str, '[%s', 'delimiter', ']')
ans =
'Common Infos'
(crashes under Octave)

[a,b,c] = strread('1,,2', '%s%s%s', 'delimiter', ',')
(does not return the same result under Octave; under Matlab, the second element of the cell array is empty (as it should be) whereas under Octave the third one is empty)

16) lower() on numbers return the identity in Matlab but not in Octave. That's an important lack of compatibility.
lower([90 100])

17) fread - 'bit24' not recognized under Octave

18) gridadata does not perform automatic transposition of arrays
[Xi,Yi,Zi] = griddata(rand(1,10),rand(1,10),rand(1,10)',rand(1,100)',rand(1,100));
% this works under Matlab but crashes nuder Octave

19) strmatch cannot process cell array under Octave
strmatch({ 'a' }, { 'a' 'b' 'c' }, 'exact')
% this works under Matlab but crashes nuder Octave

20) compatibility of the corrcoef function
corrcoef(rand(5,1), rand(5,1))
return 1x1 matrix Octave (2x2 Matlab with 1 in the diagonal)

corrcoef(rand(1,1,10), rand(1,1,10))
% crashes under Octave but work in Matlab

Arnaud Delorme <arnodelorme>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by arnodelorme (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 11 Jun 2011 09:08:38 PM UTCjordighStatusNone=>Duplicate
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1