bugGNU Octave - Bugs: bug #36665, ppval fails when pp.dim > 1 and...

 
 

bug #36665: ppval fails when pp.dim > 1 and xi is an array

Submitter:  Marco Caliari <caliari>
Submitted:  Fri 15 Jun 2012 07:18:03 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  caliari
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 03 Jul 2012 03:51:37 PM UTC, comment #7: 

Okay, I went ahead and made the small tweak.  Closing this report.

Rik <rik5>
Group administrator
Mon 02 Jul 2012 10:16:32 PM UTC, comment #6: 

Rik,

Looks good to me.  Marco's patch has already been pushed.  If you'd like me to push your change ... say the word.

Ben

Ben Abbott <bpabbott>
Group Member
Mon 02 Jul 2012 05:23:04 PM UTC, comment #5: 

Just a small efficiency question.

In the patch, a column vector is created using the (:) syntax.  This is then tiled up using repmat to a larger array using repmat ([1, prod(d)]).  Finally, a transpose of the matrix is performed to turn the multiple column vectors into row vectors.

Transpose is very fast.  Still, wouldn't it be more efficient to transpose the smaller object, the column vector, rather than the larger object, the complete matrix?


Current Code:
dx = (xi - x(idx))(:);
dx = repmat (dx, [1, prod(d)])';

Proposed Code:
dx = (xi - x(idx))(:)';
dx = repmat (dx, [prod(d)], 1);


Rik <rik5>
Group administrator
Mon 02 Jul 2012 12:08:01 PM UTC, comment #4: 

Marco,

I pushed your changeset.  I ran the integrated tests and all passed.

http://hg.savannah.gnu.org/hgweb/octave/rev/e437bacb3ef6

Ben Abbott <bpabbott>
Group Member
Mon 02 Jul 2012 08:50:26 AM UTC, comment #3: 

For some reason I can't push. Attached is my changeset.

Marco

(file #26135)

Marco Caliari <caliari>
Group Member
Fri 29 Jun 2012 06:35:49 PM UTC, comment #2: 

This looks sound.  Please make a changeset.

Rik <rik5>
Group administrator
Sat 16 Jun 2012 11:49:55 PM UTC, comment #1: 

Marco,

Matlab behaves as you suggest.

I didn't study how ppval works in detail, but it looks to me as if you have interpreted it correctly.

Ben Abbott <bpabbott>
Group Member
Fri 15 Jun 2012 07:18:03 AM UTC, original submission:  

Dear all,

consider the following


x = [0,1,2,3];
ppval (spline (x, [x;x]), x')

ans =

   0   1   2   3
   0   1   2   3


whereas


ppval (spline (x, [x;x]), [x',x'])
ans =

ans(:,:,1) =

   0   1   2   2
   0   2   2   3

ans(:,:,2) =

   0   1   2   2
   0   2   2   3


I think that ans(:,:,1) and ans(:,:,2) should be both equal to the previous result (as in ml). I got the correct answer by replacing


dx = (xi - x(idx));
dx = repmat (dx, [prod(d), 1]);


with


dx = (xi - x(idx))(:);
dx = repmat (dx, [1, prod(d)])';


If you confirm this is the proper fix, I can submit a changeset.

Marco

Marco Caliari <caliari>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #26135:  ppval.diff added by caliari (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by caliari (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-07-03 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2012-07-02 bpabbott StatusConfirmed Ready For Test
        Release3.6.0 dev
    2012-07-02 caliari Attached File- Added ppval.diff, #26135
    2012-06-29 bpabbott Assigned toNone caliari
    2012-06-29 rik5 Summaryppval fails when pp.dim &gt; 1 ans xi is an array ppval fails when pp.dim > 1 and xi is an array
    2012-06-16 bpabbott StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code