Boost logo

Ublas :

From: Hongyu Miao (jackymiao_at_[hidden])
Date: 2007-09-16 22:27:27

Problem Description:
  The following codes will generate some strange results:

    boost::numeric::ublas::matrix<double> A4(4,6);
        for (i=0; i<A4.size1(); i++)
                for (j=0; j<A4.size2(); j++)
                        A4(i,j) = i*A4.size2()-j;
    std::cout << A4 << std::endl;

  The results shoulde be

  However, I actually got:


  If I change the code as follows, the problem is gone:
     int nTemp = A4.size2();
         A4(i,j) = i*nTemp-j;

  So the problem must be caused by

     A4(i,j) = i*A4.size2()-j;

  Any idea about this bug? Thanks.