bugGNU Octave - Bugs: bug #41448, ppval returns wrong dimensions for...

 
 

bug #41448: ppval returns wrong dimensions for scalar valued polynomial

Submitter:  Markus Appel <mappel>
Submitted:  Mon 03 Feb 2014 08:10:44 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.8.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 03 Feb 2014 11:21:52 PM UTC, comment #3: 

Hard to say why it was commented out.  I only know that it passes the regression tests with or without the block of code.  But without it it fails the example in this bug report so it seems better to have it in.

Rik <rik5>
Group administrator
Mon 03 Feb 2014 10:37:31 PM UTC, comment #2: 

That block of code was apparently commented out when it was added in this changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/59e2460acae1

The purpose of that changeset was to make things more compatible, so I'm not sure why it was left out.  Maybe Kai found some case where this behavior is not correct?

John W. Eaton <jwe>
Group administrator
Mon 03 Feb 2014 10:25:39 PM UTC, comment #1: 

Confirmed.

The function ppval is located in scripts/polynomial/ppval.m.  At the bottom of the function just before returning the result to the user I see this


  ## FIXME: Why is this commented out, rather than just removed?
  #if (d == 1)
  #  yi = reshape (yi, sxi);
  #endif


If I uncomment this section of code then I get the correct shape.  I'm not sure why this happened, but I made the fix by uncommenting out the code.  I also added a built-in self test for this so it won't happen again.  The fix was made on the stable branch (http://hg.savannah.gnu.org/hgweb/octave/rev/90568d7fe382) and will be a part of the 3.8.1 bug fix release.

Rik <rik5>
Group administrator
Mon 03 Feb 2014 08:10:44 PM UTC, original submission:  

YI = ppval (PP, XI) is documented with:
"If PP describes a scalar polynomial function, the result is an array of the same shape as XI."

But:

octave:35> ppval ( mkpp([0 1],1), magic(3) )
ans =

ans(:,:,1) =

   1   1   1

ans(:,:,2) =

   1   1   1

ans(:,:,3) =

   1   1   1


I would the result expect to be a 3x3 matrix, i.e. :


assert ( ppval ( mkpp([0 1],1), magic(3) ) , ones(3,3) )


I checked in Matlab R2012b, there the function ppval returns a 3x3 matrix as documented.

Markus Appel <mappel>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mappel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-02-03 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code