octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A couple of 64 bit issues


From: David Bateman
Subject: A couple of 64 bit issues
Date: Wed, 05 Sep 2007 14:59:21 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Last night I noticed a couple of 64 bit issues. Here is a patch..

D.


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

*** ./liboctave/Array.h.orig21  2007-09-05 10:00:25.757474066 +0200
--- ./liboctave/Array.h 2007-09-05 10:01:24.713865924 +0200
***************
*** 284,291 ****
    T range_error (const char *fcn, octave_idx_type i, octave_idx_type j, 
octave_idx_type k) const;
    T& range_error (const char *fcn, octave_idx_type i, octave_idx_type j, 
octave_idx_type k);
  
!   T range_error (const char *fcn, const Array<int>& ra_idx) const;
!   T& range_error (const char *fcn, const Array<int>& ra_idx);
  
    // No checking, even for multiple references, ever.
  
--- 284,291 ----
    T range_error (const char *fcn, octave_idx_type i, octave_idx_type j, 
octave_idx_type k) const;
    T& range_error (const char *fcn, octave_idx_type i, octave_idx_type j, 
octave_idx_type k);
  
!   T range_error (const char *fcn, const Array<octave_idx_type>& ra_idx) const;
!   T& range_error (const char *fcn, const Array<octave_idx_type>& ra_idx);
  
    // No checking, even for multiple references, ever.
  
***************
*** 298,307 ****
    T& xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return 
xelem (i, dim2()*k+j); }
    T xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { 
return xelem (i, dim2()*k+j); }
  
!   T& xelem (const Array<int>& ra_idx)
      { return xelem (compute_index (ra_idx)); }
  
!   T xelem (const Array<int>& ra_idx) const
      { return xelem (compute_index (ra_idx)); }
  
    // FIXME -- would be nice to fix this so that we don't
--- 298,307 ----
    T& xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return 
xelem (i, dim2()*k+j); }
    T xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { 
return xelem (i, dim2()*k+j); }
  
!   T& xelem (const Array<octave_idx_type>& ra_idx)
      { return xelem (compute_index (ra_idx)); }
  
!   T xelem (const Array<octave_idx_type>& ra_idx) const
      { return xelem (compute_index (ra_idx)); }
  
    // FIXME -- would be nice to fix this so that we don't
***************
*** 335,341 ****
        return elem (i, dim2()*k+j);
      }
  
!   T& checkelem (const Array<int>& ra_idx)
      {
        octave_idx_type i = compute_index (ra_idx);
  
--- 335,341 ----
        return elem (i, dim2()*k+j);
      }
  
!   T& checkelem (const Array<octave_idx_type>& ra_idx)
      {
        octave_idx_type i = compute_index (ra_idx);
  
***************
*** 355,373 ****
  
    T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return 
elem (i, dim2()*k+j); }
  
!   T& elem (const Array<int>& ra_idx)
      { return Array<T>::elem (compute_index (ra_idx)); }
  
  #if defined (BOUNDS_CHECKING)
    T& operator () (octave_idx_type n) { return checkelem (n); }
    T& operator () (octave_idx_type i, octave_idx_type j) { return checkelem 
(i, j); }
    T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) { 
return checkelem (i, j, k); }
!   T& operator () (const Array<int>& ra_idx) { return checkelem (ra_idx); }
  #else
    T& operator () (octave_idx_type n) { return elem (n); }
    T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j); 
}
    T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) { 
return elem (i, j, k); }
!   T& operator () (const Array<int>& ra_idx) { return elem (ra_idx); }
  #endif
  
    T checkelem (octave_idx_type n) const
--- 355,373 ----
  
    T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return 
elem (i, dim2()*k+j); }
  
!   T& elem (const Array<octave_idx_type>& ra_idx)
      { return Array<T>::elem (compute_index (ra_idx)); }
  
  #if defined (BOUNDS_CHECKING)
    T& operator () (octave_idx_type n) { return checkelem (n); }
    T& operator () (octave_idx_type i, octave_idx_type j) { return checkelem 
(i, j); }
    T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) { 
return checkelem (i, j, k); }
!   T& operator () (const Array<octave_idx_type>& ra_idx) { return checkelem 
(ra_idx); }
  #else
    T& operator () (octave_idx_type n) { return elem (n); }
    T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j); 
}
    T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) { 
return elem (i, j, k); }
!   T& operator () (const Array<octave_idx_type>& ra_idx) { return elem 
(ra_idx); }
  #endif
  
    T checkelem (octave_idx_type n) const
***************
*** 394,400 ****
        return Array<T>::elem (i, Array<T>::dim1()*k+j);
      }
  
!   T checkelem (const Array<int>& ra_idx) const
      {
        octave_idx_type i = compute_index (ra_idx);
  
--- 394,400 ----
        return Array<T>::elem (i, Array<T>::dim1()*k+j);
      }
  
!   T checkelem (const Array<octave_idx_type>& ra_idx) const
      {
        octave_idx_type i = compute_index (ra_idx);
  
***************
*** 410,428 ****
  
    T elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { 
return elem (i, dim2()*k+j); }
  
!   T elem (const Array<int>& ra_idx) const
      { return Array<T>::elem (compute_index (ra_idx)); }
  
  #if defined (BOUNDS_CHECKING)
    T operator () (octave_idx_type n) const { return checkelem (n); }
    T operator () (octave_idx_type i, octave_idx_type j) const { return 
checkelem (i, j); }
    T operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) 
const { return checkelem (i, j, k); }
!   T operator () (const Array<int>& ra_idx) const { return checkelem (ra_idx); 
}
  #else
    T operator () (octave_idx_type n) const { return elem (n); }
    T operator () (octave_idx_type i, octave_idx_type j) const { return elem 
(i, j); }
    T operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) 
const { return elem (i, j, k); }
!   T operator () (const Array<int>& ra_idx) const { return elem (ra_idx); }
  #endif
  
    Array<T> reshape (const dim_vector& new_dims) const;
--- 410,428 ----
  
    T elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { 
return elem (i, dim2()*k+j); }
  
!   T elem (const Array<octave_idx_type>& ra_idx) const
      { return Array<T>::elem (compute_index (ra_idx)); }
  
  #if defined (BOUNDS_CHECKING)
    T operator () (octave_idx_type n) const { return checkelem (n); }
    T operator () (octave_idx_type i, octave_idx_type j) const { return 
checkelem (i, j); }
    T operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) 
const { return checkelem (i, j, k); }
!   T operator () (const Array<octave_idx_type>& ra_idx) const { return 
checkelem (ra_idx); }
  #else
    T operator () (octave_idx_type n) const { return elem (n); }
    T operator () (octave_idx_type i, octave_idx_type j) const { return elem 
(i, j); }
    T operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) 
const { return elem (i, j, k); }
!   T operator () (const Array<octave_idx_type>& ra_idx) const { return elem 
(ra_idx); }
  #endif
  
    Array<T> reshape (const dim_vector& new_dims) const;
*** ./liboctave/Array.cc.orig21 2007-09-05 10:00:30.014289101 +0200
--- ./liboctave/Array.cc        2007-09-05 12:15:47.097605967 +0200
***************
*** 333,339 ****
  
  template <class T>
  T
! Array<T>::range_error (const char *fcn, const Array<int>& ra_idx) const
  {
    std::ostringstream buf;
  
--- 333,339 ----
  
  template <class T>
  T
! Array<T>::range_error (const char *fcn, const Array<octave_idx_type>& ra_idx) 
const
  {
    std::ostringstream buf;
  
***************
*** 358,364 ****
  
  template <class T>
  T&
! Array<T>::range_error (const char *fcn, const Array<int>& ra_idx)
  {
    std::ostringstream buf;
  
--- 358,364 ----
  
  template <class T>
  T&
! Array<T>::range_error (const char *fcn, const Array<octave_idx_type>& ra_idx)
  {
    std::ostringstream buf;
  
*** ./liboctave/MArrayN.h.orig21        2007-09-05 13:42:25.744766903 +0200
--- ./liboctave/MArrayN.h       2007-09-05 13:41:36.564166321 +0200
***************
*** 90,99 ****
    MArrayN<T> reshape (const dim_vector& new_dims) const
      { return ArrayN<T>::reshape (new_dims); }
  
!   MArrayN<T> permute (const Array<int>& vec, bool inv = false) const
      { return ArrayN<T>::permute (vec, inv); }
  
!   MArrayN<T> ipermute (const Array<int>& vec) const
      { return ArrayN<T>::ipermute (vec); }
  
    MArrayN squeeze (void) const { return ArrayN<T>::squeeze (); }
--- 90,100 ----
    MArrayN<T> reshape (const dim_vector& new_dims) const
      { return ArrayN<T>::reshape (new_dims); }
  
!   MArrayN<T> permute (const Array<octave_idx_type>& vec, 
!                     bool inv = false) const
      { return ArrayN<T>::permute (vec, inv); }
  
!   MArrayN<T> ipermute (const Array<octave_idx_type>& vec) const
      { return ArrayN<T>::ipermute (vec); }
  
    MArrayN squeeze (void) const { return ArrayN<T>::squeeze (); }
*** ./liboctave/ArrayN.h.orig21 2007-09-05 13:42:41.070017175 +0200
--- ./liboctave/ArrayN.h        2007-09-05 13:40:50.562443248 +0200
***************
*** 87,96 ****
    ArrayN<T> reshape (const dim_vector& new_dims) const
      { return Array<T>::reshape (new_dims); }
  
!   ArrayN<T> permute (const Array<int>& vec, bool inv = false) const
      { return Array<T>::permute (vec, inv); }
  
!   ArrayN<T> ipermute (const Array<int>& vec) const
      { return Array<T>::ipermute (vec); }
  
    void resize (const dim_vector& dv)
--- 87,96 ----
    ArrayN<T> reshape (const dim_vector& new_dims) const
      { return Array<T>::reshape (new_dims); }
  
!   ArrayN<T> permute (const Array<octave_idx_type>& vec, bool inv = false) 
const
      { return Array<T>::permute (vec, inv); }
  
!   ArrayN<T> ipermute (const Array<octave_idx_type>& vec) const
      { return Array<T>::ipermute (vec); }
  
    void resize (const dim_vector& dv)
*** ./liboctave/so-array.h.orig21       2007-09-05 13:42:56.417265446 +0200
--- ./liboctave/so-array.h      2007-09-05 13:41:58.967074605 +0200
***************
*** 82,88 ****
    boolNDArray all (int dim = -1) const;
    boolNDArray any (int dim = -1) const;
  
!   static octave_idx_type compute_index (Array<int>& ra_idx,
                            const dim_vector& dimensions);
  
    static std::streamoff resize_fill_value (void) { return 0; }
--- 82,88 ----
    boolNDArray all (int dim = -1) const;
    boolNDArray any (int dim = -1) const;
  
!   static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx,
                            const dim_vector& dimensions);
  
    static std::streamoff resize_fill_value (void) { return 0; }
*** ./liboctave/so-array.cc.orig21      2007-09-05 13:43:42.022026480 +0200
--- ./liboctave/so-array.cc     2007-09-05 13:43:28.195706078 +0200
***************
*** 97,103 ****
  }
  
  octave_idx_type
! streamoff_array::compute_index (Array<int>& ra_idx,
                                const dim_vector& dimensions)
  {
    return ::compute_index (ra_idx, dimensions);
--- 97,103 ----
  }
  
  octave_idx_type
! streamoff_array::compute_index (Array<octave_idx_type>& ra_idx,
                                const dim_vector& dimensions)
  {
    return ::compute_index (ra_idx, dimensions);
*** ./liboctave/CMatrix.cc.orig21       2007-09-05 13:53:05.476084133 +0200
--- ./liboctave/CMatrix.cc      2007-09-05 13:52:51.151800826 +0200
***************
*** 2761,2774 ****
    OCTAVE_QUIT;
  
    // construct balancing permutation vector
!   Array<int> iperm (nc);
    for (octave_idx_type i = 0; i < nc; i++)
      iperm(i) = i;  // initialize to identity permutation
  
    // leading permutations in forward order
    for (octave_idx_type i = 0; i < (ilo-1); i++)
      {
!       octave_idx_type swapidx = static_cast<int> (dpermute(i)) - 1;
        octave_idx_type tmp = iperm(i);
        iperm(i) = iperm(swapidx);
        iperm(swapidx) = tmp;
--- 2761,2774 ----
    OCTAVE_QUIT;
  
    // construct balancing permutation vector
!   Array<octave_idx_type> iperm (nc);
    for (octave_idx_type i = 0; i < nc; i++)
      iperm(i) = i;  // initialize to identity permutation
  
    // leading permutations in forward order
    for (octave_idx_type i = 0; i < (ilo-1); i++)
      {
!       octave_idx_type swapidx = static_cast<octave_idx_type> (dpermute(i)) - 
1;
        octave_idx_type tmp = iperm(i);
        iperm(i) = iperm(swapidx);
        iperm(swapidx) = tmp;
***************
*** 2777,2790 ****
    // trailing permutations must be done in reverse order
    for (octave_idx_type i = nc - 1; i >= ihi; i--)
      {
!       octave_idx_type swapidx = static_cast<int> (dpermute(i)) - 1;
        octave_idx_type tmp = iperm(i);
        iperm(i) = iperm(swapidx);
        iperm(swapidx) = tmp;
      }
  
    // construct inverse balancing permutation vector
!   Array<int> invpvec (nc);
    for (octave_idx_type i = 0; i < nc; i++)
      invpvec(iperm(i)) = i;     // Thanks to R. A. Lippert for this method
  
--- 2777,2790 ----
    // trailing permutations must be done in reverse order
    for (octave_idx_type i = nc - 1; i >= ihi; i--)
      {
!       octave_idx_type swapidx = static_cast<octave_idx_type> (dpermute(i)) - 
1;
        octave_idx_type tmp = iperm(i);
        iperm(i) = iperm(swapidx);
        iperm(swapidx) = tmp;
      }
  
    // construct inverse balancing permutation vector
!   Array<octave_idx_type> invpvec (nc);
    for (octave_idx_type i = 0; i < nc; i++)
      invpvec(iperm(i)) = i;     // Thanks to R. A. Lippert for this method
  
*** ./src/ov.cc.orig21  2007-09-05 09:56:28.188757529 +0200
--- ./src/ov.cc 2007-09-05 10:01:27.267748732 +0200
***************
*** 1403,1409 ****
  
  octave_value
  do_cat_op (const octave_value& v1, const octave_value& v2, 
!          const Array<int>& ra_idx)
  {
    octave_value retval;
  
--- 1403,1409 ----
  
  octave_value
  do_cat_op (const octave_value& v1, const octave_value& v2, 
!          const Array<octave_idx_type>& ra_idx)
  {
    octave_value retval;
  
*** ./src/data.cc.orig21        2007-09-05 09:55:44.548161480 +0200
--- ./src/data.cc       2007-09-05 09:55:54.875597576 +0200
***************
*** 759,765 ****
              if (error_state)
                return retval;
  
!             Array<int> ra_idx (dv.length (), 0);
  
              for (int j = i; j < n_args; j++)
                {
--- 759,765 ----
              if (error_state)
                return retval;
  
!             Array<octave_idx_type> ra_idx (dv.length (), 0);
  
              for (int j = i; j < n_args; j++)
                {
*** ./src/ov.h.orig21   2007-09-05 09:56:17.260364551 +0200
--- ./src/ov.h  2007-09-05 09:56:43.772886525 +0200
***************
*** 796,802 ****
  
    friend OCTINTERP_API octave_value do_cat_op (const octave_value& a,
                                 const octave_value& b,
!                                const Array<int>& ra_idx);
  
    const octave_base_value& get_rep (void) const { return *rep; }
  
--- 796,802 ----
  
    friend OCTINTERP_API octave_value do_cat_op (const octave_value& a,
                                 const octave_value& b,
!                                const Array<octave_idx_type>& ra_idx);
  
    const octave_base_value& get_rep (void) const { return *rep; }
  
*** ./src/pt-mat.cc.orig21      2007-09-05 09:57:48.567204843 +0200
--- ./src/pt-mat.cc     2007-09-05 09:57:31.524181913 +0200
***************
*** 910,916 ****
              // insert them in the result matrix.
  
              int dv_len = dv.length ();
!             Array<int> ra_idx (dv_len > 1 ? dv_len : 2, 0);
  
              for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
                {
--- 910,916 ----
              // insert them in the result matrix.
  
              int dv_len = dv.length ();
!             Array<octave_idx_type> ra_idx (dv_len > 1 ? dv_len : 2, 0);
  
              for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
                {
2007-09-05  David Bateman  <address@hidden>

        * Array.h (range_error, xelem, checkelem, elem, operator ()):
        Modify use of Array<int> to Array<octave_idx_type> and adjust
        where necessary.
        * Array.cc (range_error): ditto.
        * MArrayN.h (permute, ipermute): ditto.
        * ArrayN.h (permute, ipermute): ditto.
        * so-array.cc (streamoff_array::compute_index): ditto.
        * so-array.h (compute_index): ditto.
        * CMattrix.cc (ComplexMatrix::exmpm): ditto.
        
2007-09-05  David Bateman  <address@hidden>

        * ov.cc (do_cat_op): Modify use of Array<int> to 
        Array<octave_idx_type> and adjust where necessary.
        * ov.h (do_cat_op): ditto.
        * data.cc (do_cat): ditto.
        * pt-mat.cc (tree_matrix::rvalue): ditto.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]