Mercurial > hg > octave-terminal
changeset 10352:a3635bc1ea19
remove Array2
line wrap: on
line diff
--- a/liboctave/Array-C.cc +++ b/liboctave/Array-C.cc @@ -92,10 +92,6 @@ INSTANTIATE_ARRAY (Complex, OCTAVE_API); -#include "Array2.h" - -template class OCTAVE_API Array2<Complex>; - template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<Complex>&); #include "DiagArray2.h"
--- a/liboctave/Array-b.cc +++ b/liboctave/Array-b.cc @@ -108,10 +108,6 @@ INSTANTIATE_ARRAY (bool, OCTAVE_API); -#include "Array2.h" - -template class OCTAVE_API Array2<bool>; - template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<bool>&); #include "DiagArray2.h"
--- a/liboctave/Array-ch.cc +++ b/liboctave/Array-ch.cc @@ -35,10 +35,6 @@ INSTANTIATE_ARRAY (char, OCTAVE_API); -#include "Array2.h" - -template class OCTAVE_API Array2<char>; - template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<char>&); #include "DiagArray2.h"
--- a/liboctave/Array-d.cc +++ b/liboctave/Array-d.cc @@ -159,10 +159,6 @@ INSTANTIATE_ARRAY (double, OCTAVE_API); -#include "Array2.h" - -template class OCTAVE_API Array2<double>; - template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<double>&); #include "DiagArray2.h"
--- a/liboctave/Array-f.cc +++ b/liboctave/Array-f.cc @@ -159,10 +159,6 @@ INSTANTIATE_ARRAY (float, OCTAVE_API); -#include "Array2.h" - -template class OCTAVE_API Array2<float>; - template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<float>&); #include "DiagArray2.h"
--- a/liboctave/Array-fC.cc +++ b/liboctave/Array-fC.cc @@ -93,10 +93,6 @@ INSTANTIATE_ARRAY (FloatComplex, OCTAVE_API); -#include "Array2.h" - -template class OCTAVE_API Array2<FloatComplex>; - template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<FloatComplex>&); #include "DiagArray2.h"
--- a/liboctave/Array-i.cc +++ b/liboctave/Array-i.cc @@ -68,10 +68,6 @@ INSTANTIATE_ARRAY (octave_uint32, OCTAVE_API); INSTANTIATE_ARRAY (octave_uint64, OCTAVE_API); -#include "Array2.h" - -template class OCTAVE_API Array2<int>; - #include "DiagArray2.h" #include "DiagArray2.cc"
--- a/liboctave/Array-s.cc +++ b/liboctave/Array-s.cc @@ -38,10 +38,6 @@ INSTANTIATE_ARRAY (short, OCTAVE_API); -#include "Array2.h" - -template class Array2<short>; - #include "DiagArray2.h" #include "DiagArray2.cc"
--- a/liboctave/Array-voidp.cc +++ b/liboctave/Array-voidp.cc @@ -35,10 +35,6 @@ INSTANTIATE_ARRAY (void *, OCTAVE_API); -#include "Array2.h" - -template class OCTAVE_API Array2<void *>; - #include "Array3.h" template class OCTAVE_API Array3<void *>;
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -51,10 +51,31 @@ : rep (a.rep), dimensions (dv), slice_data (a.slice_data), slice_len (a.slice_len) { - if (dv.numel () != a.numel ()) + if (dimensions.safe_numel () != a.numel ()) { - std::string dimensions_str = dimensions.str (); - std::string new_dims_str = dv.str (); + std::string dimensions_str = a.dimensions.str (); + std::string new_dims_str = dimensions.str (); + + (*current_liboctave_error_handler) + ("reshape: can't reshape %s array to %s array", + dimensions_str.c_str (), new_dims_str.c_str ()); + } + + // This goes here because if an exception is thrown by the above, + // destructor will be never called. + rep->count++; + dimensions.chop_trailing_singletons (); +} + +template <class T> +Array<T>::Array (const Array<T>& a, octave_idx_type nr, octave_idx_type nc) + : rep (a.rep), dimensions (nr, nc), + slice_data (a.slice_data), slice_len (a.slice_len) +{ + if (dimensions.safe_numel () != a.numel ()) + { + std::string dimensions_str = a.dimensions.str (); + std::string new_dims_str = dimensions.str (); (*current_liboctave_error_handler) ("reshape: can't reshape %s array to %s array",
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -244,6 +244,8 @@ // Reshape constructor. Array (const Array<T>& a, const dim_vector& dv); + Array (const Array<T>& a, octave_idx_type nr, octave_idx_type nc); + // Type conversion case. template <class U> Array (const Array<U>& a) @@ -513,6 +515,9 @@ // Must be 0 <= lo && up <= numel. May be up < lo. Array<T> linear_slice (octave_idx_type lo, octave_idx_type up) const; + Array<T> reshape (octave_idx_type nr, octave_idx_type nc) const + { return Array<T> (*this, nr, nc); } + Array<T> reshape (const dim_vector& new_dims) const { return Array<T> (*this, new_dims); }
--- a/liboctave/Array2.h +++ b/liboctave/Array2.h @@ -25,137 +25,12 @@ #if !defined (octave_Array2_h) #define octave_Array2_h 1 -#include <cassert> -#include <climits> -#include <cstdlib> - #include "Array.h" -#include "lo-error.h" -#include "lo-math.h" - -class idx_vector; - -// Two dimensional array class. - -template <class T> -class -Array2 : public Array<T> -{ -protected: - - Array2 (T *d, octave_idx_type r, octave_idx_type c) : Array<T> (d, dim_vector (r, c)) { } - -public: - - Array2 (void) : Array<T> (dim_vector (0, 0)) { } - - Array2 (octave_idx_type r, octave_idx_type c) : Array<T> (dim_vector (r, c)) { } - - Array2 (octave_idx_type r, octave_idx_type c, const T& val) - : Array<T> (dim_vector (r, c), val) { } - - Array2 (const dim_vector& dv) : Array<T> (dv) - { - if (dv.length () != 2) - (*current_liboctave_error_handler) ("too many dimensions"); - } - - Array2 (const dim_vector& dv, const T& val) : Array<T> (dv) - { - if (dv.length () != 2) - (*current_liboctave_error_handler) ("too many dimensions"); - else - Array<T>::fill (val); - } - - Array2 (const Array2<T>& a) : Array<T> (a, a.dims ()) { } - - Array2 (const Array<T>& a, octave_idx_type r, octave_idx_type c) - : Array<T> (a, dim_vector (r, c)) { } - - template <class U> - Array2 (const Array<U>& a) : Array<T> (a) { } - - template <class U> - Array2 (const Array<U>& a, const dim_vector& dv) - : Array<T> (a, dv) { } - - ~Array2 (void) { } - - Array2<T>& operator = (const Array2<T>& a) - { - if (this != &a) - Array<T>::operator = (a); - - return *this; - } +#define Array2 Array - void resize (octave_idx_type r, octave_idx_type c) - { Array<T>::resize (r, c, Array<T>::resize_fill_value ()); } - - void resize (octave_idx_type r, octave_idx_type c, const T& val) - { Array<T>::resize (r, c, val); } - - Array2<T>& insert (const Array2<T>& a, octave_idx_type r, octave_idx_type c) - { - Array<T>::insert (a, r, c); - return *this; - } - - Array2<T> transpose (void) const - { - Array<T> tmp = Array<T>::transpose (); - return Array2<T> (tmp, tmp.rows (), tmp.columns ()); - } - - Array2<T> hermitian (T (*fcn) (const T&) = 0) const - { - Array<T> tmp = Array<T>::hermitian (fcn); - return Array2<T> (tmp, tmp.rows (), tmp.columns ()); - } - - Array2<T> index (const idx_vector& i, bool resize_ok = false, - const T& rfv = Array<T>::resize_fill_value ()) const - { - Array<T> tmp = Array<T>::index (i, resize_ok, rfv); - return Array2<T> (tmp, tmp.rows (), tmp.columns ()); - } - - Array2<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok = false, - const T& rfv = Array<T>::resize_fill_value ()) const - { - Array<T> tmp = Array<T>::index (i, j, resize_ok, rfv); - return Array2<T> (tmp, tmp.rows (), tmp.columns ()); - } - - Array2<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const - { - Array<T> tmp = Array<T>::sort (dim, mode); - return Array2<T> (tmp, tmp.rows (), tmp.columns ()); - } - - Array2<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, - sortmode mode = ASCENDING) const - { - Array<T> tmp = Array<T>::sort (sidx, dim, mode); - return Array2<T> (tmp, tmp.rows (), tmp.columns ()); - } - - Array2<T> diag (octave_idx_type k) const - { - return Array<T>::diag (k); - } - - // FIXME: should go away. - template <class U> - Array2<U> - map (U (&fcn) (T)) const - { return Array<T>::template map<U> (fcn); } - - template <class U> - Array2<U> - map (U (&fcn) (const T&)) const - { return Array<T>::template map<U> (fcn); } -}; +// If we're with GNU C++, issue a warning. +#ifdef __GNUC__ +#warning Using Array2<T> is deprecated. Use Array<T> directly. +#endif #endif
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -2394,7 +2394,8 @@ { ComplexMatrix tmp (b); - return solve (typ, tmp, info, rcon, sing_handler, transt).column(static_cast<octave_idx_type> (0)); + tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt); + return tmp.column(static_cast<octave_idx_type> (0)); } ComplexMatrix
--- a/liboctave/CMatrix.h +++ b/liboctave/CMatrix.h @@ -24,7 +24,6 @@ #if !defined (octave_ComplexMatrix_h) #define octave_ComplexMatrix_h 1 -#include "Array2.h" #include "MArray.h" #include "MDiagArray2.h" #include "MatrixType.h" @@ -63,9 +62,6 @@ ComplexMatrix (const MArray<U>& a) : MArray<Complex> (a.as_matrix ()) { } template <class U> - ComplexMatrix (const Array2<U>& a) : MArray<Complex> (a) { } - - template <class U> ComplexMatrix (const Array<U>& a) : MArray<Complex> (a.as_matrix ()) { } ComplexMatrix (const Matrix& re, const Matrix& im);
--- a/liboctave/CNDArray.cc +++ b/liboctave/CNDArray.cc @@ -847,7 +847,7 @@ ComplexMatrix retval; if (ndims () == 2) - retval = ComplexMatrix (Array2<Complex> (*this)); + retval = ComplexMatrix (Array<Complex> (*this)); else (*current_liboctave_error_handler) ("invalid conversion of ComplexNDArray to ComplexMatrix");
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,45 @@ +2010-02-24 Jaroslav Hajek <highegg@gmail.com> + + * Array.cc (Array::Array (const Array&, octave_idx_type, + octave_idx_type): New ctor. + (Array::reshape (octave_idx_type, octave_idx_type): New method. + * Array.h: Declare them. + * Array2.h: Deprecate Array2, make it a #define for Array. + + * Array-C.cc: Remove Array2 instantiation. + * Array-b.cc: Ditto. + * Array-ch.cc: Ditto. + * Array-d.cc: Ditto. + * Array-f.cc: Ditto. + * Array-fC.cc: Ditto. + * Array-i.cc: Ditto. + * Array-s.cc: Ditto. + * Array-voidp.cc: Ditto. + + * CMatrix.cc: Use Array instead of Array2 everywhere. + * CMatrix.h: Ditto. + * CNDArray.cc: Ditto. + * DiagArray2.cc: Ditto. + * DiagArray2.h: Ditto. + * MDiagArray2.h: Ditto. + * Sparse.cc: Ditto. + * Sparse.h: Ditto. + * boolMatrix.h: Ditto. + * boolNDArray.cc: Ditto. + * chMatrix.h: Ditto. + * chNDArray.cc: Ditto. + * dMatrix.cc: Ditto. + * dMatrix.h: Ditto. + * dNDArray.cc: Ditto. + * fCMatrix.cc: Ditto. + * fCMatrix.h: Ditto. + * fCNDArray.cc: Ditto. + * fMatrix.cc: Ditto. + * fMatrix.h: Ditto. + * fNDArray.cc: Ditto. + * lo-specfun.cc: Ditto. + * lo-specfun.h: Ditto. + 2010-02-23 Jaroslav Hajek <highegg@gmail.com> * chMatrix.h (charMatrix): Base on Array<char>.
--- a/liboctave/DiagArray2.cc +++ b/liboctave/DiagArray2.cc @@ -152,9 +152,9 @@ } template <class T> -DiagArray2<T>::operator Array2<T> (void) const +DiagArray2<T>::operator Array<T> (void) const { - Array2<T> result (dim1 (), dim2 ()); + Array<T> result (dim1 (), dim2 ()); for (octave_idx_type i = 0, len = length (); i < len; i++) result.xelem (i, i) = dgelem (i);
--- a/liboctave/DiagArray2.h +++ b/liboctave/DiagArray2.h @@ -30,7 +30,6 @@ #include <cstdlib> #include "Array.h" -#include "Array2.h" #include "lo-error.h" // A two-dimensional array with diagonal elements only. @@ -219,7 +218,7 @@ DiagArray2<T> transpose (void) const; DiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const; - operator Array2<T> (void) const; + operator Array<T> (void) const; const T *data (void) const { return Array<T>::data (); }
--- a/liboctave/MDiagArray2.h +++ b/liboctave/MDiagArray2.h @@ -73,7 +73,7 @@ operator MArray<T> () const { - return DiagArray2<T>::operator Array2<T> (); + return DiagArray2<T>::operator Array<T> (); } octave_idx_type nnz (void) const
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -549,36 +549,6 @@ } template <class T> -Sparse<T>::Sparse (const Array2<T>& a) - : dimensions (a.dims ()), idx (0), idx_count (0) -{ - octave_idx_type nr = rows (); - octave_idx_type nc = cols (); - octave_idx_type len = a.length (); - octave_idx_type new_nzmx = 0; - - // First count the number of non-zero terms - for (octave_idx_type i = 0; i < len; i++) - if (a(i) != T ()) - new_nzmx++; - - rep = new typename Sparse<T>::SparseRep (nr, nc, new_nzmx); - - octave_idx_type ii = 0; - xcidx(0) = 0; - for (octave_idx_type j = 0; j < nc; j++) - { - for (octave_idx_type i = 0; i < nr; i++) - if (a.elem (i,j) != T ()) - { - xdata(ii) = a.elem (i,j); - xridx(ii++) = i; - } - xcidx(j+1) = ii; - } -} - -template <class T> Sparse<T>::Sparse (const Array<T>& a) : dimensions (a.dims ()), idx (0), idx_count (0) {
--- a/liboctave/Sparse.h +++ b/liboctave/Sparse.h @@ -31,7 +31,6 @@ #include <iosfwd> #include "Array.h" -#include "Array2.h" #include "dim-vector.h" #include "lo-error.h" #include "lo-utils.h" @@ -224,7 +223,6 @@ octave_idx_type nr, octave_idx_type nc, bool sum_terms); // Sparsify a normal matrix - Sparse (const Array2<T>& a); Sparse (const Array<T>& a); virtual ~Sparse (void);
--- a/liboctave/boolMatrix.h +++ b/liboctave/boolMatrix.h @@ -40,7 +40,7 @@ boolMatrix (octave_idx_type r, octave_idx_type c, bool val) : Array<bool> (r, c, val) { } boolMatrix (const dim_vector& dv) : Array<bool> (dv) { } boolMatrix (const dim_vector& dv, bool val) : Array<bool> (dv, val) { } - boolMatrix (const Array<bool>& a) : Array<bool> (a) { } + boolMatrix (const Array<bool>& a) : Array<bool> (a.as_matrix ()) { } boolMatrix (const boolMatrix& a) : Array<bool> (a) { } boolMatrix& operator = (const boolMatrix& a)
--- a/liboctave/boolNDArray.cc +++ b/liboctave/boolNDArray.cc @@ -111,28 +111,7 @@ boolMatrix boolNDArray::matrix_value (void) const { - boolMatrix retval; - - int nd = ndims (); - - switch (nd) - { - case 1: - retval = boolMatrix (Array2<bool> (*this, dimensions(0), 1)); - break; - - case 2: - retval = boolMatrix (Array2<bool> (*this, dimensions(0), - dimensions(1))); - break; - - default: - (*current_liboctave_error_handler) - ("invalid conversion of boolNDArray to boolMatrix"); - break; - } - - return retval; + return *this; } void
--- a/liboctave/chMatrix.h +++ b/liboctave/chMatrix.h @@ -45,7 +45,7 @@ charMatrix (octave_idx_type r, octave_idx_type c, char val) : Array<char> (r, c, val) { } charMatrix (const dim_vector& dv) : Array<char> (dv) { } charMatrix (const dim_vector& dv, char val) : Array<char> (dv, val) { } - charMatrix (const Array<char>& a) : Array<char> (a) { } + charMatrix (const Array<char>& a) : Array<char> (a.as_matrix ()) { } charMatrix (const charMatrix& a) : Array<char> (a) { } charMatrix (char c); charMatrix (const char *s);
--- a/liboctave/chNDArray.cc +++ b/liboctave/chNDArray.cc @@ -109,28 +109,7 @@ charMatrix charNDArray::matrix_value (void) const { - charMatrix retval; - - int nd = ndims (); - - switch (nd) - { - case 1: - retval = charMatrix (Array2<char> (*this, dimensions(0), 1)); - break; - - case 2: - retval = charMatrix (Array2<char> (*this, dimensions(0), - dimensions(1))); - break; - - default: - (*current_liboctave_error_handler) - ("invalid conversion of charNDArray to charMatrix"); - break; - } - - return retval; + return *this; } void
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -2050,7 +2050,8 @@ double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const { Matrix tmp (b); - return solve (typ, tmp, info, rcon, sing_handler, transt).column(static_cast<octave_idx_type> (0)); + tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt); + return tmp.column(static_cast<octave_idx_type> (0)); } ComplexColumnVector
--- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -25,7 +25,6 @@ #define octave_Matrix_int_h 1 #include "MArray.h" -#include "Array2.h" #include "MDiagArray2.h" #include "MatrixType.h" @@ -60,9 +59,6 @@ Matrix (const MArray<U>& a) : MArray<double> (a.as_matrix ()) { } template <class U> - Matrix (const Array2<U>& a) : MArray<double> (a) { } - - template <class U> Matrix (const Array<U>& a) : MArray<double> (a.as_matrix ()) { } explicit Matrix (const RowVector& rv);
--- a/liboctave/dNDArray.cc +++ b/liboctave/dNDArray.cc @@ -914,7 +914,7 @@ Matrix retval; if (ndims () == 2) - retval = Matrix (Array2<double> (*this)); + retval = Matrix (Array<double> (*this)); else (*current_liboctave_error_handler) ("invalid conversion of NDArray to Matrix");
--- a/liboctave/fCMatrix.cc +++ b/liboctave/fCMatrix.cc @@ -2387,7 +2387,8 @@ { FloatComplexMatrix tmp (b); - return solve (typ, tmp, info, rcon, sing_handler, transt).column(static_cast<octave_idx_type> (0)); + tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt); + return tmp.column(static_cast<octave_idx_type> (0)); } FloatComplexMatrix
--- a/liboctave/fCMatrix.h +++ b/liboctave/fCMatrix.h @@ -62,9 +62,6 @@ FloatComplexMatrix (const MArray<U>& a) : MArray<FloatComplex> (a.as_matrix ()) { } template <class U> - FloatComplexMatrix (const Array2<U>& a) : MArray<FloatComplex> (a) { } - - template <class U> FloatComplexMatrix (const Array<U>& a) : MArray<FloatComplex> (a.as_matrix ()) { } explicit FloatComplexMatrix (const FloatMatrix& a);
--- a/liboctave/fCNDArray.cc +++ b/liboctave/fCNDArray.cc @@ -842,7 +842,7 @@ FloatComplexMatrix retval; if (ndims () == 2) - retval = FloatComplexMatrix (Array2<FloatComplex> (*this)); + retval = FloatComplexMatrix (Array<FloatComplex> (*this)); else (*current_liboctave_error_handler) ("invalid conversion of FloatComplexNDArray to FloatComplexMatrix");
--- a/liboctave/fMatrix.cc +++ b/liboctave/fMatrix.cc @@ -2049,7 +2049,8 @@ float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const { FloatMatrix tmp (b); - return solve (typ, tmp, info, rcon, sing_handler, transt).column(static_cast<octave_idx_type> (0)); + tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt); + return tmp.column(static_cast<octave_idx_type> (0)); } FloatComplexColumnVector
--- a/liboctave/fMatrix.h +++ b/liboctave/fMatrix.h @@ -24,7 +24,6 @@ #if !defined (octave_FloatMatrix_int_h) #define octave_FloatMatrix_int_h 1 -#include "Array2.h" #include "MArray.h" #include "MDiagArray2.h" #include "MatrixType.h" @@ -60,9 +59,6 @@ FloatMatrix (const MArray<U>& a) : MArray<float> (a.as_matrix ()) { } template <class U> - FloatMatrix (const Array2<U>& a) : MArray<float> (a) { } - - template <class U> FloatMatrix (const Array<U>& a) : MArray<float> (a.as_matrix ()) { } explicit FloatMatrix (const FloatRowVector& rv);
--- a/liboctave/fNDArray.cc +++ b/liboctave/fNDArray.cc @@ -872,7 +872,7 @@ FloatMatrix retval; if (ndims () == 2) - retval = FloatMatrix (Array2<float> (*this)); + retval = FloatMatrix (Array<float> (*this)); else (*current_liboctave_error_handler) ("invalid conversion of FloatNDArray to FloatMatrix");
--- a/liboctave/lo-specfun.cc +++ b/liboctave/lo-specfun.cc @@ -999,7 +999,7 @@ static inline ComplexMatrix do_bessel (dptr f, const char *, double alpha, const ComplexMatrix& x, - bool scaled, Array2<octave_idx_type>& ierr) + bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = x.rows (); octave_idx_type nc = x.cols (); @@ -1017,7 +1017,7 @@ static inline ComplexMatrix do_bessel (dptr f, const char *, const Matrix& alpha, const Complex& x, - bool scaled, Array2<octave_idx_type>& ierr) + bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = alpha.rows (); octave_idx_type nc = alpha.cols (); @@ -1035,7 +1035,7 @@ static inline ComplexMatrix do_bessel (dptr f, const char *fn, const Matrix& alpha, - const ComplexMatrix& x, bool scaled, Array2<octave_idx_type>& ierr) + const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { ComplexMatrix retval; @@ -1123,7 +1123,7 @@ static inline ComplexMatrix do_bessel (dptr f, const char *, const RowVector& alpha, - const ComplexColumnVector& x, bool scaled, Array2<octave_idx_type>& ierr) + const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = x.length (); octave_idx_type nc = alpha.length (); @@ -1149,7 +1149,7 @@ #define SM_BESSEL(name, fcn) \ ComplexMatrix \ name (double alpha, const ComplexMatrix& x, bool scaled, \ - Array2<octave_idx_type>& ierr) \ + Array<octave_idx_type>& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -1157,7 +1157,7 @@ #define MS_BESSEL(name, fcn) \ ComplexMatrix \ name (const Matrix& alpha, const Complex& x, bool scaled, \ - Array2<octave_idx_type>& ierr) \ + Array<octave_idx_type>& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -1165,7 +1165,7 @@ #define MM_BESSEL(name, fcn) \ ComplexMatrix \ name (const Matrix& alpha, const ComplexMatrix& x, bool scaled, \ - Array2<octave_idx_type>& ierr) \ + Array<octave_idx_type>& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -1197,7 +1197,7 @@ #define RC_BESSEL(name, fcn) \ ComplexMatrix \ name (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, \ - Array2<octave_idx_type>& ierr) \ + Array<octave_idx_type>& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -1596,7 +1596,7 @@ static inline FloatComplexMatrix do_bessel (fptr f, const char *, float alpha, const FloatComplexMatrix& x, - bool scaled, Array2<octave_idx_type>& ierr) + bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = x.rows (); octave_idx_type nc = x.cols (); @@ -1614,7 +1614,7 @@ static inline FloatComplexMatrix do_bessel (fptr f, const char *, const FloatMatrix& alpha, const FloatComplex& x, - bool scaled, Array2<octave_idx_type>& ierr) + bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = alpha.rows (); octave_idx_type nc = alpha.cols (); @@ -1632,7 +1632,7 @@ static inline FloatComplexMatrix do_bessel (fptr f, const char *fn, const FloatMatrix& alpha, - const FloatComplexMatrix& x, bool scaled, Array2<octave_idx_type>& ierr) + const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { FloatComplexMatrix retval; @@ -1720,7 +1720,7 @@ static inline FloatComplexMatrix do_bessel (fptr f, const char *, const FloatRowVector& alpha, - const FloatComplexColumnVector& x, bool scaled, Array2<octave_idx_type>& ierr) + const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = x.length (); octave_idx_type nc = alpha.length (); @@ -1746,7 +1746,7 @@ #define SM_BESSEL(name, fcn) \ FloatComplexMatrix \ name (float alpha, const FloatComplexMatrix& x, bool scaled, \ - Array2<octave_idx_type>& ierr) \ + Array<octave_idx_type>& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -1754,7 +1754,7 @@ #define MS_BESSEL(name, fcn) \ FloatComplexMatrix \ name (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, \ - Array2<octave_idx_type>& ierr) \ + Array<octave_idx_type>& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -1762,7 +1762,7 @@ #define MM_BESSEL(name, fcn) \ FloatComplexMatrix \ name (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, \ - Array2<octave_idx_type>& ierr) \ + Array<octave_idx_type>& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -1794,7 +1794,7 @@ #define RC_BESSEL(name, fcn) \ FloatComplexMatrix \ name (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, \ - Array2<octave_idx_type>& ierr) \ + Array<octave_idx_type>& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -1893,7 +1893,7 @@ } ComplexMatrix -airy (const ComplexMatrix& z, bool deriv, bool scaled, Array2<octave_idx_type>& ierr) +airy (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = z.rows (); octave_idx_type nc = z.cols (); @@ -1910,7 +1910,7 @@ } ComplexMatrix -biry (const ComplexMatrix& z, bool deriv, bool scaled, Array2<octave_idx_type>& ierr) +biry (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = z.rows (); octave_idx_type nc = z.cols (); @@ -2023,7 +2023,7 @@ } FloatComplexMatrix -airy (const FloatComplexMatrix& z, bool deriv, bool scaled, Array2<octave_idx_type>& ierr) +airy (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = z.rows (); octave_idx_type nc = z.cols (); @@ -2040,7 +2040,7 @@ } FloatComplexMatrix -biry (const FloatComplexMatrix& z, bool deriv, bool scaled, Array2<octave_idx_type>& ierr) +biry (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = z.rows (); octave_idx_type nc = z.cols ();
--- a/liboctave/lo-specfun.h +++ b/liboctave/lo-specfun.h @@ -27,7 +27,6 @@ #include "oct-cmplx.h" #include "Array.h" -template <class T> class Array2; class Matrix; class ComplexMatrix; class NDArray; @@ -130,75 +129,75 @@ extern OCTAVE_API ComplexMatrix besselj (double alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix bessely (double alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besseli (double alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselk (double alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselh1 (double alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselh2 (double alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselj (const Matrix& alpha, const Complex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix bessely (const Matrix& alpha, const Complex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besseli (const Matrix& alpha, const Complex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselk (const Matrix& alpha, const Complex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselh1 (const Matrix& alpha, const Complex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselh2 (const Matrix& alpha, const Complex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselj (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix bessely (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besseli (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselk (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselh1 (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselh2 (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexNDArray besselj (double alpha, const ComplexNDArray& x, bool scaled, @@ -274,27 +273,27 @@ extern OCTAVE_API ComplexMatrix besselj (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix bessely (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besseli (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselk (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselh1 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix besselh2 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplex besselj (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& ierr); @@ -316,75 +315,75 @@ extern OCTAVE_API FloatComplexMatrix besselj (float alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix bessely (float alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besseli (float alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselk (float alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselh1 (float alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselh2 (float alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselj (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix bessely (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besseli (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselk (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselh1 (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselh2 (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselj (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix bessely (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besseli (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselk (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselh1 (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselh2 (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexNDArray besselj (float alpha, const FloatComplexNDArray& x, bool scaled, @@ -460,36 +459,36 @@ extern OCTAVE_API FloatComplexMatrix besselj (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix bessely (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besseli (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselk (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselh1 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix besselh2 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array2<octave_idx_type>& ierr); + Array<octave_idx_type>& ierr); extern OCTAVE_API Complex airy (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); extern OCTAVE_API Complex biry (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); extern OCTAVE_API ComplexMatrix -airy (const ComplexMatrix& z, bool deriv, bool scaled, Array2<octave_idx_type>& ierr); +airy (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix -biry (const ComplexMatrix& z, bool deriv, bool scaled, Array2<octave_idx_type>& ierr); +biry (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexNDArray airy (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); @@ -501,10 +500,10 @@ extern OCTAVE_API FloatComplex biry (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr); extern OCTAVE_API FloatComplexMatrix -airy (const FloatComplexMatrix& z, bool deriv, bool scaled, Array2<octave_idx_type>& ierr); +airy (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix -biry (const FloatComplexMatrix& z, bool deriv, bool scaled, Array2<octave_idx_type>& ierr); +biry (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexNDArray airy (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr);
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2010-02-24 Jaroslav Hajek <highegg@gmail.com> + + * TEMPLATE-INST/Array-tc.cc: Remove Array2 instantiation. + * DLD-FUNCTIONS/besselj.cc: Use Array instead of Array2. + * DLD-FUNCTIONS/tril.cc: Ditto. + * data.cc: Ditto. + * ov-typeinfo.cc: Ditto. + * ov-typeinfo.h: Ditto. + * pr-output.cc: Ditto. + 2010-02-23 Jaroslav Hajek <highegg@gmail.com> * ov-bool-mat.h (octave_bool_matrix::octave_bool_matrix (const
--- a/src/DLD-FUNCTIONS/besselj.cc +++ b/src/DLD-FUNCTIONS/besselj.cc @@ -169,7 +169,7 @@ if (! error_state) { - Array2<octave_idx_type> ierr; + Array<octave_idx_type> ierr; octave_value result; DO_BESSEL (type, ralpha, cx, scaled, ierr, result); @@ -304,7 +304,7 @@ if (! error_state) { - Array2<octave_idx_type> ierr; + Array<octave_idx_type> ierr; octave_value result; DO_BESSEL (type, ralpha, cx, scaled, ierr, result);
--- a/src/DLD-FUNCTIONS/tril.cc +++ b/src/DLD-FUNCTIONS/tril.cc @@ -49,7 +49,7 @@ octave_idx_type j1 = std::min (std::max (zero, k), nc); octave_idx_type j2 = std::min (std::max (zero, nr + k), nc); octave_idx_type n = j1 * nr + ((j2 - j1) * (nr-(j1-k) + nr-(j2-1-k))) / 2; - Array<T> r (n); + Array<T> r (n, 1); T *rvec = r.fortran_vec (); for (octave_idx_type j = 0; j < nc; j++) { @@ -90,7 +90,7 @@ octave_idx_type j1 = std::min (std::max (zero, k), nc); octave_idx_type j2 = std::min (std::max (zero, nr + k), nc); octave_idx_type n = ((j2 - j1) * ((j1+1-k) + (j2-k))) / 2 + (nc - j2) * nr; - Array<T> r (n); + Array<T> r (n, 1); T *rvec = r.fortran_vec (); for (octave_idx_type j = 0; j < nc; j++) {
--- a/src/TEMPLATE-INST/Array-tc.cc +++ b/src/TEMPLATE-INST/Array-tc.cc @@ -30,8 +30,6 @@ #include "Array.h" #include "Array.cc" -#include "Array2.h" - #include "ov.h" #include "oct-sort.cc" @@ -39,5 +37,3 @@ NO_INSTANTIATE_ARRAY_SORT (octave_value); INSTANTIATE_ARRAY (octave_value, OCTINTERP_API); - -template class OCTINTERP_API Array2<octave_value>;
--- a/src/data.cc +++ b/src/data.cc @@ -4891,46 +4891,21 @@ return retval; } - // Remove trailing singletons in new_size, but leave at least 2 - // elements. - - int n = new_size.length (); - - while (n > 2) + dim_vector new_dims = dim_vector::alloc (new_size.length ()); + + for (octave_idx_type i = 0; i < new_size.length (); i++) { - if (new_size(n-1) == 1) - n--; + if (new_size(i) < 0) + { + error ("reshape: size must be nonnegative"); + break; + } else - break; - } - - if (n < 2) - { - error ("reshape: expecting size to be vector with at least 2 elements"); - return retval; + new_dims(i) = new_size(i); } - dim_vector new_dims; - - new_dims.resize (n); - - for (octave_idx_type i = 0; i < n; i++) - new_dims(i) = new_size(i); - - octave_value arg = args(0); - - dim_vector dims = arg.dims (); - - if (new_dims.numel () == dims.numel ()) - retval = (new_dims == dims) ? arg : arg.reshape (new_dims); - else - { - std::string dims_str = dims.str (); - std::string new_dims_str = new_dims.str (); - - error ("reshape: can't reshape %s array to %s array", - dims_str.c_str (), new_dims_str.c_str ()); - } + if (! error_state) + retval = args(0).reshape (new_dims); return retval; }
--- a/src/ov-typeinfo.cc +++ b/src/ov-typeinfo.cc @@ -37,7 +37,6 @@ octave_value_typeinfo::instance (0); #include <Array.h> -#include <Array2.h> #include <Array3.h> bool
--- a/src/ov-typeinfo.h +++ b/src/ov-typeinfo.h @@ -27,7 +27,6 @@ #include <string> #include "Array.h" -#include "Array2.h" #include "Array3.h" #include "ov.h" @@ -222,9 +221,9 @@ Array<void *> unary_class_ops; - Array2<void *> unary_ops; + Array<void *> unary_ops; - Array2<void *> non_const_unary_ops; + Array<void *> non_const_unary_ops; Array<void *> binary_class_ops; @@ -234,17 +233,17 @@ Array3<void *> compound_binary_ops; - Array2<void *> cat_ops; + Array<void *> cat_ops; Array3<void *> assign_ops; - Array2<void *> assignany_ops; + Array<void *> assignany_ops; - Array2<int> pref_assign_conv; + Array<int> pref_assign_conv; - Array2<void *> type_conv_ops; + Array<void *> type_conv_ops; - Array2<void *> widening_ops; + Array<void *> widening_ops; int do_register_type (const std::string&, const std::string&, const octave_value&);
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -1893,7 +1893,7 @@ idx(k) = idx_vector (ra_idx(k)); \ \ octave_value page \ - = MAT_T (Array2<ELT_T> (nda.index (idx), nr, nc)); \ + = MAT_T (Array<ELT_T> (nda.index (idx), nr, nc)); \ \ page.print_with_name (os, nm); \ \ @@ -2726,7 +2726,7 @@ for (int k = 2; k < ndims; k++) idx(k) = idx_vector (ra_idx(k)); - Array2<std::string> page (nda.index (idx), nr, nc); + Array<std::string> page (nda.index (idx), nr, nc); // FIXME -- need to do some more work to put these // in neatly aligned columns... @@ -2993,7 +2993,7 @@ for (int k = 2; k < ndims; k++) idx(k) = idx_vector (ra_idx(k)); - Array2<T> page (nda.index (idx), nr, nc); + Array<T> page (nda.index (idx), nr, nc); for (octave_idx_type ii = 0; ii < nr; ii++) { @@ -3098,7 +3098,7 @@ for (int k = 2; k < ndims; k++) idx(k) = idx_vector (ra_idx(k)); - Array2<T> page (nda.index (idx), nr, nc); + Array<T> page (nda.index (idx), nr, nc); if (free_format) {