bugGNU Octave - Bugs: bug #38151, Empty length in a linspace

 
 

bug #38151: Empty length in a linspace

Submitted by:  Marco Caliari <caliari>
Submitted on:  Wed 23 Jan 2013 02:04:47 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.6.2Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Thu 21 Feb 2013 12:31:43 AM UTC, comment #2:

It's not documented, but apparently Matlab produces B for linspace (A, B, []). It would not be hard to fix this, so I say why not? I checked in the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/39129305b914

John W. Eaton <jwe>
Project Administrator
Wed 20 Feb 2013 11:48:18 PM UTC, comment #1:

I think that Octave probably has the correct behavior.

According to the linspace documentation it wants a scalar number N for the number of points. The empty matrix is not zero (a scalar number), but an entirely different data type (matrix). It seems fine to flag the user that linspace has been called incorrectly. The error message also points out

error: linspace: N must be an integer

which gives a good clue about what a user would need to do to make it work.

Rik <rik5>
Project Administrator
Wed 23 Jan 2013 02:04:47 PM UTC, original submission:

Dear maintainers,

what should be the result of

Actually (3.6.2), it is an error. If I consider the following case

the last two lines give the same result [3,4]. But if I consider
the same example with

the second last line works (although giving the transposed result [](0x1)) and the last line does not work.
If I do the same in Matlab, I get [](1x0) and error, respectively.
I do not know what "should" be the result and, of course, it is a corner case.

Marco

Marco Caliari <caliari>
Project Member

 

(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 rik5 (Posted a comment)
  • -unavailable- added by caliari (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 21 Feb 2013 12:31:43 AM UTCjweItem GroupFeature Request=>Matlab Compatibility
      StatusWont Fix=>Fixed
    Wed 20 Feb 2013 11:48:18 PM UTCrik5StatusNone=>Wont Fix
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup