bugGNU Octave - Bugs: bug #51634, Calling repmat on struct array...

 
 

bug #51634: Calling repmat on struct array with explicit trailing singleton dimensions fails

Submitted by:  Piotr Held <jsoh425>
Submitted on:  Mon 31 Jul 2017 11:12:58 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Piotr HeldOpen/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.

 

Sat 05 Aug 2017 04:14:32 AM UTC, comment #4:

I added another BIST test for one of the other bugs and checked in the patch here (http://hg.savannah.gnu.org/hgweb/octave/rev/3544f88a2bb5). Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Sat 05 Aug 2017 04:04:03 AM UTC, comment #3:

@Piotr: Thanks for noticing this and providing such a simple fix. There are at least two other bug reports about this. I'm going to link them to this and then close all of them.

Rik <rik5>
Project Administrator
Wed 02 Aug 2017 09:16:46 PM UTC, comment #2:

This issue is actually connected to reshape, I apologize for not being more precise earlier.

The following code fails:

I am attaching this code in 'repmat_struct.tst' as a test.

The problem is with octave_map::reshape, that didn't chop trailing singletons for the main struct-array dimension.

The patch changeset also includes a test that is placed directly below octave_map::reshape and did not pass prior to patch and does pass after patch.

(file #41397)

Piotr Held <jsoh425>
Mon 31 Jul 2017 11:22:10 PM UTC, comment #1:

I was also able to add a test to octave_map::reshape() which did not pass prior to my change and now passes.

I am attaching the changeset.

(file #41378)

Piotr Held <jsoh425>
Mon 31 Jul 2017 11:12:58 PM UTC, original submission:

The exact code is as follows:

I believe I have identified the problem and I will attach a changeset in the next post.

I believe the problem is with octave_map::reshape(const dim_vector&). When reshaping the octave map the main dimensions (retval.dimensions) do not have the singletons chopped. Whereas, when reshaping the values (retval.xvals) the trailing singletons are chopped (the Array constructor does that). So the failure occured when trying to compare the main dimensions (retval.dimensions) to the array value dimensions (retval.xvals).

A simple:

seems to solve the trick.

Piotr Held <jsoh425>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #41397:  repmat_struct.tst added by jsoh425 (272B - application/octet-stream)
file #41378:  patch_bug51634.diff added by jsoh425 (1KiB - text/x-patch)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jordigh (Updated the item)
  • -unavailable- added by jsoh425 (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 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 05 Aug 2017 04:14:32 AM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sat 05 Aug 2017 04:06:04 AM UTCrik5Dependencies-=>Depends on bugs #43650
    Sat 05 Aug 2017 04:04:03 AM UTCrik5Dependencies-=>Depends on bugs #46385
    Wed 02 Aug 2017 09:16:46 PM UTCjsoh425Attached File-=>Added repmat_struct.tst, #41397
    Wed 02 Aug 2017 09:09:40 PM UTCjordighItem GroupIncorrect Result=>Regression
      SummaryCalling repmat on struct array sometimes fails=>Calling repmat on struct array with explicit trailing singleton dimensions fails
    Mon 31 Jul 2017 11:22:10 PM UTCjsoh425Attached File-=>Added patch_bug51634.diff, #41378

    Back to the top


    Powered by Savane 3.1-cleanup1