bugGNU Octave - Bugs: bug #31823, floor/ceil caching causing...

 
 

bug #31823: floor/ceil caching causing incorrect behavior when concatenating

Submitter:  None
Submitted:  Wed 08 Dec 2010 09:26:38 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Alex Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.2.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 09 Dec 2010 06:06:18 AM UTC, comment #5: 

Rik, the actual size was indeed 6 across, but the problem has fully been addressed

Thank you John. Octave was parsing the + as the unaray operation.

Anonymous
Thu 09 Dec 2010 05:57:51 AM UTC, comment #4: 

I suspect your problems is the spaces before the +floor and +ceil in the expression


-Wx = [  n*(floor(Gx)-1)+floor(Gy) , ...
            n*(ceil(Gx)-1) +floor(Gy) , ...
            n*(floor(Gx)-1)+ceil(Gy)  , ...
            n*(ceil(Gx)-1) +ceil(Gy)  ];


Octave parses these as separate elements, not a binary addition.  See the explanation here:

http://www.gnu.org/software/octave/doc/interpreter/Matrices.html#Matrices

If this is not the problem, then reopen the bug report and tell us the values of m and n in the call to your function so that we can reproduce the error..

John W. Eaton <jwe>
Group administrator
Thu 09 Dec 2010 04:51:21 AM UTC, comment #3: 

Try checking the size of Wx directly before the call to reshape and see if Wx really has 6 columns.


size(Wx)

Wx = reshape(Wx,[nnz,1]);


Rik <rik5>
Group administrator
Wed 08 Dec 2010 08:24:31 PM UTC, comment #2: 

Notice that each call to size has one of the concatenation elements. There are 4 elements being concatenated, all with size 147576x1 (from the provided output).

is there a more appropriate way to verify this other than outputing the size of each element?

Anonymous
Wed 08 Dec 2010 05:15:55 PM UTC, comment #1: 

Could you verify that only 4 columns are being concatenated?   According to the message from reshape:

error: reshape: can't reshape 147576x6 array to 590304x1 array

which seems entirely reasonable since 147576*6 = 885456 which is not equal to 590304.

4 columns would make 147576*4 = 590304.


Rik <rik5>
Group administrator
Wed 08 Dec 2010 09:26:38 AM UTC, original submission:  

Each of the four columns of Wx has width 1, but Wx has width 6.

Calculating each column and storing it in a variable, then concatenating those variables does NOT result in an error.

In the following code:
    n is a scalar
    Gx and Gy are vectors of the same length
    nnz is 4 times that length


    size(n*(floor(Gx)-1)+floor(Gy))
    size(n*(ceil(Gx)-1) +floor(Gy))
    size(n*(floor(Gx)-1)+ceil(Gy))
    size(n*(ceil(Gx)-1) +ceil(Gy))

    Wx = [  n*(floor(Gx)-1)+floor(Gy) , ...
            n*(ceil(Gx)-1) +floor(Gy) , ...
            n*(floor(Gx)-1)+ceil(Gy)  , ...
            n*(ceil(Gx)-1) +ceil(Gy)  ];

    Wx = reshape(Wx,[nnz,1]);


The exact output is as follows:


octave:3> W = registration(m,n,0.5,0.5,0,1,0);
ans =

   147576        1

ans =

   147576        1

ans =

   147576        1

ans =

   147576        1

error: reshape: can't reshape 147576x6 array to 590304x1 array


omitting the reshape and using vertical concatenation gives:


ans =

   147576        1

ans =

   147576        1

ans =

   147576        1

ans =

   147576        1

error: number of columns must match (2 != 1)


The error occurs both when preallocating Wx and when no preallocating Wx.

I installed the image processing package off what i think is a clean install of 3.2.2.
http://octave.sourceforge.net/image/index.html

This problem also occured on 3.0.5 which prompted the reinstall.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #22158:  registration.m.buggy added by None (1KiB - application/octet-stream - file containing the bug inducing code)

 

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 None (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-12-09 jwe StatusNeed Info Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2010-12-08 rik5 StatusNone Need Info
    2010-12-08 None Attached File- Added registration.m.buggy, #22158

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code