Blitz logo

Blitz Bugs :

From: Victor Munoz (vmunoz_at_[hidden])
Date: 2004-05-06 20:34:20


Hello.

I think this may be a bug. I haven't found anything in the blitz mailing
lists archives. The problem is the following code, which gives different
results in debian woody (g++ version 2.95.4, blitz++ version 20001213-2.1),
and debian sid (g++ 3.3.3, blitz++ version 0.7):

------------------------------------------------------------

#include <blitz/array.h>
#include <iostream>
#include <stdlib.h>

using namespace blitz;

int main(){

  Array<float,2> c;
  for (int i=0;i<10;i++){
      c.resize(c.rows()+1,2);
      c(c.rows()-1,0)=0;
      c(c.rows()-1,1)=1;
  }

  cout << c << endl;
                    
}

------------------------------------------------------------

Compiling with : g++ -g -o blitz_resize blitz_resize.cc -lblitz

woody:

./blitz_resize

10 x 2
[ 0 1
          0 1
          0 1
          0 1
          0 1
          0 1
          0 1
          0 1
          0 1
          0 1 ]
           
sid:

./blitz_resize

10 x 2
[ 2.55663 2.55663
  2.24208e-44 3.36312e-44
    0 0
    0 1
   5.60519e-44 4.48416e-44
    0 0
    0 0
    0 1
   1.00893e-43 5.60519e-44
    0 1 ]

Naturally, the "woody" behavior is the desired one. Has anyone had a similar
problem? Of course, it could be a problem with g++, but I'm just
guessing it's more likely some issue with Blitz++. (It could also be that
I'm not using resize correctly.)
          
          Thanks for any help/comments,
          
                                                     Victor