bugGNU Octave - Bugs: bug #34365, pascal(n,2) returns different...

 
 

bug #34365: pascal(n,2) returns different permutation than ML; pascal() for n=0 inaccurately returns [1]

Submitted by:  Vanya Sergeev <vsergeev>
Submitted on:  Fri 23 Sep 2011 09:20:59 AM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
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.

 

Sun 20 Nov 2011 09:36:57 PM UTC, comment #1:

Thanks for the hg changeset. It applied cleanly here (http://hg.savannah.gnu.org/hgweb/octave/rev/d4404589498c). It will be part of the 3.6.0 release scheduled for December 2011.

Rik <rik5>
Project Administrator
Fri 23 Sep 2011 09:20:59 AM UTC, original submission:

ML's pascal(n,2) returns the horizontal permutation of pascal(n,1)', whereas Octave's pascal(n,2) returns the vertical permutation of pascal(n,1)'. They're both valid permutations of pascal(n,1)' in that pascal(n,2)^3 = eye(n), but using the same permutation as ML might be warranted for compatibility purposes.

Octave also does not handle the n=0 case correctly, it returns a 1x1 matrix [1] for pascal(0) and pascal(0,1), and errors out for pascal(0,2). ML returns the 0x0 empty matrix for pascal(n), 0x1 empty matrix for pascal(n,1), and 1x0 empty matrix for pascal(n,2).

MATLAB's pascal():

Octave's pascal():

Attached is hg patch to scripts/special-matrix/pascal.m for improved ML compatibility with pascal(), as well as a fix for the n=0 case.

The patched pascal() octave output:

For simplicity, I didn't make the modifications to reflect ML's dimensions of the empty matrix with pascal(0,1) and pascal(0,2), but this can probably be easily added if it's necessary.

~vsergeev

Vanya Sergeev <vsergeev>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #24017:  pascal.diff added by vsergeev (1KiB - text/x-patch - hg changeset patch for pascal.m)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by vsergeev (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
    Sun 20 Nov 2011 09:36:57 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 23 Sep 2011 09:20:59 AM UTCvsergeevAttached File-=>Added pascal.diff, #24017

    Back to the top


    Powered by Savane 3.1-cleanup1