Mercurial > hg > octave-terminal
changeset 11570:57632dea2446
attempt better backward compatibility for Array constructors
line wrap: on
line diff
--- a/liboctave/Array-util.cc +++ b/liboctave/Array-util.cc @@ -244,7 +244,7 @@ Array<idx_vector> conv_to_array (const idx_vector *tmp, const octave_idx_type len) { - Array<idx_vector> retval (len, 1); + Array<idx_vector> retval (dim_vector (len, 1)); for (octave_idx_type i = 0; i < len; i++) retval (i) = tmp[i]; @@ -378,7 +378,7 @@ { octave_idx_type n = ra_idx.length (); - Array<octave_idx_type> retval (n, 1); + Array<octave_idx_type> retval (dim_vector (n, 1)); for (octave_idx_type i = 0; i < n; i++) retval(i) = ra_idx(i).elem (result_idx(i)); @@ -599,7 +599,7 @@ ind2sub (const dim_vector& dv, const idx_vector& idx) { octave_idx_type len = idx.length (0), n = dv.length (); - Array<idx_vector> retval(n, 1); + Array<idx_vector> retval (dim_vector (n, 1)); octave_idx_type numel = dv.numel (); if (idx.extent (numel) > numel)
--- a/liboctave/Array-voidp.cc +++ b/liboctave/Array-voidp.cc @@ -34,7 +34,3 @@ NO_INSTANTIATE_ARRAY_SORT (void *); INSTANTIATE_ARRAY (void *, OCTAVE_API); - -#include "Array3.h" - -template class OCTAVE_API Array3<void *>;
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -67,27 +67,6 @@ } template <class T> -Array<T>::Array (const Array<T>& a, octave_idx_type nr, octave_idx_type nc) - : dimensions (nr, nc), rep (a.rep), - 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", - 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> void Array<T>::fill (const T& val) { @@ -941,7 +920,7 @@ { static const octave_idx_type max_stack_chunk = 1024; octave_idx_type nn = n + std::min (nx, max_stack_chunk); - Array<T> tmp (Array<T> (nn, 1), dv, 0, n); + Array<T> tmp (Array<T> (dim_vector (nn, 1)), dv, 0, n); T *dest = tmp.fortran_vec (); copy_or_memcpy (nx, data (), dest); @@ -1044,7 +1023,7 @@ if (n != nx) { if (i.is_scalar ()) - return Array<T> (1, 1, rfv); + return Array<T> (dim_vector (1, 1), rfv); else tmp.resize1 (nx, rfv); } @@ -1070,7 +1049,7 @@ if (r != rx || c != cx) { if (i.is_scalar () && j.is_scalar ()) - return Array<T> (1, 1, rfv); + return Array<T> (dim_vector (1, 1), rfv); else tmp.resize (rx, cx, rfv); } @@ -1100,7 +1079,7 @@ for (int i = 0; i < ial; i++) all_scalars = all_scalars && ia(i).is_scalar (); if (all_scalars) - return Array<T> (1, 1, rfv); + return Array<T> (dim_vector (1, 1), rfv); else tmp.resize (dvx, rfv); } @@ -1443,7 +1422,7 @@ else { // Use index. - Array<idx_vector> ia (ndims (), 1, idx_vector::colon); + Array<idx_vector> ia (dim_vector (ndims (), 1), idx_vector::colon); ia (dim) = i.complement (n); *this = index (ia); } @@ -1498,7 +1477,7 @@ assign (i, j, a); else { - Array<idx_vector> idx (a.ndims (), 1); + Array<idx_vector> idx (dim_vector (a.ndims (), 1)); idx(0) = i; idx(1) = j; for (int k = 0; k < a.ndims (); k++) @@ -1514,7 +1493,7 @@ Array<T>::insert (const Array<T>& a, const Array<octave_idx_type>& ra_idx) { octave_idx_type n = ra_idx.length (); - Array<idx_vector> idx (n, 1); + Array<idx_vector> idx (dim_vector (n, 1)); const dim_vector dva = a.dims ().redim (n); for (octave_idx_type k = 0; k < n; k++) idx(k) = idx_vector (ra_idx (k), ra_idx (k) + dva(k)); @@ -2010,7 +1989,7 @@ octave_idx_type r = rows (), c = cols (); - idx = Array<octave_idx_type> (r, 1); + idx = Array<octave_idx_type> (dim_vector (r, 1)); lsort.sort_rows (data (), idx.fortran_vec (), r, c); @@ -2594,7 +2573,7 @@ return retval; int nidx = std::max (dv.length (), dim + 1); - Array<idx_vector> idxa (nidx, 1, idx_vector::colon); + Array<idx_vector> idxa (dim_vector (nidx, 1), idx_vector::colon); octave_idx_type l = 0; for (octave_idx_type i = 0; i < n; i++) @@ -2686,7 +2665,7 @@ { os << "data:"; - Array<octave_idx_type> ra_idx (n_dims, 1, 0); + Array<octave_idx_type> ra_idx (dim_vector (n_dims, 1), 0); // Number of times the first 2d-array is to be displayed.
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -174,19 +174,11 @@ slice_data (rep->data), slice_len (rep->len) { } - // 2D uninitialized ctor. - explicit Array (octave_idx_type m, octave_idx_type n) - : dimensions (m, n), - rep (new typename Array<T>::ArrayRep (dimensions.safe_numel ())), + // Obsolete initialized 1D ctor (there are no 1D arrays). + explicit Array (octave_idx_type n, const T& val) GCC_ATTR_DEPRECATED + : dimensions (n, 1), rep (new typename Array<T>::ArrayRep (n)), slice_data (rep->data), slice_len (rep->len) - { } - - // 2D initialized ctor. - explicit Array (octave_idx_type m, octave_idx_type n, const T& val) - : dimensions (m, n), - rep (new typename Array<T>::ArrayRep (dimensions.safe_numel ())), - slice_data (rep->data), slice_len (rep->len) - { + { fill (val); } @@ -212,8 +204,6 @@ // 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) @@ -417,7 +407,7 @@ 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); } + { return Array<T> (*this, dim_vector (nr, nc)); } Array<T> reshape (const dim_vector& new_dims) const { return Array<T> (*this, new_dims); }
--- a/liboctave/Array3.h +++ b/liboctave/Array3.h @@ -83,4 +83,9 @@ } }; +// If we're with GNU C++, issue a warning. +#ifdef __GNUC__ +#warning Using Array3<T> is deprecated. Use Array<T> directly. #endif + +#endif
--- a/liboctave/CColVector.h +++ b/liboctave/CColVector.h @@ -37,20 +37,24 @@ public: - ComplexColumnVector (void) : MArray<Complex> (0, 1) { } + ComplexColumnVector (void) : MArray<Complex> (dim_vector (0, 1)) { } - explicit ComplexColumnVector (octave_idx_type n) : MArray<Complex> (n, 1) { } + explicit ComplexColumnVector (octave_idx_type n) + : MArray<Complex> (dim_vector (n, 1)) { } explicit ComplexColumnVector (const dim_vector& dv) : MArray<Complex> (dv.as_column ()) { } ComplexColumnVector (octave_idx_type n, const Complex& val) - : MArray<Complex> (n, 1, val) { } + : MArray<Complex> (dim_vector (n, 1), val) { } ComplexColumnVector (const ComplexColumnVector& a) : MArray<Complex> (a) { } - ComplexColumnVector (const MArray<Complex>& a) : MArray<Complex> (a.as_column ()) { } - ComplexColumnVector (const Array<Complex>& a) : MArray<Complex> (a.as_column ()) { } + ComplexColumnVector (const MArray<Complex>& a) + : MArray<Complex> (a.as_column ()) { } + + ComplexColumnVector (const Array<Complex>& a) + : MArray<Complex> (a.as_column ()) { } explicit ComplexColumnVector (const ColumnVector& a);
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -277,7 +277,7 @@ } ComplexMatrix::ComplexMatrix (const DiagMatrix& a) - : MArray<Complex> (a.rows (), a.cols (), 0.0) + : MArray<Complex> (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); @@ -294,7 +294,7 @@ } ComplexMatrix::ComplexMatrix (const ComplexDiagMatrix& a) - : MArray<Complex> (a.rows (), a.cols (), 0.0) + : MArray<Complex> (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); @@ -309,7 +309,7 @@ } ComplexMatrix::ComplexMatrix (const charMatrix& a) - : MArray<Complex> (a.rows (), a.cols (), 0.0) + : MArray<Complex> (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.rows (); i++) for (octave_idx_type j = 0; j < a.cols (); j++) @@ -317,7 +317,7 @@ } ComplexMatrix::ComplexMatrix (const Matrix& re, const Matrix& im) - : MArray<Complex> (re.rows (), re.cols ()) + : MArray<Complex> (re.dims ()) { if (im.rows () != rows () || im.cols () != cols ()) (*current_liboctave_error_handler) ("complex: internal error"); @@ -1065,13 +1065,13 @@ (*current_liboctave_error_handler) ("inverse requires square matrix"); else { - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); retval = *this; Complex *tmp_data = retval.fortran_vec (); - Array<Complex> z(1, 1); + Array<Complex> z (dim_vector (1, 1)); octave_idx_type lwork = -1; // Query the optimum work array size. @@ -1102,7 +1102,7 @@ // Now calculate the condition number for non-singular matrix. octave_idx_type zgecon_info = 0; char job = '1'; - Array<double> rz (2 * nc, 1); + Array<double> rz (dim_vector (2 * nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, tmp_data, nr, anorm, @@ -1617,9 +1617,9 @@ } else { - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (nc, 1); + Array<double> rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zpocon, ZPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1641,7 +1641,7 @@ if (typ == MatrixType::Full) { - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); ComplexMatrix atmp = *this; @@ -1668,9 +1668,9 @@ { // Now calc the condition number for non-singular matrix. char job = '1'; - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (2 * nc, 1); + Array<double> rz (dim_vector (2 * nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1733,9 +1733,9 @@ char uplo = 'U'; char dia = 'N'; - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (nc, 1); + Array<double> rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1761,9 +1761,9 @@ char uplo = 'L'; char dia = 'N'; - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (nc, 1); + Array<double> rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1807,9 +1807,9 @@ } else { - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (nc, 1); + Array<double> rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zpocon, ZPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1827,16 +1827,16 @@ { octave_idx_type info = 0; - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); if(anorm < 0.) anorm = atmp.abs().sum(). row(static_cast<octave_idx_type>(0)).max(); - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (2 * nc, 1); + Array<double> rz (dim_vector (2 * nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1908,9 +1908,9 @@ char uplo = 'U'; char dia = 'N'; - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (nc, 1); + Array<double> rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -2009,9 +2009,9 @@ char uplo = 'L'; char dia = 'N'; - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (nc, 1); + Array<double> rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -2117,9 +2117,9 @@ { if (calc_cond) { - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (nc, 1); + Array<double> rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zpocon, ZPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -2169,15 +2169,15 @@ { info = 0; - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); ComplexMatrix atmp = *this; Complex *tmp_data = atmp.fortran_vec (); - Array<Complex> z (2 * nc, 1); + Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (2 * nc, 1); + Array<double> rz (dim_vector (2 * nc, 1)); double *prz = rz.fortran_vec (); // Calculate the norm of the matrix, for later use. @@ -2624,13 +2624,13 @@ Complex *tmp_data = atmp.fortran_vec (); Complex *pretval = retval.fortran_vec (); - Array<double> s (minmn, 1); + Array<double> s (dim_vector (minmn, 1)); double *ps = s.fortran_vec (); // Ask ZGELSD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<Complex> work (1, 1); + Array<Complex> work (dim_vector (1, 1)); octave_idx_type smlsiz; F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("ZGELSD", 6), @@ -2665,13 +2665,13 @@ n*(1+nrhs) + 2*nrhs); if (lrwork < 1) lrwork = 1; - Array<double> rwork (lrwork, 1); + Array<double> rwork (dim_vector (lrwork, 1)); double *prwork = rwork.fortran_vec (); octave_idx_type liwork = 3 * minmn * nlvl + 11 * minmn; if (liwork < 1) liwork = 1; - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type* piwork = iwork.fortran_vec (); F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, @@ -2821,13 +2821,13 @@ Complex *tmp_data = atmp.fortran_vec (); Complex *pretval = retval.fortran_vec (); - Array<double> s (minmn, 1); + Array<double> s (dim_vector (minmn, 1)); double *ps = s.fortran_vec (); // Ask ZGELSD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<Complex> work (1, 1); + Array<Complex> work (dim_vector (1, 1)); octave_idx_type smlsiz; F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("ZGELSD", 6), @@ -2854,13 +2854,13 @@ + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1); if (lrwork < 1) lrwork = 1; - Array<double> rwork (lrwork, 1); + Array<double> rwork (dim_vector (lrwork, 1)); double *prwork = rwork.fortran_vec (); octave_idx_type liwork = 3 * minmn * nlvl + 11 * minmn; if (liwork < 1) liwork = 1; - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type* piwork = iwork.fortran_vec (); F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
--- a/liboctave/CMatrix.h +++ b/liboctave/CMatrix.h @@ -45,10 +45,11 @@ ComplexMatrix (void) : MArray<Complex> () { } - ComplexMatrix (octave_idx_type r, octave_idx_type c) : MArray<Complex> (r, c) { } + ComplexMatrix (octave_idx_type r, octave_idx_type c) + : MArray<Complex> (dim_vector (r, c)) { } ComplexMatrix (octave_idx_type r, octave_idx_type c, const Complex& val) - : MArray<Complex> (r, c, val) { } + : MArray<Complex> (dim_vector (r, c), val) { } ComplexMatrix (const dim_vector& dv) : MArray<Complex> (dv.redim (2)) { }
--- a/liboctave/CNDArray.cc +++ b/liboctave/CNDArray.cc @@ -216,7 +216,7 @@ ComplexNDArray retval (dv); octave_idx_type npts = dv(dim); octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); @@ -263,7 +263,7 @@ ComplexNDArray retval (dv); octave_idx_type npts = dv(dim); octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); @@ -313,9 +313,9 @@ { octave_idx_type npts = dv2(i); octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); - Array<Complex> row (npts, 1); + Array<Complex> row (dim_vector (npts, 1)); Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; @@ -361,9 +361,9 @@ { octave_idx_type npts = dv2(i); octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); - Array<Complex> row (npts, 1); + Array<Complex> row (dim_vector (npts, 1)); Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; @@ -409,9 +409,9 @@ { octave_idx_type npts = dv(i); octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); - Array<Complex> row (npts, 1); + Array<Complex> row (dim_vector (npts, 1)); Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; @@ -456,9 +456,9 @@ { octave_idx_type npts = dv(i); octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); - Array<Complex> row (npts, 1); + Array<Complex> row (dim_vector (npts, 1)); Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; @@ -772,7 +772,7 @@ if (n == dimensions.length ()) { - Array<octave_idx_type> a_ra_idx (a_dv.length (), 1, 0); + Array<octave_idx_type> a_ra_idx (dim_vector (a_dv.length (), 1), 0); a_ra_idx.elem (0) = r; a_ra_idx.elem (1) = c;
--- a/liboctave/CRowVector.h +++ b/liboctave/CRowVector.h @@ -36,18 +36,23 @@ public: - ComplexRowVector (void) : MArray<Complex> (1, 0) { } + ComplexRowVector (void) : MArray<Complex> (dim_vector (1, 0)) { } - explicit ComplexRowVector (octave_idx_type n) : MArray<Complex> (1, n) { } + explicit ComplexRowVector (octave_idx_type n) + : MArray<Complex> (dim_vector (1, n)) { } explicit ComplexRowVector (const dim_vector& dv) : MArray<Complex> (dv) { } - ComplexRowVector (octave_idx_type n, const Complex& val) : MArray<Complex> (1, n, val) { } + ComplexRowVector (octave_idx_type n, const Complex& val) + : MArray<Complex> (dim_vector (1, n), val) { } ComplexRowVector (const ComplexRowVector& a) : MArray<Complex> (a) { } - ComplexRowVector (const MArray<Complex>& a) : MArray<Complex> (a.as_row ()) { } - ComplexRowVector (const Array<Complex>& a) : MArray<Complex> (a.as_row ()) { } + ComplexRowVector (const MArray<Complex>& a) + : MArray<Complex> (a.as_row ()) { } + + ComplexRowVector (const Array<Complex>& a) + : MArray<Complex> (a.as_row ()) { } explicit ComplexRowVector (const RowVector& a) : MArray<Complex> (a) { }
--- a/liboctave/CSparse.cc +++ b/liboctave/CSparse.cc @@ -3919,7 +3919,7 @@ OCTAVE_LOCAL_BUFFER (Complex, DU, nr - 1); OCTAVE_LOCAL_BUFFER (Complex, D, nr); OCTAVE_LOCAL_BUFFER (Complex, DL, nr - 1); - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); if (mattype.is_dense ()) @@ -4219,7 +4219,7 @@ OCTAVE_LOCAL_BUFFER (Complex, DU, nr - 1); OCTAVE_LOCAL_BUFFER (Complex, D, nr); OCTAVE_LOCAL_BUFFER (Complex, DL, nr - 1); - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); if (mattype.is_dense ()) @@ -4413,9 +4413,9 @@ { if (calc_cond) { - Array<Complex> z (2 * nr, 1); + Array<Complex> z (dim_vector (2 * nr, 1)); Complex *pz = z.fortran_vec (); - Array<double> iz (nr, 1); + Array<double> iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); F77_XFCN (zpbcon, ZPBCON, @@ -4507,7 +4507,7 @@ } } - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (zgbtrf, ZGBTRF, (nr, nc, n_lower, n_upper, tmp_data, @@ -4534,9 +4534,9 @@ if (calc_cond) { char job = '1'; - Array<Complex> z (2 * nr, 1); + Array<Complex> z (dim_vector (2 * nr, 1)); Complex *pz = z.fortran_vec (); - Array<double> iz (nr, 1); + Array<double> iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); F77_XFCN (zgbcon, ZGBCON, @@ -4660,9 +4660,9 @@ { if (calc_cond) { - Array<Complex> z (2 * nr, 1); + Array<Complex> z (dim_vector (2 * nr, 1)); Complex *pz = z.fortran_vec (); - Array<double> iz (nr, 1); + Array<double> iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); F77_XFCN (zpbcon, ZPBCON, @@ -4789,7 +4789,7 @@ } } - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, @@ -4815,9 +4815,9 @@ if (calc_cond) { char job = '1'; - Array<Complex> z (2 * nr, 1); + Array<Complex> z (dim_vector (2 * nr, 1)); Complex *pz = z.fortran_vec (); - Array<double> iz (nr, 1); + Array<double> iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); F77_XFCN (zgbcon, ZGBCON, @@ -4980,9 +4980,9 @@ { if (calc_cond) { - Array<Complex> z (2 * nr, 1); + Array<Complex> z (dim_vector (2 * nr, 1)); Complex *pz = z.fortran_vec (); - Array<double> iz (nr, 1); + Array<double> iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); F77_XFCN (zpbcon, ZPBCON, @@ -5074,7 +5074,7 @@ } } - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, @@ -5099,9 +5099,9 @@ if (calc_cond) { char job = '1'; - Array<Complex> z (2 * nr, 1); + Array<Complex> z (dim_vector (2 * nr, 1)); Complex *pz = z.fortran_vec (); - Array<double> iz (nr, 1); + Array<double> iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); F77_XFCN (zgbcon, ZGBCON, @@ -5227,9 +5227,9 @@ { if (calc_cond) { - Array<Complex> z (2 * nr, 1); + Array<Complex> z (dim_vector (2 * nr, 1)); Complex *pz = z.fortran_vec (); - Array<double> iz (nr, 1); + Array<double> iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); F77_XFCN (zpbcon, ZPBCON, @@ -5361,7 +5361,7 @@ } } - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, @@ -5387,9 +5387,9 @@ if (calc_cond) { char job = '1'; - Array<Complex> z (2 * nr, 1); + Array<Complex> z (dim_vector (2 * nr, 1)); Complex *pz = z.fortran_vec (); - Array<double> iz (nr, 1); + Array<double> iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); F77_XFCN (zgbcon, ZGBCON,
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,12 @@ +2011-01-19 John W. Eaton <jwe@octave.org> + + * Array.h (explicit Array (octave_idx_type, const T&)): + Restore constructor, but mark as deprecated. + (explicit Array (octave_idx_type, octave_idx_type)): Delete. + (Array (const Array<T>&, octave_idx_type, octave_idx_type)): Delete. + Fix all uses in Octave. + * Array3.h: Deprecate header file. Remove all uses from Octave. + 2011-01-19 John W. Eaton <jwe@octave.org> * file-stat.cc (mode_as_string): Declare buffer as an array of
--- a/liboctave/CmplxCHOL.cc +++ b/liboctave/CmplxCHOL.cc @@ -127,9 +127,9 @@ octave_idx_type zpocon_info = 0; // Now calculate the condition number for non-singular matrix. - Array<Complex> z (2*n, 1); + Array<Complex> z (dim_vector (2*n, 1)); Complex *pz = z.fortran_vec (); - Array<double> rz (n, 1); + Array<double> rz (dim_vector (n, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zpocon, ZPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, anorm, xrcond, pz, prz, zpocon_info @@ -419,7 +419,7 @@ else { ComplexMatrix a = chol_mat.hermitian () * chol_mat; - Array<octave_idx_type> p (n, 1); + Array<octave_idx_type> p (dim_vector (n, 1)); for (octave_idx_type k = 0; k < n; k++) p(k) = k; if (i < j) {
--- a/liboctave/CmplxHESS.cc +++ b/liboctave/CmplxHESS.cc @@ -85,17 +85,17 @@ hess_mat = a; Complex *h = hess_mat.fortran_vec (); - Array<double> scale (n, 1); + Array<double> scale (dim_vector (n, 1)); double *pscale = scale.fortran_vec (); F77_XFCN (zgebal, ZGEBAL, (F77_CONST_CHAR_ARG2 (&job, 1), n, h, n, ilo, ihi, pscale, info F77_CHAR_ARG_LEN (1))); - Array<Complex> tau (n-1, 1); + Array<Complex> tau (dim_vector (n-1, 1)); Complex *ptau = tau.fortran_vec (); - Array<Complex> work (lwork, 1); + Array<Complex> work (dim_vector (lwork, 1)); Complex *pwork = work.fortran_vec (); F77_XFCN (zgehrd, ZGEHRD, (n, ilo, ihi, h, n, ptau, pwork, lwork, info));
--- a/liboctave/CmplxQRP.cc +++ b/liboctave/CmplxQRP.cc @@ -67,7 +67,7 @@ if (m > n && qr_type == qr_type_std) afact.resize (m, m); - MArray<octave_idx_type> jpvt (n, 1, 0); + MArray<octave_idx_type> jpvt (dim_vector (n, 1), 0); if (m > 0) {
--- a/liboctave/CmplxSCHUR.cc +++ b/liboctave/CmplxSCHUR.cc @@ -121,17 +121,18 @@ Complex *s = schur_mat.fortran_vec (); Complex *q = unitary_mat.fortran_vec (); - Array<double> rwork (n, 1); + Array<double> rwork (dim_vector (n, 1)); double *prwork = rwork.fortran_vec (); - Array<Complex> w (n, 1); + Array<Complex> w (dim_vector (n, 1)); Complex *pw = w.fortran_vec (); - Array<Complex> work (lwork, 1); + Array<Complex> work (dim_vector (lwork, 1)); Complex *pwork = work.fortran_vec (); // BWORK is not referenced for non-ordered Schur. - Array<octave_idx_type> bwork ((ord_char == 'N' || ord_char == 'n') ? 0 : n, 1); + octave_idx_type ntmp = (ord_char == 'N' || ord_char == 'n') ? 0 : n; + Array<octave_idx_type> bwork (dim_vector (ntmp, 1)); octave_idx_type *pbwork = bwork.fortran_vec (); F77_XFCN (zgeesx, ZGEESX, (F77_CONST_CHAR_ARG2 (&jobvs, 1),
--- a/liboctave/CmplxSVD.cc +++ b/liboctave/CmplxSVD.cc @@ -144,13 +144,13 @@ octave_idx_type lrwork = 5*max_mn; - Array<double> rwork (lrwork, 1); + Array<double> rwork (dim_vector (lrwork, 1)); // Ask ZGESVD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<Complex> work (1, 1); + Array<Complex> work (dim_vector (1, 1)); octave_idx_type one = 1; octave_idx_type m1 = std::max (m, one), nrow_vt1 = std::max (nrow_vt, one);
--- a/liboctave/CollocWt.cc +++ b/liboctave/CollocWt.cc @@ -428,16 +428,16 @@ else if (nt == 0) return; - Array<double> dif1 (nt, 1); + Array<double> dif1 (dim_vector (nt, 1)); double *pdif1 = dif1.fortran_vec (); - Array<double> dif2 (nt, 1); + Array<double> dif2 (dim_vector (nt, 1)); double *pdif2 = dif2.fortran_vec (); - Array<double> dif3 (nt, 1); + Array<double> dif3 (dim_vector (nt, 1)); double *pdif3 = dif3.fortran_vec (); - Array<double> vect (nt, 1); + Array<double> vect (dim_vector (nt, 1)); double *pvect = vect.fortran_vec (); r.resize (nt, 1);
--- a/liboctave/DiagArray2.cc +++ b/liboctave/DiagArray2.cc @@ -55,9 +55,9 @@ // The main diagonal is shallow-copied. d = *this; else if (k > 0 && k < cols ()) - d = Array<T> (std::min (cols () - k, rows ()), 1, T ()); + d = Array<T> (dim_vector (std::min (cols () - k, rows ()), 1), T ()); else if (k < 0 && -k < rows ()) - d = Array<T> (std::min (rows () + k, cols ()), 1, T ()); + d = Array<T> (dim_vector (std::min (rows () + k, cols ()), 1), T ()); else (*current_liboctave_error_handler) ("diag: requested diagonal out of range"); @@ -112,9 +112,11 @@ } template <class T> -Array<T> DiagArray2<T>::array_value (void) const +Array<T> +DiagArray2<T>::array_value (void) const { - Array<T> result (dim1 (), dim2 ()); + Array<T> result (dims (), T (0)); + 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 @@ -49,10 +49,10 @@ : Array<T> (), d1 (0), d2 (0) { } DiagArray2 (octave_idx_type r, octave_idx_type c) - : Array<T> (std::min (r, c), 1), d1 (r), d2 (c) { } + : Array<T> (dim_vector (std::min (r, c), 1)), d1 (r), d2 (c) { } DiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) - : Array<T> (std::min (r, c), 1, val), d1 (r), d2 (c) { } + : Array<T> (dim_vector (std::min (r, c), 1), val), d1 (r), d2 (c) { } explicit DiagArray2 (const Array<T>& a) : Array<T> (a.as_column ()), d1 (a.numel ()), d2 (a.numel ()) { } @@ -64,7 +64,7 @@ template <class U> DiagArray2 (const DiagArray2<U>& a) - : Array<T> (a.diag ()), d1 (a.dim1 ()), d2 (a.dim2 ()) { } + : Array<T> (a.diag ()), d1 (a.dim1 ()), d2 (a.dim2 ()) { } ~DiagArray2 (void) { }
--- a/liboctave/EIG.cc +++ b/liboctave/EIG.cc @@ -162,10 +162,10 @@ Matrix atmp = a; double *tmp_data = atmp.fortran_vec (); - Array<double> wr (n, 1); + Array<double> wr (dim_vector (n, 1)); double *pwr = wr.fortran_vec (); - Array<double> wi (n, 1); + Array<double> wi (dim_vector (n, 1)); double *pwi = wi.fortran_vec (); octave_idx_type tnvr = calc_ev ? n : 0; @@ -188,7 +188,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work); - Array<double> work (lwork, 1); + Array<double> work (dim_vector (lwork, 1)); double *pwork = work.fortran_vec (); F77_XFCN (dgeev, DGEEV, (F77_CONST_CHAR_ARG2 ("N", 1), @@ -281,7 +281,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work); - Array<double> work (lwork, 1); + Array<double> work (dim_vector (lwork, 1)); double *pwork = work.fortran_vec (); F77_XFCN (dsyev, DSYEV, (F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -348,7 +348,7 @@ Complex dummy_work; octave_idx_type lrwork = 2*n; - Array<double> rwork (lrwork, 1); + Array<double> rwork (dim_vector (lrwork, 1)); double *prwork = rwork.fortran_vec (); Complex *dummy = 0; @@ -364,7 +364,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work.real ()); - Array<Complex> work (lwork, 1); + Array<Complex> work (dim_vector (lwork, 1)); Complex *pwork = work.fortran_vec (); F77_XFCN (zgeev, ZGEEV, (F77_CONST_CHAR_ARG2 ("N", 1), @@ -418,7 +418,7 @@ Complex dummy_work; octave_idx_type lrwork = 3*n; - Array<double> rwork (lrwork, 1); + Array<double> rwork (dim_vector (lrwork, 1)); double *prwork = rwork.fortran_vec (); F77_XFCN (zheev, ZHEEV, (F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -431,7 +431,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work.real ()); - Array<Complex> work (lwork, 1); + Array<Complex> work (dim_vector (lwork, 1)); Complex *pwork = work.fortran_vec (); F77_XFCN (zheev, ZHEEV, (F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -506,13 +506,13 @@ Matrix btmp = b; double *btmp_data = btmp.fortran_vec (); - Array<double> ar (n, 1); + Array<double> ar (dim_vector (n, 1)); double *par = ar.fortran_vec (); - Array<double> ai (n, 1); + Array<double> ai (dim_vector (n, 1)); double *pai = ai.fortran_vec (); - Array<double> beta (n, 1); + Array<double> beta (dim_vector (n, 1)); double *pbeta = beta.fortran_vec (); octave_idx_type tnvr = calc_ev ? n : 0; @@ -537,7 +537,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work); - Array<double> work (lwork, 1); + Array<double> work (dim_vector (lwork, 1)); double *pwork = work.fortran_vec (); F77_XFCN (dggev, DGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), @@ -646,7 +646,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work); - Array<double> work (lwork, 1); + Array<double> work (dim_vector (lwork, 1)); double *pwork = work.fortran_vec (); F77_XFCN (dsygv, DSYGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -737,7 +737,7 @@ Complex dummy_work; octave_idx_type lrwork = 8*n; - Array<double> rwork (lrwork, 1); + Array<double> rwork (dim_vector (lrwork, 1)); double *prwork = rwork.fortran_vec (); Complex *dummy = 0; @@ -754,7 +754,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work.real ()); - Array<Complex> work (lwork, 1); + Array<Complex> work (dim_vector (lwork, 1)); Complex *pwork = work.fortran_vec (); F77_XFCN (zggev, ZGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), @@ -823,7 +823,7 @@ Complex dummy_work; octave_idx_type lrwork = 3*n; - Array<double> rwork (lrwork, 1); + Array<double> rwork (dim_vector (lrwork, 1)); double *prwork = rwork.fortran_vec (); F77_XFCN (zhegv, ZHEGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -838,7 +838,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work.real ()); - Array<Complex> work (lwork, 1); + Array<Complex> work (dim_vector (lwork, 1)); Complex *pwork = work.fortran_vec (); F77_XFCN (zhegv, ZHEGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1),
--- a/liboctave/MArray.h +++ b/liboctave/MArray.h @@ -43,11 +43,11 @@ MArray (void) : Array<T> () {} - explicit MArray (octave_idx_type m, octave_idx_type n) - : Array<T> (m, n) { } + explicit MArray (octave_idx_type n) GCC_ATTR_DEPRECATED + : Array<T> (dim_vector (n, 1)) { } - explicit MArray (octave_idx_type m, octave_idx_type n, const T& val) - : Array<T> (m, n, val) { } + MArray (octave_idx_type n, const T& val) GCC_ATTR_DEPRECATED + : Array<T> (dim_vector (n, 1), val) { } explicit MArray (const dim_vector& dv) : Array<T> (dv) { }
--- a/liboctave/MSparse.cc +++ b/liboctave/MSparse.cc @@ -193,7 +193,7 @@ octave_idx_type nr = a.rows (); \ octave_idx_type nc = a.cols (); \ \ - MArray<T> r (nr, nc, (0.0 OP s)); \ + MArray<T> r (dim_vector (nr, nc), (0.0 OP s)); \ \ for (octave_idx_type j = 0; j < nc; j++) \ for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) \ @@ -239,7 +239,7 @@ octave_idx_type nr = a.rows (); \ octave_idx_type nc = a.cols (); \ \ - MArray<T> r (nr, nc, (s OP 0.0)); \ + MArray<T> r (dim_vector (nr, nc), (s OP 0.0)); \ \ for (octave_idx_type j = 0; j < nc; j++) \ for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) \
--- a/liboctave/PermMatrix.cc +++ b/liboctave/PermMatrix.cc @@ -57,14 +57,14 @@ gripe_invalid_permutation (); else { - Array<octave_idx_type> idxa (len, 1); + Array<octave_idx_type> idxa (dim_vector (len, 1)); for (octave_idx_type i = 0; i < len; i++) idxa(i) = idx(i); Array<octave_idx_type>::operator = (idxa); } } PermMatrix::PermMatrix (octave_idx_type n) - : Array<octave_idx_type> (n, 1), _colp (false) + : Array<octave_idx_type> (dim_vector (n, 1)), _colp (false) { for (octave_idx_type i = 0; i < n; i++) xelem (i) = i; } @@ -145,7 +145,7 @@ return PermMatrix (n); const octave_idx_type *p = data (); - Array<octave_idx_type> res_pvec (n, 1, -1); + Array<octave_idx_type> res_pvec (dim_vector (n, 1), -1); octave_idx_type *q = res_pvec.fortran_vec (); for (octave_idx_type ics = 0; ics < n; ics++) @@ -181,7 +181,7 @@ PermMatrix PermMatrix::eye (octave_idx_type n) { - Array<octave_idx_type> p(n, 1); + Array<octave_idx_type> p (dim_vector (n, 1)); for (octave_idx_type i = 0; i < n; i++) p(i) = i; @@ -204,7 +204,7 @@ } else { - Array<octave_idx_type> ra (n, 1); + Array<octave_idx_type> ra (dim_vector (n, 1)); if (a._colp) ra.assign (idx_vector (ib), ia); else
--- a/liboctave/Quad.cc +++ b/liboctave/Quad.cc @@ -131,11 +131,11 @@ double result = 0.0; octave_idx_type leniw = 183*npts - 122; - Array<octave_idx_type> iwork (leniw, 1); + Array<octave_idx_type> iwork (dim_vector (leniw, 1)); octave_idx_type *piwork = iwork.fortran_vec (); octave_idx_type lenw = 2*leniw - npts; - Array<double> work (lenw, 1); + Array<double> work (dim_vector (lenw, 1)); double *pwork = work.fortran_vec (); user_fcn = f; @@ -165,11 +165,11 @@ double result = 0.0; octave_idx_type leniw = 128; - Array<octave_idx_type> iwork (leniw, 1); + Array<octave_idx_type> iwork (dim_vector (leniw, 1)); octave_idx_type *piwork = iwork.fortran_vec (); octave_idx_type lenw = 8*leniw; - Array<double> work (lenw, 1); + Array<double> work (dim_vector (lenw, 1)); double *pwork = work.fortran_vec (); user_fcn = f; @@ -227,11 +227,11 @@ float result = 0.0; octave_idx_type leniw = 183*npts - 122; - Array<octave_idx_type> iwork (leniw, 1); + Array<octave_idx_type> iwork (dim_vector (leniw, 1)); octave_idx_type *piwork = iwork.fortran_vec (); octave_idx_type lenw = 2*leniw - npts; - Array<float> work (lenw, 1); + Array<float> work (dim_vector (lenw, 1)); float *pwork = work.fortran_vec (); float_user_fcn = ff; @@ -261,11 +261,11 @@ float result = 0.0; octave_idx_type leniw = 128; - Array<octave_idx_type> iwork (leniw, 1); + Array<octave_idx_type> iwork (dim_vector (leniw, 1)); octave_idx_type *piwork = iwork.fortran_vec (); octave_idx_type lenw = 8*leniw; - Array<float> work (lenw, 1); + Array<float> work (dim_vector (lenw, 1)); float *pwork = work.fortran_vec (); float_user_fcn = ff;
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -1393,7 +1393,7 @@ // Lookup. // FIXME: Could specialize for sorted idx? - NoAlias< Array<octave_idx_type> > lidx (new_nr, new_nc); + NoAlias< Array<octave_idx_type> > lidx (dim_vector (new_nr, new_nc)); for (octave_idx_type i = 0; i < new_nr*new_nc; i++) lidx(i) = lblookup (ridx (), nz, idxa(i)); @@ -1803,8 +1803,8 @@ const Sparse<T> tmp = *this; octave_idx_type new_nz = nz + rhl; // Disassembly our matrix... - Array<octave_idx_type> new_ri (new_nz, 1); - Array<T> new_data (new_nz, 1); + Array<octave_idx_type> new_ri (dim_vector (new_nz, 1)); + Array<T> new_data (dim_vector (new_nz, 1)); copy_or_memcpy (nz, tmp.ridx (), new_ri.fortran_vec ()); copy_or_memcpy (nz, tmp.data (), new_data.fortran_vec ()); // ... insert new data (densified) ...
--- a/liboctave/base-lu.cc +++ b/liboctave/base-lu.cc @@ -123,7 +123,7 @@ { octave_idx_type a_nr = a_fact.rows (); - Array<octave_idx_type> pvt (a_nr, 1); + Array<octave_idx_type> pvt (dim_vector (a_nr, 1)); for (octave_idx_type i = 0; i < a_nr; i++) pvt.xelem (i) = i;
--- a/liboctave/boolMatrix.h +++ b/liboctave/boolMatrix.h @@ -36,11 +36,19 @@ public: boolMatrix (void) : Array<bool> () { } - boolMatrix (octave_idx_type r, octave_idx_type c) : Array<bool> (r, c) { } - boolMatrix (octave_idx_type r, octave_idx_type c, bool val) : Array<bool> (r, c, val) { } + + boolMatrix (octave_idx_type r, octave_idx_type c) + : Array<bool> (dim_vector (r, c)) { } + + boolMatrix (octave_idx_type r, octave_idx_type c, bool val) + : Array<bool> (dim_vector (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.as_matrix ()) { } + boolMatrix (const boolMatrix& a) : Array<bool> (a) { } boolMatrix& operator = (const boolMatrix& a)
--- a/liboctave/boolSparse.cc +++ b/liboctave/boolSparse.cc @@ -163,16 +163,16 @@ if (nz > nr/4) { // We can use O(nr) memory. - Array<bool> tmp (nr, 1, false); + Array<bool> tmp (dim_vector (nr, 1), false); for (octave_idx_type i = 0; i < nz; i++) tmp.xelem(ridx(i)) = true; retval = tmp; } else { - Array<octave_idx_type> tmp (nz, 1); + Array<octave_idx_type> tmp (dim_vector (nz, 1)); copy_or_memcpy (nz, ridx (), tmp.fortran_vec ()); - retval = Sparse<bool> (Array<bool> (1, 1, true), + retval = Sparse<bool> (Array<bool> (dim_vector (1, 1), true), idx_vector (tmp), idx_vector (static_cast<octave_idx_type> (0)), nr, 1, false); @@ -212,16 +212,16 @@ if (nz > nr) { // We can use O(nr) memory. - Array<double> tmp (nr, 1, 0); + Array<double> tmp (dim_vector (nr, 1), 0); for (octave_idx_type i = 0; i < nz; i++) tmp.xelem(ridx(i)) += 1.0; retval = tmp; } else { - Array<octave_idx_type> tmp (nz, 1); + Array<octave_idx_type> tmp (dim_vector (nz, 1)); copy_or_memcpy (nz, ridx (), tmp.fortran_vec ()); - retval = Sparse<double> (Array<double> (1, 1, 1.0), + retval = Sparse<double> (Array<double> (dim_vector (1, 1), 1.0), idx_vector (tmp), idx_vector (static_cast<octave_idx_type> (0)), nr, 1);
--- a/liboctave/chMatrix.cc +++ b/liboctave/chMatrix.cc @@ -75,7 +75,7 @@ } charMatrix::charMatrix (const string_vector& s) - : Array<char> (s.length (), s.max_length (), 0) + : Array<char> (dim_vector (s.length (), s.max_length ()), 0) { octave_idx_type nr = rows ();
--- a/liboctave/chMatrix.h +++ b/liboctave/chMatrix.h @@ -41,15 +41,27 @@ public: charMatrix (void) : Array<char> () { } - charMatrix (octave_idx_type r, octave_idx_type c) : Array<char> (r, c) { } - charMatrix (octave_idx_type r, octave_idx_type c, char val) : Array<char> (r, c, val) { } + + charMatrix (octave_idx_type r, octave_idx_type c) + : Array<char> (dim_vector (r, c)) { } + + charMatrix (octave_idx_type r, octave_idx_type c, char val) + : Array<char> (dim_vector (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.as_matrix ()) { } + charMatrix (const charMatrix& a) : Array<char> (a) { } + charMatrix (char c); + charMatrix (const char *s); + charMatrix (const std::string& s); + charMatrix (const string_vector& s); charMatrix& operator = (const charMatrix& a)
--- a/liboctave/dColVector.h +++ b/liboctave/dColVector.h @@ -34,14 +34,16 @@ { public: - ColumnVector (void) : MArray<double> (0, 1) { } + ColumnVector (void) : MArray<double> (dim_vector (0, 1)) { } - explicit ColumnVector (octave_idx_type n) : MArray<double> (n, 1) { } + explicit ColumnVector (octave_idx_type n) + : MArray<double> (dim_vector (n, 1)) { } explicit ColumnVector (const dim_vector& dv) : MArray<double> (dv.as_column ()) { } - ColumnVector (octave_idx_type n, double val) : MArray<double> (n, 1, val) { } + ColumnVector (octave_idx_type n, double val) + : MArray<double> (dim_vector (n, 1), val) { } ColumnVector (const ColumnVector& a) : MArray<double> (a) { }
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -250,14 +250,14 @@ } Matrix::Matrix (const DiagMatrix& a) - : MArray<double> (a.rows (), a.cols (), 0.0) + : MArray<double> (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); } Matrix::Matrix (const PermMatrix& a) - : MArray<double> (a.rows (), a.cols (), 0.0) + : MArray<double> (a.dims (), 0.0) { const Array<octave_idx_type> ia (a.pvec ()); octave_idx_type len = a.rows (); @@ -278,7 +278,7 @@ } Matrix::Matrix (const charMatrix& a) - : MArray<double> (a.rows (), a.cols ()) + : MArray<double> (a.dims ()) { for (octave_idx_type i = 0; i < a.rows (); i++) for (octave_idx_type j = 0; j < a.cols (); j++) @@ -740,13 +740,13 @@ (*current_liboctave_error_handler) ("inverse requires square matrix"); else { - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); retval = *this; double *tmp_data = retval.fortran_vec (); - Array<double> z(1, 1); + Array<double> z (dim_vector (1, 1)); octave_idx_type lwork = -1; // Query the optimum work array size. @@ -777,7 +777,7 @@ // Now calculate the condition number for non-singular matrix. char job = '1'; - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, tmp_data, nr, anorm, @@ -1012,7 +1012,7 @@ octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); retval = ComplexMatrix (*this); @@ -1053,7 +1053,7 @@ octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); retval = ComplexMatrix (*this); @@ -1097,7 +1097,7 @@ octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); retval = ComplexMatrix (*this); @@ -1119,7 +1119,7 @@ wsave.resize (nn, 1); pwsave = wsave.fortran_vec (); - Array<Complex> tmp (npts, 1); + Array<Complex> tmp (dim_vector (npts, 1)); Complex *prow = tmp.fortran_vec (); F77_FUNC (zffti, ZFFTI) (npts, pwsave); @@ -1163,7 +1163,7 @@ octave_idx_type nn = 4*npts+15; - Array<Complex> wsave (nn, 1); + Array<Complex> wsave (dim_vector (nn, 1)); Complex *pwsave = wsave.fortran_vec (); retval = ComplexMatrix (*this); @@ -1188,7 +1188,7 @@ wsave.resize (nn, 1); pwsave = wsave.fortran_vec (); - Array<Complex> tmp (npts, 1); + Array<Complex> tmp (dim_vector (npts, 1)); Complex *prow = tmp.fortran_vec (); F77_FUNC (zffti, ZFFTI) (npts, pwsave); @@ -1285,9 +1285,9 @@ } else { - Array<double> z (3 * nc, 1); + Array<double> z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1309,7 +1309,7 @@ if (typ == MatrixType::Full) { - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); Matrix atmp = *this; @@ -1336,9 +1336,9 @@ { // Now calc the condition number for non-singular matrix. char job = '1'; - Array<double> z (4 * nc, 1); + Array<double> z (dim_vector (4 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1401,9 +1401,9 @@ char uplo = 'U'; char dia = 'N'; - Array<double> z (3 * nc, 1); + Array<double> z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1429,9 +1429,9 @@ char uplo = 'L'; char dia = 'N'; - Array<double> z (3 * nc, 1); + Array<double> z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1474,9 +1474,9 @@ } else { - Array<double> z (3 * nc, 1); + Array<double> z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1493,16 +1493,16 @@ { octave_idx_type info = 0; - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); if(anorm < 0.) anorm = atmp.abs().sum(). row(static_cast<octave_idx_type>(0)).max(); - Array<double> z (4 * nc, 1); + Array<double> z (dim_vector (4 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1573,9 +1573,9 @@ char uplo = 'U'; char dia = 'N'; - Array<double> z (3 * nc, 1); + Array<double> z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1673,9 +1673,9 @@ char uplo = 'L'; char dia = 'N'; - Array<double> z (3 * nc, 1); + Array<double> z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1779,9 +1779,9 @@ { if (calc_cond) { - Array<double> z (3 * nc, 1); + Array<double> z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1831,7 +1831,7 @@ { info = 0; - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); Matrix atmp = *this; @@ -1839,9 +1839,9 @@ if(anorm < 0.) anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max(); - Array<double> z (4 * nc, 1); + Array<double> z (dim_vector (4 * nc, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -2271,13 +2271,13 @@ double *tmp_data = atmp.fortran_vec (); double *pretval = retval.fortran_vec (); - Array<double> s (minmn, 1); + Array<double> s (dim_vector (minmn, 1)); double *ps = s.fortran_vec (); // Ask DGELSD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<double> work (1, 1); + Array<double> work (dim_vector (1, 1)); octave_idx_type smlsiz; F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("DGELSD", 6), @@ -2309,7 +2309,7 @@ octave_idx_type liwork = 3 * minmn * nlvl + 11 * minmn; if (liwork < 1) liwork = 1; - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type* piwork = iwork.fortran_vec (); F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, @@ -2469,13 +2469,13 @@ double *tmp_data = atmp.fortran_vec (); double *pretval = retval.fortran_vec (); - Array<double> s (minmn, 1); + Array<double> s (dim_vector (minmn, 1)); double *ps = s.fortran_vec (); // Ask DGELSD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<double> work (1, 1); + Array<double> work (dim_vector (1, 1)); octave_idx_type smlsiz; F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("DGELSD", 6), @@ -2500,7 +2500,7 @@ octave_idx_type liwork = 3 * minmn * nlvl + 11 * minmn; if (liwork < 1) liwork = 1; - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type* piwork = iwork.fortran_vec (); F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
--- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -44,13 +44,16 @@ Matrix (void) : MArray<double> () { } - Matrix (octave_idx_type r, octave_idx_type c) : MArray<double> (r, c) { } + Matrix (octave_idx_type r, octave_idx_type c) + : MArray<double> (dim_vector (r, c)) { } - Matrix (octave_idx_type r, octave_idx_type c, double val) : MArray<double> (r, c, val) { } + Matrix (octave_idx_type r, octave_idx_type c, double val) + : MArray<double> (dim_vector (r, c), val) { } Matrix (const dim_vector& dv) : MArray<double> (dv.redim (2)) { } - Matrix (const dim_vector& dv, double val) : MArray<double> (dv.redim (2), val) { } + Matrix (const dim_vector& dv, double val) + : MArray<double> (dv.redim (2), val) { } Matrix (const Matrix& a) : MArray<double> (a) { }
--- a/liboctave/dRowVector.h +++ b/liboctave/dRowVector.h @@ -33,17 +33,20 @@ { public: - RowVector (void) : MArray<double> (1, 0) { } + RowVector (void) : MArray<double> (dim_vector (1, 0)) { } - explicit RowVector (octave_idx_type n) : MArray<double> (1, n) { } + explicit RowVector (octave_idx_type n) + : MArray<double> (dim_vector (1, n)) { } explicit RowVector (const dim_vector& dv) : MArray<double> (dv.as_row ()) { } - RowVector (octave_idx_type n, double val) : MArray<double> (1, n, val) { } + RowVector (octave_idx_type n, double val) + : MArray<double> (dim_vector (1, n), val) { } RowVector (const RowVector& a) : MArray<double> (a) { } RowVector (const MArray<double>& a) : MArray<double> (a.as_row ()) { } + RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { } RowVector& operator = (const RowVector& a)
--- a/liboctave/dSparse.cc +++ b/liboctave/dSparse.cc @@ -4035,7 +4035,7 @@ OCTAVE_LOCAL_BUFFER (double, DU, nr - 1); OCTAVE_LOCAL_BUFFER (double, D, nr); OCTAVE_LOCAL_BUFFER (double, DL, nr - 1); - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); if (mattype.is_dense ()) @@ -4334,7 +4334,7 @@ OCTAVE_LOCAL_BUFFER (double, DU, nr - 1); OCTAVE_LOCAL_BUFFER (double, D, nr); OCTAVE_LOCAL_BUFFER (double, DL, nr - 1); - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); if (mattype.is_dense ()) @@ -4549,9 +4549,9 @@ { if (calc_cond) { - Array<double> z (3 * nr, 1); + Array<double> z (dim_vector (3 * nr, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nr, 1); + Array<octave_idx_type> iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, @@ -4643,7 +4643,7 @@ } } - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, @@ -4671,9 +4671,9 @@ if (calc_cond) { char job = '1'; - Array<double> z (3 * nr, 1); + Array<double> z (dim_vector (3 * nr, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nr, 1); + Array<octave_idx_type> iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON, @@ -4797,9 +4797,9 @@ { if (calc_cond) { - Array<double> z (3 * nr, 1); + Array<double> z (dim_vector (3 * nr, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nr, 1); + Array<octave_idx_type> iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, @@ -4926,7 +4926,7 @@ } } - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, @@ -4952,9 +4952,9 @@ if (calc_cond) { char job = '1'; - Array<double> z (3 * nr, 1); + Array<double> z (dim_vector (3 * nr, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nr, 1); + Array<octave_idx_type> iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON, @@ -5117,9 +5117,9 @@ { if (calc_cond) { - Array<double> z (3 * nr, 1); + Array<double> z (dim_vector (3 * nr, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nr, 1); + Array<octave_idx_type> iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, @@ -5242,7 +5242,7 @@ } } - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, @@ -5268,9 +5268,9 @@ if (calc_cond) { char job = '1'; - Array<double> z (3 * nr, 1); + Array<double> z (dim_vector (3 * nr, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nr, 1); + Array<octave_idx_type> iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, @@ -5417,9 +5417,9 @@ { if (calc_cond) { - Array<double> z (3 * nr, 1); + Array<double> z (dim_vector (3 * nr, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nr, 1); + Array<octave_idx_type> iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, @@ -5572,7 +5572,7 @@ } } - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, @@ -5598,9 +5598,9 @@ if (calc_cond) { char job = '1'; - Array<double> z (3 * nr, 1); + Array<double> z (dim_vector (3 * nr, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nr, 1); + Array<octave_idx_type> iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON,
--- a/liboctave/dbleCHOL.cc +++ b/liboctave/dbleCHOL.cc @@ -128,9 +128,9 @@ octave_idx_type dpocon_info = 0; // Now calculate the condition number for non-singular matrix. - Array<double> z (3*n, 1); + Array<double> z (dim_vector (3*n, 1)); double *pz = z.fortran_vec (); - Array<octave_idx_type> iz (n, 1); + Array<octave_idx_type> iz (dim_vector (n, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, anorm, xrcond, pz, piz, dpocon_info @@ -421,7 +421,7 @@ else { Matrix a = chol_mat.transpose () * chol_mat; - Array<octave_idx_type> p (n, 1); + Array<octave_idx_type> p (dim_vector (n, 1)); for (octave_idx_type k = 0; k < n; k++) p(k) = k; if (i < j) {
--- a/liboctave/dbleHESS.cc +++ b/liboctave/dbleHESS.cc @@ -84,17 +84,17 @@ hess_mat = a; double *h = hess_mat.fortran_vec (); - Array<double> scale (n, 1); + Array<double> scale (dim_vector (n, 1)); double *pscale = scale.fortran_vec (); F77_XFCN (dgebal, DGEBAL, (F77_CONST_CHAR_ARG2 (&job, 1), n, h, n, ilo, ihi, pscale, info F77_CHAR_ARG_LEN (1))); - Array<double> tau (n-1, 1); + Array<double> tau (dim_vector (n-1, 1)); double *ptau = tau.fortran_vec (); - Array<double> work (lwork, 1); + Array<double> work (dim_vector (lwork, 1)); double *pwork = work.fortran_vec (); F77_XFCN (dgehrd, DGEHRD, (n, ilo, ihi, h, n, ptau, pwork,
--- a/liboctave/dbleQRP.cc +++ b/liboctave/dbleQRP.cc @@ -66,7 +66,7 @@ if (m > n && qr_type == qr_type_std) afact.resize (m, m); - MArray<octave_idx_type> jpvt (n, 1, 0); + MArray<octave_idx_type> jpvt (dim_vector (n, 1), 0); if (m > 0) {
--- a/liboctave/dbleSCHUR.cc +++ b/liboctave/dbleSCHUR.cc @@ -118,20 +118,21 @@ double *s = schur_mat.fortran_vec (); double *q = unitary_mat.fortran_vec (); - Array<double> wr (n, 1); + Array<double> wr (dim_vector (n, 1)); double *pwr = wr.fortran_vec (); - Array<double> wi (n, 1); + Array<double> wi (dim_vector (n, 1)); double *pwi = wi.fortran_vec (); - Array<double> work (lwork, 1); + Array<double> work (dim_vector (lwork, 1)); double *pwork = work.fortran_vec (); // BWORK is not referenced for the non-ordered Schur routine. - Array<octave_idx_type> bwork ((ord_char == 'N' || ord_char == 'n') ? 0 : n, 1); + octave_idx_type ntmp = (ord_char == 'N' || ord_char == 'n') ? 0 : n; + Array<octave_idx_type> bwork (dim_vector (ntmp, 1)); octave_idx_type *pbwork = bwork.fortran_vec (); - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type *piwork = iwork.fortran_vec (); F77_XFCN (dgeesx, DGEESX, (F77_CONST_CHAR_ARG2 (&jobvs, 1),
--- a/liboctave/dbleSVD.cc +++ b/liboctave/dbleSVD.cc @@ -146,7 +146,7 @@ octave_idx_type lwork = -1; - Array<double> work (1, 1); + Array<double> work (dim_vector (1, 1)); octave_idx_type one = 1; octave_idx_type m1 = std::max (m, one), nrow_vt1 = std::max (nrow_vt, one);
--- a/liboctave/eigs-base.cc +++ b/liboctave/eigs-base.cc @@ -849,7 +849,7 @@ } else { - Array<bool> checked(n, 1, false); + Array<bool> checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { octave_idx_type bidx = @@ -907,7 +907,7 @@ } } - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -923,7 +923,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -1010,7 +1010,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); eig_vec.resize (n, k); @@ -1172,7 +1172,7 @@ } else { - Array<bool> checked (n, 1, false); + Array<bool> checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { octave_idx_type bidx = @@ -1192,7 +1192,7 @@ if (have_b) bmat = 'G'; - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -1208,7 +1208,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -1347,7 +1347,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); eig_vec.resize (n, k); @@ -1501,7 +1501,7 @@ mode = 3; } - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -1517,7 +1517,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -1605,7 +1605,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); eig_vec.resize (n, k); @@ -1763,7 +1763,7 @@ } else { - Array<bool> checked (n, 1, false); + Array<bool> checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { octave_idx_type bidx = @@ -1821,7 +1821,7 @@ } } - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -1837,7 +1837,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -1924,7 +1924,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); Matrix eig_vec2 (n, k + 1); @@ -2128,7 +2128,7 @@ } else { - Array<bool> checked (n, 1, false); + Array<bool> checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { octave_idx_type bidx = @@ -2148,7 +2148,7 @@ if (have_b) bmat = 'G'; - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -2164,7 +2164,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -2303,7 +2303,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); Matrix eig_vec2 (n, k + 1); @@ -2505,7 +2505,7 @@ mode = 3; } - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -2521,7 +2521,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -2608,7 +2608,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); Matrix eig_vec2 (n, k + 1); @@ -2810,7 +2810,7 @@ } else { - Array<bool> checked (n, 1, false); + Array<bool> checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { octave_idx_type bidx = @@ -2868,7 +2868,7 @@ } } - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -2884,7 +2884,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -2971,7 +2971,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); eig_vec.resize (n, k); @@ -3134,7 +3134,7 @@ } else { - Array<bool> checked (n, 1, false); + Array<bool> checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { octave_idx_type bidx = @@ -3154,7 +3154,7 @@ if (have_b) bmat = 'G'; - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -3170,7 +3170,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -3311,7 +3311,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); eig_vec.resize (n, k); @@ -3471,7 +3471,7 @@ mode = 3; } - Array<octave_idx_type> ip (11, 1); + Array<octave_idx_type> ip (dim_vector (11, 1)); octave_idx_type *iparam = ip.fortran_vec (); ip(0) = 1; //ishift @@ -3487,7 +3487,7 @@ ip(10) = 0; // ip(7) to ip(10) return values - Array<octave_idx_type> iptr (14, 1); + Array<octave_idx_type> iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; @@ -3575,7 +3575,7 @@ // long as the HOWMNY arg is not "S", the logical array // is just workspace for ARPACK, so use int type to // avoid problems. - Array<octave_idx_type> s (p, 1); + Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); eig_vec.resize (n, k);
--- a/liboctave/fCColVector.h +++ b/liboctave/fCColVector.h @@ -37,20 +37,26 @@ public: - FloatComplexColumnVector (void) : MArray<FloatComplex> (0, 1) { } + FloatComplexColumnVector (void) + : MArray<FloatComplex> (dim_vector (0, 1)) { } - explicit FloatComplexColumnVector (octave_idx_type n) : MArray<FloatComplex> (n, 1) { } + explicit FloatComplexColumnVector (octave_idx_type n) + : MArray<FloatComplex> (dim_vector (n, 1)) { } explicit FloatComplexColumnVector (const dim_vector& dv) : MArray<FloatComplex> (dv.as_column ()) { } FloatComplexColumnVector (octave_idx_type n, const FloatComplex& val) - : MArray<FloatComplex> (n, 1, val) { } + : MArray<FloatComplex> (dim_vector (n, 1), val) { } + + FloatComplexColumnVector (const FloatComplexColumnVector& a) + : MArray<FloatComplex> (a) { } - FloatComplexColumnVector (const FloatComplexColumnVector& a) : MArray<FloatComplex> (a) { } + FloatComplexColumnVector (const MArray<FloatComplex>& a) + : MArray<FloatComplex> (a.as_column ()) { } - FloatComplexColumnVector (const MArray<FloatComplex>& a) : MArray<FloatComplex> (a.as_column ()) { } - FloatComplexColumnVector (const Array<FloatComplex>& a) : MArray<FloatComplex> (a.as_column ()) { } + FloatComplexColumnVector (const Array<FloatComplex>& a) + : MArray<FloatComplex> (a.as_column ()) { } explicit FloatComplexColumnVector (const FloatColumnVector& a);
--- a/liboctave/fCMatrix.cc +++ b/liboctave/fCMatrix.cc @@ -278,7 +278,7 @@ } FloatComplexMatrix::FloatComplexMatrix (const FloatDiagMatrix& a) - : MArray<FloatComplex> (a.rows (), a.cols (), 0.0) + : MArray<FloatComplex> (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); @@ -295,7 +295,7 @@ } FloatComplexMatrix::FloatComplexMatrix (const FloatComplexDiagMatrix& a) - : MArray<FloatComplex> (a.rows (), a.cols (), 0.0) + : MArray<FloatComplex> (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); @@ -310,15 +310,16 @@ } FloatComplexMatrix::FloatComplexMatrix (const charMatrix& a) - : MArray<FloatComplex> (a.rows (), a.cols (), 0.0) + : MArray<FloatComplex> (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.rows (); i++) for (octave_idx_type j = 0; j < a.cols (); j++) elem (i, j) = static_cast<unsigned char> (a.elem (i, j)); } -FloatComplexMatrix::FloatComplexMatrix (const FloatMatrix& re, const FloatMatrix& im) - : MArray<FloatComplex> (re.rows (), re.cols ()) +FloatComplexMatrix::FloatComplexMatrix (const FloatMatrix& re, + const FloatMatrix& im) + : MArray<FloatComplex> (re.dims ()) { if (im.rows () != rows () || im.cols () != cols ()) (*current_liboctave_error_handler) ("complex: internal error"); @@ -1066,13 +1067,13 @@ (*current_liboctave_error_handler) ("inverse requires square matrix"); else { - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); retval = *this; FloatComplex *tmp_data = retval.fortran_vec (); - Array<FloatComplex> z(1, 1); + Array<FloatComplex> z (dim_vector (1, 1)); octave_idx_type lwork = -1; // Query the optimum work array size. @@ -1103,7 +1104,7 @@ // Now calculate the condition number for non-singular matrix. octave_idx_type zgecon_info = 0; char job = '1'; - Array<float> rz (2 * nc, 1); + Array<float> rz (dim_vector (2 * nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, tmp_data, nr, anorm, @@ -1339,7 +1340,7 @@ octave_idx_type nn = 4*npts+15; - Array<FloatComplex> wsave (nn, 1); + Array<FloatComplex> wsave (dim_vector (nn, 1)); FloatComplex *pwsave = wsave.fortran_vec (); retval = *this; @@ -1380,7 +1381,7 @@ octave_idx_type nn = 4*npts+15; - Array<FloatComplex> wsave (nn, 1); + Array<FloatComplex> wsave (dim_vector (nn, 1)); FloatComplex *pwsave = wsave.fortran_vec (); retval = *this; @@ -1424,7 +1425,7 @@ octave_idx_type nn = 4*npts+15; - Array<FloatComplex> wsave (nn, 1); + Array<FloatComplex> wsave (dim_vector (nn, 1)); FloatComplex *pwsave = wsave.fortran_vec (); retval = *this; @@ -1446,7 +1447,7 @@ wsave.resize (nn, 1); pwsave = wsave.fortran_vec (); - Array<FloatComplex> tmp (npts, 1); + Array<FloatComplex> tmp (dim_vector (npts, 1)); FloatComplex *prow = tmp.fortran_vec (); F77_FUNC (cffti, CFFTI) (npts, pwsave); @@ -1490,7 +1491,7 @@ octave_idx_type nn = 4*npts+15; - Array<FloatComplex> wsave (nn, 1); + Array<FloatComplex> wsave (dim_vector (nn, 1)); FloatComplex *pwsave = wsave.fortran_vec (); retval = *this; @@ -1515,7 +1516,7 @@ wsave.resize (nn, 1); pwsave = wsave.fortran_vec (); - Array<FloatComplex> tmp (npts, 1); + Array<FloatComplex> tmp (dim_vector (npts, 1)); FloatComplex *prow = tmp.fortran_vec (); F77_FUNC (cffti, CFFTI) (npts, pwsave); @@ -1612,9 +1613,9 @@ } else { - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (nc, 1); + Array<float> rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1636,7 +1637,7 @@ if (typ == MatrixType::Full) { - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); FloatComplexMatrix atmp = *this; @@ -1663,9 +1664,9 @@ { // Now calc the condition number for non-singular matrix. char job = '1'; - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (2 * nc, 1); + Array<float> rz (dim_vector (2 * nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1728,9 +1729,9 @@ char uplo = 'U'; char dia = 'N'; - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (nc, 1); + Array<float> rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1756,9 +1757,9 @@ char uplo = 'L'; char dia = 'N'; - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (nc, 1); + Array<float> rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1802,9 +1803,9 @@ } else { - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (nc, 1); + Array<float> rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1822,16 +1823,16 @@ { octave_idx_type info = 0; - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); if(anorm < 0.) anorm = atmp.abs().sum(). row(static_cast<octave_idx_type>(0)).max(); - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (2 * nc, 1); + Array<float> rz (dim_vector (2 * nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1903,9 +1904,9 @@ char uplo = 'U'; char dia = 'N'; - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (nc, 1); + Array<float> rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -2004,9 +2005,9 @@ char uplo = 'L'; char dia = 'N'; - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (nc, 1); + Array<float> rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -2112,9 +2113,9 @@ { if (calc_cond) { - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (nc, 1); + Array<float> rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -2164,15 +2165,15 @@ { info = 0; - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); FloatComplexMatrix atmp = *this; FloatComplex *tmp_data = atmp.fortran_vec (); - Array<FloatComplex> z (2 * nc, 1); + Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (2 * nc, 1); + Array<float> rz (dim_vector (2 * nc, 1)); float *prz = rz.fortran_vec (); // Calculate the norm of the matrix, for later use. @@ -2619,13 +2620,13 @@ FloatComplex *tmp_data = atmp.fortran_vec (); FloatComplex *pretval = retval.fortran_vec (); - Array<float> s (minmn, 1); + Array<float> s (dim_vector (minmn, 1)); float *ps = s.fortran_vec (); // Ask ZGELSD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<FloatComplex> work (1, 1); + Array<FloatComplex> work (dim_vector (1, 1)); octave_idx_type smlsiz; F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("CGELSD", 6), @@ -2660,13 +2661,13 @@ n*(1+nrhs) + 2*nrhs); if (lrwork < 1) lrwork = 1; - Array<float> rwork (lrwork, 1); + Array<float> rwork (dim_vector (lrwork, 1)); float *prwork = rwork.fortran_vec (); octave_idx_type liwork = 3 * minmn * nlvl + 11 * minmn; if (liwork < 1) liwork = 1; - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type* piwork = iwork.fortran_vec (); F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, @@ -2816,13 +2817,13 @@ FloatComplex *tmp_data = atmp.fortran_vec (); FloatComplex *pretval = retval.fortran_vec (); - Array<float> s (minmn, 1); + Array<float> s (dim_vector (minmn, 1)); float *ps = s.fortran_vec (); // Ask ZGELSD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<FloatComplex> work (1, 1); + Array<FloatComplex> work (dim_vector (1, 1)); octave_idx_type smlsiz; F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("CGELSD", 6), @@ -2849,13 +2850,13 @@ + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1); if (lrwork < 1) lrwork = 1; - Array<float> rwork (lrwork, 1); + Array<float> rwork (dim_vector (lrwork, 1)); float *prwork = rwork.fortran_vec (); octave_idx_type liwork = 3 * minmn * nlvl + 11 * minmn; if (liwork < 1) liwork = 1; - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type* piwork = iwork.fortran_vec (); F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
--- a/liboctave/fCMatrix.h +++ b/liboctave/fCMatrix.h @@ -45,23 +45,29 @@ FloatComplexMatrix (void) : MArray<FloatComplex> () { } - FloatComplexMatrix (octave_idx_type r, octave_idx_type c) : MArray<FloatComplex> (r, c) { } + FloatComplexMatrix (octave_idx_type r, octave_idx_type c) + : MArray<FloatComplex> (dim_vector (r, c)) { } - FloatComplexMatrix (octave_idx_type r, octave_idx_type c, const FloatComplex& val) - : MArray<FloatComplex> (r, c, val) { } + FloatComplexMatrix (octave_idx_type r, octave_idx_type c, + const FloatComplex& val) + : MArray<FloatComplex> (dim_vector (r, c), val) { } - FloatComplexMatrix (const dim_vector& dv) : MArray<FloatComplex> (dv.redim (2)) { } + FloatComplexMatrix (const dim_vector& dv) + : MArray<FloatComplex> (dv.redim (2)) { } FloatComplexMatrix (const dim_vector& dv, const FloatComplex& val) : MArray<FloatComplex> (dv.redim (2), val) { } - FloatComplexMatrix (const FloatComplexMatrix& a) : MArray<FloatComplex> (a) { } + FloatComplexMatrix (const FloatComplexMatrix& a) + : MArray<FloatComplex> (a) { } template <class U> - FloatComplexMatrix (const MArray<U>& a) : MArray<FloatComplex> (a.as_matrix ()) { } + FloatComplexMatrix (const MArray<U>& a) + : MArray<FloatComplex> (a.as_matrix ()) { } template <class U> - FloatComplexMatrix (const Array<U>& a) : MArray<FloatComplex> (a.as_matrix ()) { } + FloatComplexMatrix (const Array<U>& a) + : MArray<FloatComplex> (a.as_matrix ()) { } explicit FloatComplexMatrix (const FloatMatrix& a);
--- a/liboctave/fCNDArray.cc +++ b/liboctave/fCNDArray.cc @@ -769,7 +769,7 @@ if (n == dimensions.length ()) { - Array<octave_idx_type> a_ra_idx (a_dv.length (), 1, 0); + Array<octave_idx_type> a_ra_idx (dim_vector (a_dv.length (), 1), 0); a_ra_idx.elem (0) = r; a_ra_idx.elem (1) = c;
--- a/liboctave/fCRowVector.h +++ b/liboctave/fCRowVector.h @@ -36,21 +36,29 @@ public: - FloatComplexRowVector (void) : MArray<FloatComplex> (1, 0) { } + FloatComplexRowVector (void) + : MArray<FloatComplex> (dim_vector (1, 0)) { } - explicit FloatComplexRowVector (octave_idx_type n) : MArray<FloatComplex> (1, n) { } + explicit FloatComplexRowVector (octave_idx_type n) + : MArray<FloatComplex> (dim_vector (1, n)) { } - explicit FloatComplexRowVector (const dim_vector& dv) : MArray<FloatComplex> (dv.as_row ()) { } + explicit FloatComplexRowVector (const dim_vector& dv) + : MArray<FloatComplex> (dv.as_row ()) { } FloatComplexRowVector (octave_idx_type n, const FloatComplex& val) - : MArray<FloatComplex> (1, n, val) { } + : MArray<FloatComplex> (dim_vector (1, n), val) { } - FloatComplexRowVector (const FloatComplexRowVector& a) : MArray<FloatComplex> (a) { } + FloatComplexRowVector (const FloatComplexRowVector& a) + : MArray<FloatComplex> (a) { } - FloatComplexRowVector (const MArray<FloatComplex>& a) : MArray<FloatComplex> (a.as_row ()) { } - FloatComplexRowVector (const Array<FloatComplex>& a) : MArray<FloatComplex> (a.as_row ()) { } + FloatComplexRowVector (const MArray<FloatComplex>& a) + : MArray<FloatComplex> (a.as_row ()) { } - explicit FloatComplexRowVector (const FloatRowVector& a) : MArray<FloatComplex> (a) { } + FloatComplexRowVector (const Array<FloatComplex>& a) + : MArray<FloatComplex> (a.as_row ()) { } + + explicit FloatComplexRowVector (const FloatRowVector& a) + : MArray<FloatComplex> (a) { } FloatComplexRowVector& operator = (const FloatComplexRowVector& a) {
--- a/liboctave/fCmplxCHOL.cc +++ b/liboctave/fCmplxCHOL.cc @@ -127,9 +127,9 @@ octave_idx_type cpocon_info = 0; // Now calculate the condition number for non-singular matrix. - Array<FloatComplex> z (2*n, 1); + Array<FloatComplex> z (dim_vector (2*n, 1)); FloatComplex *pz = z.fortran_vec (); - Array<float> rz (n, 1); + Array<float> rz (dim_vector (n, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, anorm, xrcond, pz, prz, cpocon_info @@ -419,7 +419,7 @@ else { FloatComplexMatrix a = chol_mat.hermitian () * chol_mat; - Array<octave_idx_type> p (n, 1); + Array<octave_idx_type> p (dim_vector (n, 1)); for (octave_idx_type k = 0; k < n; k++) p(k) = k; if (i < j) {
--- a/liboctave/fCmplxHESS.cc +++ b/liboctave/fCmplxHESS.cc @@ -87,17 +87,17 @@ hess_mat = a; FloatComplex *h = hess_mat.fortran_vec (); - Array<float> scale (n, 1); + Array<float> scale (dim_vector (n, 1)); float *pscale = scale.fortran_vec (); F77_XFCN (cgebal, CGEBAL, (F77_CONST_CHAR_ARG2 (&job, 1), n, h, n, ilo, ihi, pscale, info F77_CHAR_ARG_LEN (1))); - Array<FloatComplex> tau (n-1, 1); + Array<FloatComplex> tau (dim_vector (n-1, 1)); FloatComplex *ptau = tau.fortran_vec (); - Array<FloatComplex> work (lwork, 1); + Array<FloatComplex> work (dim_vector (lwork, 1)); FloatComplex *pwork = work.fortran_vec (); F77_XFCN (cgehrd, CGEHRD, (n, ilo, ihi, h, n, ptau, pwork, lwork, info));
--- a/liboctave/fCmplxQRP.cc +++ b/liboctave/fCmplxQRP.cc @@ -66,7 +66,7 @@ if (m > n && qr_type == qr_type_std) afact.resize (m, m); - MArray<octave_idx_type> jpvt (n, 1, 0); + MArray<octave_idx_type> jpvt (dim_vector (n, 1), 0); if (m > 0) {
--- a/liboctave/fCmplxSCHUR.cc +++ b/liboctave/fCmplxSCHUR.cc @@ -120,17 +120,18 @@ FloatComplex *s = schur_mat.fortran_vec (); FloatComplex *q = unitary_mat.fortran_vec (); - Array<float> rwork (n, 1); + Array<float> rwork (dim_vector (n, 1)); float *prwork = rwork.fortran_vec (); - Array<FloatComplex> w (n, 1); + Array<FloatComplex> w (dim_vector (n, 1)); FloatComplex *pw = w.fortran_vec (); - Array<FloatComplex> work (lwork, 1); + Array<FloatComplex> work (dim_vector (lwork, 1)); FloatComplex *pwork = work.fortran_vec (); // BWORK is not referenced for non-ordered Schur. - Array<octave_idx_type> bwork ((ord_char == 'N' || ord_char == 'n') ? 0 : n, 1); + octave_idx_type ntmp = (ord_char == 'N' || ord_char == 'n') ? 0 : n; + Array<octave_idx_type> bwork (dim_vector (ntmp, 1)); octave_idx_type *pbwork = bwork.fortran_vec (); F77_XFCN (cgeesx, CGEESX, (F77_CONST_CHAR_ARG2 (&jobvs, 1),
--- a/liboctave/fCmplxSVD.cc +++ b/liboctave/fCmplxSVD.cc @@ -146,13 +146,13 @@ octave_idx_type lrwork = 5*max_mn; - Array<float> rwork (lrwork, 1); + Array<float> rwork (dim_vector (lrwork, 1)); // Ask ZGESVD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<FloatComplex> work (1, 1); + Array<FloatComplex> work (dim_vector (1, 1)); octave_idx_type one = 1; octave_idx_type m1 = std::max (m, one), nrow_vt1 = std::max (nrow_vt, one);
--- a/liboctave/fColVector.h +++ b/liboctave/fColVector.h @@ -34,19 +34,24 @@ { public: - FloatColumnVector (void) : MArray<float> (0, 1) { } + FloatColumnVector (void) : MArray<float> (dim_vector (0, 1)) { } - explicit FloatColumnVector (octave_idx_type n) : MArray<float> (n, 1) { } + explicit FloatColumnVector (octave_idx_type n) + : MArray<float> (dim_vector (n, 1)) { } explicit FloatColumnVector (const dim_vector& dv) : MArray<float> (dv.as_column ()) { } - FloatColumnVector (octave_idx_type n, float val) : MArray<float> (n, 1, val) { } + FloatColumnVector (octave_idx_type n, float val) + : MArray<float> (dim_vector (n, 1), val) { } FloatColumnVector (const FloatColumnVector& a) : MArray<float> (a) { } - FloatColumnVector (const MArray<float>& a) : MArray<float> (a.as_column ()) { } - FloatColumnVector (const Array<float>& a) : MArray<float> (a.as_column ()) { } + FloatColumnVector (const MArray<float>& a) + : MArray<float> (a.as_column ()) { } + + FloatColumnVector (const Array<float>& a) + : MArray<float> (a.as_column ()) { } FloatColumnVector& operator = (const FloatColumnVector& a) {
--- a/liboctave/fEIG.cc +++ b/liboctave/fEIG.cc @@ -159,10 +159,10 @@ FloatMatrix atmp = a; float *tmp_data = atmp.fortran_vec (); - Array<float> wr (n, 1); + Array<float> wr (dim_vector (n, 1)); float *pwr = wr.fortran_vec (); - Array<float> wi (n, 1); + Array<float> wi (dim_vector (n, 1)); float *pwi = wi.fortran_vec (); volatile octave_idx_type nvr = calc_ev ? n : 0; @@ -185,7 +185,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work); - Array<float> work (lwork, 1); + Array<float> work (dim_vector (lwork, 1)); float *pwork = work.fortran_vec (); F77_XFCN (sgeev, SGEEV, (F77_CONST_CHAR_ARG2 ("N", 1), @@ -277,7 +277,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work); - Array<float> work (lwork, 1); + Array<float> work (dim_vector (lwork, 1)); float *pwork = work.fortran_vec (); F77_XFCN (ssyev, SSYEV, (F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -344,7 +344,7 @@ FloatComplex dummy_work; octave_idx_type lrwork = 2*n; - Array<float> rwork (lrwork, 1); + Array<float> rwork (dim_vector (lrwork, 1)); float *prwork = rwork.fortran_vec (); FloatComplex *dummy = 0; @@ -360,7 +360,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work.real ()); - Array<FloatComplex> work (lwork, 1); + Array<FloatComplex> work (dim_vector (lwork, 1)); FloatComplex *pwork = work.fortran_vec (); F77_XFCN (cgeev, CGEEV, (F77_CONST_CHAR_ARG2 ("N", 1), @@ -414,7 +414,7 @@ FloatComplex dummy_work; octave_idx_type lrwork = 3*n; - Array<float> rwork (lrwork, 1); + Array<float> rwork (dim_vector (lrwork, 1)); float *prwork = rwork.fortran_vec (); F77_XFCN (cheev, CHEEV, (F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -427,7 +427,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work.real ()); - Array<FloatComplex> work (lwork, 1); + Array<FloatComplex> work (dim_vector (lwork, 1)); FloatComplex *pwork = work.fortran_vec (); F77_XFCN (cheev, CHEEV, (F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -502,13 +502,13 @@ FloatMatrix btmp = b; float *btmp_data = btmp.fortran_vec (); - Array<float> ar (n, 1); + Array<float> ar (dim_vector (n, 1)); float *par = ar.fortran_vec (); - Array<float> ai (n, 1); + Array<float> ai (dim_vector (n, 1)); float *pai = ai.fortran_vec (); - Array<float> beta (n, 1); + Array<float> beta (dim_vector (n, 1)); float *pbeta = beta.fortran_vec (); volatile octave_idx_type nvr = calc_ev ? n : 0; @@ -533,7 +533,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work); - Array<float> work (lwork, 1); + Array<float> work (dim_vector (lwork, 1)); float *pwork = work.fortran_vec (); F77_XFCN (sggev, SGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), @@ -641,7 +641,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work); - Array<float> work (lwork, 1); + Array<float> work (dim_vector (lwork, 1)); float *pwork = work.fortran_vec (); F77_XFCN (ssygv, SSYGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -732,7 +732,7 @@ FloatComplex dummy_work; octave_idx_type lrwork = 8*n; - Array<float> rwork (lrwork, 1); + Array<float> rwork (dim_vector (lrwork, 1)); float *prwork = rwork.fortran_vec (); FloatComplex *dummy = 0; @@ -749,7 +749,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work.real ()); - Array<FloatComplex> work (lwork, 1); + Array<FloatComplex> work (dim_vector (lwork, 1)); FloatComplex *pwork = work.fortran_vec (); F77_XFCN (cggev, CGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), @@ -818,7 +818,7 @@ FloatComplex dummy_work; octave_idx_type lrwork = 3*n; - Array<float> rwork (lrwork, 1); + Array<float> rwork (dim_vector (lrwork, 1)); float *prwork = rwork.fortran_vec (); F77_XFCN (chegv, CHEGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -833,7 +833,7 @@ if (info == 0) { lwork = static_cast<octave_idx_type> (dummy_work.real ()); - Array<FloatComplex> work (lwork, 1); + Array<FloatComplex> work (dim_vector (lwork, 1)); FloatComplex *pwork = work.fortran_vec (); F77_XFCN (chegv, CHEGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1),
--- a/liboctave/fMatrix.cc +++ b/liboctave/fMatrix.cc @@ -250,14 +250,14 @@ } FloatMatrix::FloatMatrix (const FloatDiagMatrix& a) - : MArray<float> (a.rows (), a.cols (), 0.0) + : MArray<float> (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); } FloatMatrix::FloatMatrix (const PermMatrix& a) - : MArray<float> (a.rows (), a.cols (), 0.0) + : MArray<float> (a.dims (), 0.0) { const Array<octave_idx_type> ia (a.pvec ()); octave_idx_type len = a.rows (); @@ -278,7 +278,7 @@ } FloatMatrix::FloatMatrix (const charMatrix& a) - : MArray<float> (a.rows (), a.cols ()) + : MArray<float> (a.dims ()) { for (octave_idx_type i = 0; i < a.rows (); i++) for (octave_idx_type j = 0; j < a.cols (); j++) @@ -740,13 +740,13 @@ (*current_liboctave_error_handler) ("inverse requires square matrix"); else { - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); retval = *this; float *tmp_data = retval.fortran_vec (); - Array<float> z(1, 1); + Array<float> z(dim_vector (1, 1)); octave_idx_type lwork = -1; // Query the optimum work array size. @@ -777,7 +777,7 @@ // Now calculate the condition number for non-singular matrix. char job = '1'; - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, tmp_data, nr, anorm, @@ -1012,7 +1012,7 @@ octave_idx_type nn = 4*npts+15; - Array<FloatComplex> wsave (nn, 1); + Array<FloatComplex> wsave (dim_vector (nn, 1)); FloatComplex *pwsave = wsave.fortran_vec (); retval = FloatComplexMatrix (*this); @@ -1053,7 +1053,7 @@ octave_idx_type nn = 4*npts+15; - Array<FloatComplex> wsave (nn, 1); + Array<FloatComplex> wsave (dim_vector (nn, 1)); FloatComplex *pwsave = wsave.fortran_vec (); retval = FloatComplexMatrix (*this); @@ -1097,7 +1097,7 @@ octave_idx_type nn = 4*npts+15; - Array<FloatComplex> wsave (nn, 1); + Array<FloatComplex> wsave (dim_vector (nn, 1)); FloatComplex *pwsave = wsave.fortran_vec (); retval = FloatComplexMatrix (*this); @@ -1119,7 +1119,7 @@ wsave.resize (nn, 1); pwsave = wsave.fortran_vec (); - Array<FloatComplex> tmp (npts, 1); + Array<FloatComplex> tmp (dim_vector (npts, 1)); FloatComplex *prow = tmp.fortran_vec (); F77_FUNC (cffti, CFFTI) (npts, pwsave); @@ -1163,7 +1163,7 @@ octave_idx_type nn = 4*npts+15; - Array<FloatComplex> wsave (nn, 1); + Array<FloatComplex> wsave (dim_vector (nn, 1)); FloatComplex *pwsave = wsave.fortran_vec (); retval = FloatComplexMatrix (*this); @@ -1188,7 +1188,7 @@ wsave.resize (nn, 1); pwsave = wsave.fortran_vec (); - Array<FloatComplex> tmp (npts, 1); + Array<FloatComplex> tmp (dim_vector (npts, 1)); FloatComplex *prow = tmp.fortran_vec (); F77_FUNC (cffti, CFFTI) (npts, pwsave); @@ -1285,9 +1285,9 @@ } else { - Array<float> z (3 * nc, 1); + Array<float> z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1309,7 +1309,7 @@ if (typ == MatrixType::Full) { - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); FloatMatrix atmp = *this; @@ -1336,9 +1336,9 @@ { // Now calc the condition number for non-singular matrix. char job = '1'; - Array<float> z (4 * nc, 1); + Array<float> z (dim_vector (4 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1401,9 +1401,9 @@ char uplo = 'U'; char dia = 'N'; - Array<float> z (3 * nc, 1); + Array<float> z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1429,9 +1429,9 @@ char uplo = 'L'; char dia = 'N'; - Array<float> z (3 * nc, 1); + Array<float> z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1474,9 +1474,9 @@ } else { - Array<float> z (3 * nc, 1); + Array<float> z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1493,16 +1493,16 @@ { octave_idx_type info = 0; - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); if(anorm < 0.) anorm = atmp.abs().sum(). row(static_cast<octave_idx_type>(0)).max(); - Array<float> z (4 * nc, 1); + Array<float> z (dim_vector (4 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (sgetrf, SGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1573,9 +1573,9 @@ char uplo = 'U'; char dia = 'N'; - Array<float> z (3 * nc, 1); + Array<float> z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1673,9 +1673,9 @@ char uplo = 'L'; char dia = 'N'; - Array<float> z (3 * nc, 1); + Array<float> z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), @@ -1779,9 +1779,9 @@ { if (calc_cond) { - Array<float> z (3 * nc, 1); + Array<float> z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1831,7 +1831,7 @@ { info = 0; - Array<octave_idx_type> ipvt (nr, 1); + Array<octave_idx_type> ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); FloatMatrix atmp = *this; @@ -1839,9 +1839,9 @@ if(anorm < 0.) anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max(); - Array<float> z (4 * nc, 1); + Array<float> z (dim_vector (4 * nc, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (nc, 1); + Array<octave_idx_type> iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (sgetrf, SGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -2271,13 +2271,13 @@ float *tmp_data = atmp.fortran_vec (); float *pretval = retval.fortran_vec (); - Array<float> s (minmn, 1); + Array<float> s (dim_vector (minmn, 1)); float *ps = s.fortran_vec (); // Ask DGELSD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<float> work (1, 1); + Array<float> work (dim_vector (1, 1)); octave_idx_type smlsiz; F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("SGELSD", 6), @@ -2309,7 +2309,7 @@ octave_idx_type liwork = 3 * minmn * nlvl + 11 * minmn; if (liwork < 1) liwork = 1; - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type* piwork = iwork.fortran_vec (); F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, @@ -2469,13 +2469,13 @@ float *tmp_data = atmp.fortran_vec (); float *pretval = retval.fortran_vec (); - Array<float> s (minmn, 1); + Array<float> s (dim_vector (minmn, 1)); float *ps = s.fortran_vec (); // Ask DGELSD what the dimension of WORK should be. octave_idx_type lwork = -1; - Array<float> work (1, 1); + Array<float> work (dim_vector (1, 1)); octave_idx_type smlsiz; F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("SGELSD", 6), @@ -2500,7 +2500,7 @@ octave_idx_type liwork = 3 * minmn * nlvl + 11 * minmn; if (liwork < 1) liwork = 1; - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type* piwork = iwork.fortran_vec (); F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
--- a/liboctave/fMatrix.h +++ b/liboctave/fMatrix.h @@ -44,13 +44,16 @@ FloatMatrix (void) : MArray<float> () { } - FloatMatrix (octave_idx_type r, octave_idx_type c) : MArray<float> (r, c) { } + FloatMatrix (octave_idx_type r, octave_idx_type c) + : MArray<float> (dim_vector (r, c)) { } - FloatMatrix (octave_idx_type r, octave_idx_type c, float val) : MArray<float> (r, c, val) { } + FloatMatrix (octave_idx_type r, octave_idx_type c, float val) + : MArray<float> (dim_vector (r, c), val) { } FloatMatrix (const dim_vector& dv) : MArray<float> (dv.redim (2)) { } - FloatMatrix (const dim_vector& dv, float val) : MArray<float> (dv.redim (2), val) { } + FloatMatrix (const dim_vector& dv, float val) + : MArray<float> (dv.redim (2), val) { } FloatMatrix (const FloatMatrix& a) : MArray<float> (a) { }
--- a/liboctave/fRowVector.h +++ b/liboctave/fRowVector.h @@ -33,17 +33,21 @@ { public: - FloatRowVector (void) : MArray<float> (1, 0) { } + FloatRowVector (void) : MArray<float> (dim_vector (1, 0)) { } - explicit FloatRowVector (octave_idx_type n) : MArray<float> (1, n) { } + explicit FloatRowVector (octave_idx_type n) + : MArray<float> (dim_vector (1, n)) { } - explicit FloatRowVector (const dim_vector& dv) : MArray<float> (dv.as_row ()) { } + explicit FloatRowVector (const dim_vector& dv) + : MArray<float> (dv.as_row ()) { } - FloatRowVector (octave_idx_type n, float val) : MArray<float> (1, n, val) { } + FloatRowVector (octave_idx_type n, float val) + : MArray<float> (dim_vector (1, n), val) { } FloatRowVector (const FloatRowVector& a) : MArray<float> (a) { } FloatRowVector (const MArray<float>& a) : MArray<float> (a.as_row ()) { } + FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { } FloatRowVector& operator = (const FloatRowVector& a)
--- a/liboctave/floatCHOL.cc +++ b/liboctave/floatCHOL.cc @@ -128,9 +128,9 @@ octave_idx_type spocon_info = 0; // Now calculate the condition number for non-singular matrix. - Array<float> z (3*n, 1); + Array<float> z (dim_vector (3*n, 1)); float *pz = z.fortran_vec (); - Array<octave_idx_type> iz (n, 1); + Array<octave_idx_type> iz (dim_vector (n, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, anorm, xrcond, pz, piz, spocon_info @@ -421,7 +421,7 @@ else { FloatMatrix a = chol_mat.transpose () * chol_mat; - Array<octave_idx_type> p (n, 1); + Array<octave_idx_type> p (dim_vector (n, 1)); for (octave_idx_type k = 0; k < n; k++) p(k) = k; if (i < j) {
--- a/liboctave/floatHESS.cc +++ b/liboctave/floatHESS.cc @@ -84,17 +84,17 @@ hess_mat = a; float *h = hess_mat.fortran_vec (); - Array<float> scale (n, 1); + Array<float> scale (dim_vector (n, 1)); float *pscale = scale.fortran_vec (); F77_XFCN (sgebal, SGEBAL, (F77_CONST_CHAR_ARG2 (&job, 1), n, h, n, ilo, ihi, pscale, info F77_CHAR_ARG_LEN (1))); - Array<float> tau (n-1, 1); + Array<float> tau (dim_vector (n-1, 1)); float *ptau = tau.fortran_vec (); - Array<float> work (lwork, 1); + Array<float> work (dim_vector (lwork, 1)); float *pwork = work.fortran_vec (); F77_XFCN (sgehrd, SGEHRD, (n, ilo, ihi, h, n, ptau, pwork,
--- a/liboctave/floatQRP.cc +++ b/liboctave/floatQRP.cc @@ -66,7 +66,7 @@ if (m > n && qr_type == qr_type_std) afact.resize (m, m); - MArray<octave_idx_type> jpvt (n, 1, 0); + MArray<octave_idx_type> jpvt (dim_vector (n, 1), 0); if (m > 0) {
--- a/liboctave/floatSCHUR.cc +++ b/liboctave/floatSCHUR.cc @@ -118,20 +118,21 @@ float *s = schur_mat.fortran_vec (); float *q = unitary_mat.fortran_vec (); - Array<float> wr (n, 1); + Array<float> wr (dim_vector (n, 1)); float *pwr = wr.fortran_vec (); - Array<float> wi (n, 1); + Array<float> wi (dim_vector (n, 1)); float *pwi = wi.fortran_vec (); - Array<float> work (lwork, 1); + Array<float> work (dim_vector (lwork, 1)); float *pwork = work.fortran_vec (); // BWORK is not referenced for the non-ordered Schur routine. - Array<octave_idx_type> bwork ((ord_char == 'N' || ord_char == 'n') ? 0 : n, 1); + octave_idx_type ntmp = (ord_char == 'N' || ord_char == 'n') ? 0 : n; + Array<octave_idx_type> bwork (dim_vector (ntmp, 1)); octave_idx_type *pbwork = bwork.fortran_vec (); - Array<octave_idx_type> iwork (liwork, 1); + Array<octave_idx_type> iwork (dim_vector (liwork, 1)); octave_idx_type *piwork = iwork.fortran_vec (); F77_XFCN (sgeesx, SGEESX, (F77_CONST_CHAR_ARG2 (&jobvs, 1),
--- a/liboctave/floatSVD.cc +++ b/liboctave/floatSVD.cc @@ -146,7 +146,7 @@ octave_idx_type lwork = -1; - Array<float> work (1, 1); + Array<float> work (dim_vector (1, 1)); octave_idx_type one = 1; octave_idx_type m1 = std::max (m, one), nrow_vt1 = std::max (nrow_vt, one);
--- a/liboctave/glob-match.h +++ b/liboctave/glob-match.h @@ -74,7 +74,7 @@ { int n = str.length (); - Array<bool> retval (n, 1); + Array<bool> retval (dim_vector (n, 1)); for (int i = 0; i < n; i++) retval(i) = match (str[i]);
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -741,7 +741,7 @@ return *aowner; else { - Array<bool> retval (ext, 1); + Array<bool> retval (dim_vector (ext, 1)); for (octave_idx_type i = 0; i < ext; i++) retval.xelem (i) = data[i]; return retval; @@ -1117,7 +1117,7 @@ { idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); octave_idx_type nz = r->length (0), ext = r->extent (0); - Array<bool> mask (n, 1); + Array<bool> mask (dim_vector (n, 1)); const bool *data = r->get_data (); bool *ndata = mask.fortran_vec (); for (octave_idx_type i = 0; i < ext; i++) @@ -1128,7 +1128,7 @@ } else { - Array<bool> mask (n, 1, true); + Array<bool> mask (dim_vector (n, 1), true); fill (false, length (n), mask.fortran_vec ()); retval = idx_vector (mask); }
--- a/liboctave/oct-convn.cc +++ b/liboctave/oct-convn.cc @@ -134,7 +134,7 @@ if (ct == convn_same) { // Pick the relevant part. - Array<idx_vector> sidx (nd, 1); + Array<idx_vector> sidx (dim_vector (nd, 1)); for (int i = 0; i < nd; i++) sidx(i) = idx_vector::make_range ((bdims(i)-1)/2, 1, adims(i));
--- a/liboctave/oct-norm.cc +++ b/liboctave/oct-norm.cc @@ -226,7 +226,7 @@ template <class T, class R, class ACC> void column_norms (const MArray<T>& m, MArray<R>& res, ACC acc) { - res = MArray<R> (1, m.columns ()); + res = MArray<R> (dim_vector (1, m.columns ())); for (octave_idx_type j = 0; j < m.columns (); j++) { ACC accj = acc; @@ -240,7 +240,7 @@ template <class T, class R, class ACC> void row_norms (const MArray<T>& m, MArray<R>& res, ACC acc) { - res = MArray<R> (m.rows (), 1); + res = MArray<R> (dim_vector (m.rows (), 1)); std::vector<ACC> acci (m.rows (), acc); for (octave_idx_type j = 0; j < m.columns (); j++) { @@ -256,7 +256,7 @@ template <class T, class R, class ACC> void column_norms (const MSparse<T>& m, MArray<R>& res, ACC acc) { - res = MArray<R> (1, m.columns ()); + res = MArray<R> (dim_vector (1, m.columns ())); for (octave_idx_type j = 0; j < m.columns (); j++) { ACC accj = acc; @@ -270,7 +270,7 @@ template <class T, class R, class ACC> void row_norms (const MSparse<T>& m, MArray<R>& res, ACC acc) { - res = MArray<R> (m.rows (), 1); + res = MArray<R> (dim_vector (m.rows (), 1)); std::vector<ACC> acci (m.rows (), acc); for (octave_idx_type j = 0; j < m.columns (); j++) {
--- a/liboctave/regex-match.cc +++ b/liboctave/regex-match.cc @@ -140,7 +140,7 @@ { int n = s.length (); - Array<bool> retval (n, 1); + Array<bool> retval (dim_vector (n, 1)); for (int i = 0; i < n; i++) retval(i) = match (s[i]);
--- a/liboctave/sparse-dmsolve.cc +++ b/liboctave/sparse-dmsolve.cc @@ -130,7 +130,7 @@ octave_idx_type new_r = r2 - r1 + 1; octave_idx_type new_c = c2 - c1 + 1; - MArray<T> result (new_r, new_c); + MArray<T> result (dim_vector (new_r, new_c)); for (octave_idx_type j = 0; j < new_c; j++) for (octave_idx_type i = 0; i < new_r; i++)
--- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -97,7 +97,7 @@ // nonnegative. string_vector::string_vector (const char * const *s, octave_idx_type n) - : Array<std::string> (n, 1) + : Array<std::string> (dim_vector (n, 1)) { for (octave_idx_type i = 0; i < n; i++) elem (i) = s[i];
--- a/liboctave/str-vec.h +++ b/liboctave/str-vec.h @@ -38,11 +38,14 @@ string_vector (void) : Array<std::string> () { } - explicit string_vector (octave_idx_type n) : Array<std::string> (n, 1) { } + explicit string_vector (octave_idx_type n) + : Array<std::string> (dim_vector (n, 1)) { } - string_vector (const char *s) : Array<std::string> (1, 1, s) { } + string_vector (const char *s) + : Array<std::string> (dim_vector (1, 1), s) { } - string_vector (const std::string& s) : Array<std::string> (1, 1, s) { } + string_vector (const std::string& s) + : Array<std::string> (dim_vector (1, 1), s) { } string_vector (const string_vector& s) : Array<std::string> (s) { }
--- a/src/Cell.cc +++ b/src/Cell.cc @@ -173,7 +173,8 @@ idx_vector i = idx_arg(0).index_vector (); if (! error_state) - retval = Array<octave_value>::index (i, resize_ok, resize_fill_value ()); + retval = Array<octave_value>::index (i, resize_ok, + resize_fill_value ()); } break; @@ -194,7 +195,7 @@ default: { - Array<idx_vector> iv (n, 1); + Array<idx_vector> iv (dim_vector (n, 1)); for (octave_idx_type i = 0; i < n; i++) { @@ -221,7 +222,7 @@ { octave_idx_type len = idx_arg.length (); - Array<idx_vector> ra_idx (len, 1); + Array<idx_vector> ra_idx (dim_vector (len, 1)); for (octave_idx_type i = 0; i < len; i++) ra_idx(i) = idx_arg(i).index_vector (); @@ -235,7 +236,7 @@ { octave_idx_type len = idx_arg.length (); - Array<idx_vector> ra_idx (len, 1); + Array<idx_vector> ra_idx (dim_vector (len, 1)); for (octave_idx_type i = 0; i < len; i++) ra_idx.xelem (i) = idx_arg(i).index_vector ();
--- a/src/DLD-FUNCTIONS/__glpk__.cc +++ b/src/DLD-FUNCTIONS/__glpk__.cc @@ -595,7 +595,7 @@ double *lb = LB.fortran_vec (); //-- LB argument, default: Free - Array<int> freeLB (mrowsc, 1); + Array<int> freeLB (dim_vector (mrowsc, 1)); for (int i = 0; i < mrowsc; i++) { if (xisinf (lb[i])) @@ -619,7 +619,7 @@ double *ub = UB.fortran_vec (); - Array<int> freeUB (mrowsc, 1); + Array<int> freeUB (dim_vector (mrowsc, 1)); for (int i = 0; i < mrowsc; i++) { if (xisinf (ub[i])) @@ -652,7 +652,7 @@ return retval; } - Array<int> vartype (mrowsc, 1); + Array<int> vartype (dim_vector (mrowsc, 1)); volatile int isMIP = 0; for (int i = 0; i < mrowsc ; i++) {
--- a/src/DLD-FUNCTIONS/__magick_read__.cc +++ b/src/DLD-FUNCTIONS/__magick_read__.cc @@ -438,7 +438,7 @@ } else { - frameidx = Array<int> (1, 1); + frameidx = Array<int> (dim_vector (1, 1)); frameidx(0) = 1; } @@ -466,7 +466,7 @@ int nframes = imvec.size (); if (all_frames) { - frameidx = Array<int> (1, nframes); + frameidx = Array<int> (dim_vector (1, nframes)); for (int i = 0; i < frameidx.length (); i++) frameidx(i) = i; } @@ -592,7 +592,7 @@ if (dsizes.length () == 4) nframes = dsizes(3); - Array<octave_idx_type> idx (dsizes.length (), 1); + Array<octave_idx_type> idx (dim_vector (dsizes.length (), 1)); octave_idx_type rows = m.rows (); octave_idx_type columns = m.columns (); @@ -660,7 +660,7 @@ bool is_color = ((dsizes.length () > 2) && (dsizes(2) > 2)); bool has_alpha = (dsizes.length () > 2 && (dsizes(2) == 2 || dsizes(2) == 4)); - Array<octave_idx_type> idx (dsizes.length (), 1); + Array<octave_idx_type> idx (dim_vector (dsizes.length (), 1)); octave_idx_type rows = m.rows (); octave_idx_type columns = m.columns ();
--- a/src/DLD-FUNCTIONS/bsxfun.cc +++ b/src/DLD-FUNCTIONS/bsxfun.cc @@ -438,7 +438,7 @@ octave_value_list idxB; octave_value C; octave_value_list inputs; - Array<int> ra_idx (dvc.length(), 1, 0); + Array<int> ra_idx (dim_vector (dvc.length(), 1), 0); for (octave_idx_type i = 0; i < ncount; i++)
--- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -1188,8 +1188,8 @@ } OCTAVE_LOCAL_BUFFER_INIT (octave_idx_type, ridx, nd, 0); - NoAlias< Array<idx_vector> > ra_idx (1, std::max (nd, a.ndims ()), - idx_vector::colon); + NoAlias< Array<idx_vector> > ra_idx + (dim_vector (1, std::max (nd, a.ndims ())), idx_vector::colon); for (octave_idx_type j = 0; j < retval.numel (); j++) { @@ -1432,7 +1432,7 @@ dim = dv.first_non_singleton (); ndims = std::max (ndims, dim + 1); - Array<idx_vector> idx (ndims, 1, idx_vector::colon); + Array<idx_vector> idx (dim_vector (ndims, 1), idx_vector::colon); for (octave_idx_type i = 0; i < n && ! error_state; i++) {
--- a/src/DLD-FUNCTIONS/kron.cc +++ b/src/DLD-FUNCTIONS/kron.cc @@ -58,7 +58,7 @@ octave_idx_type nra = a.rows (), nrb = b.rows (); octave_idx_type nca = a.cols (), ncb = b.cols (); - MArray<T> c (nra*nrb, nca*ncb); + MArray<T> c (dim_vector (nra*nrb, nca*ncb)); T *cv = c.fortran_vec (); for (octave_idx_type ja = 0; ja < nca; ja++) @@ -82,7 +82,7 @@ octave_idx_type nra = a.rows (), nrb = b.rows (), dla = a.diag_length (); octave_idx_type nca = a.cols (), ncb = b.cols (); - MArray<T> c (nra*nrb, nca*ncb, T()); + MArray<T> c (dim_vector (nra*nrb, nca*ncb), T()); for (octave_idx_type ja = 0; ja < dla; ja++) for (octave_idx_type jb = 0; jb < ncb; jb++)
--- a/src/DLD-FUNCTIONS/lookup.cc +++ b/src/DLD-FUNCTIONS/lookup.cc @@ -325,7 +325,7 @@ else if (str_case) { Array<std::string> str_table = table.cellstr_value (); - Array<std::string> str_y (1, 1); + Array<std::string> str_y (dim_vector (1, 1)); if (y.is_cellstr ()) str_y = y.cellstr_value ();
--- a/src/DLD-FUNCTIONS/qz.cc +++ b/src/DLD-FUNCTIONS/qz.cc @@ -867,7 +867,7 @@ std::cout << std::endl; #endif - Array<octave_idx_type> ind (nn, 1); + Array<octave_idx_type> ind (dim_vector (nn, 1)); F77_XFCN (dsubsp, DSUBSP, (nn, nn, aa.fortran_vec (), bb.fortran_vec (),
--- a/src/DLD-FUNCTIONS/sub2ind.cc +++ b/src/DLD-FUNCTIONS/sub2ind.cc @@ -89,7 +89,7 @@ else { dim_vector dv = get_dim_vector (args(0), "sub2ind"); - Array<idx_vector> idxa (nargin - 1, 1); + Array<idx_vector> idxa (dim_vector (nargin-1, 1)); if (! error_state) {
--- a/src/DLD-FUNCTIONS/tril.cc +++ b/src/DLD-FUNCTIONS/tril.cc @@ -51,7 +51,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, 1); + Array<T> r (dim_vector (n, 1)); T *rvec = r.fortran_vec (); for (octave_idx_type j = 0; j < nc; j++) { @@ -92,7 +92,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, 1); + Array<T> r (dim_vector (n, 1)); T *rvec = r.fortran_vec (); for (octave_idx_type j = 0; j < nc; j++) {
--- a/src/data.cc +++ b/src/data.cc @@ -1635,7 +1635,7 @@ return retval; int dv_len = dv.length (); - Array<octave_idx_type> ra_idx (dv_len, 1, 0); + Array<octave_idx_type> ra_idx (dim_vector (dv_len, 1), 0); for (int j = 0; j < n_args; j++) {
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -1147,7 +1147,7 @@ Array<double> size = (nargin == 3) ? args(2).vector_value () - : Array<double> (1, 1, lo_ieee_inf_value ()); + : Array<double> (dim_vector (1, 1), lo_ieee_inf_value ()); if (! error_state) { @@ -1232,7 +1232,8 @@ Array<double> size = (nargin == 3) ? args(2).vector_value () - : Array<double> (1, 1, lo_ieee_inf_value ()); + : Array<double> (dim_vector (1, 1), + lo_ieee_inf_value ()); octave_value tmp = os.scanf (args(1), size, count, who);
--- a/src/gl-render.cc +++ b/src/gl-render.cc @@ -2554,7 +2554,7 @@ clip(i) = is_nan_or_inf (v(i,0), v(i,1), 0); boolMatrix clip_f (1, nf, false); - Array<int> count_f (nf, 1, 0); + Array<int> count_f (dim_vector (nf, 1), 0); for (int i = 0; i < nf; i++) {
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -640,7 +640,7 @@ { new_map_list[idx] = map_list[idx]; - Array<octave_idx_type> perm (1, nf); + Array<octave_idx_type> perm (dim_vector (1, nf)); for (octave_idx_type i = 0; i < n; i++) { @@ -888,7 +888,7 @@ default: { - Array<idx_vector> ia (n_idx, 1); + Array<idx_vector> ia (dim_vector (n_idx, 1)); for (octave_idx_type i = 0; i < n_idx; i++) { @@ -917,7 +917,7 @@ octave_map octave_map::page (octave_idx_type k) const { - static Array<idx_vector> ia (3, 1, idx_vector::colon); + static Array<idx_vector> ia (dim_vector (3, 1), idx_vector::colon); ia(2) = k; return index (ia); @@ -1082,7 +1082,7 @@ default: { - Array<idx_vector> ia (n_idx, 1); + Array<idx_vector> ia (dim_vector (n_idx, 1)); for (octave_idx_type i = 0; i < n_idx; i++) { @@ -1195,7 +1195,7 @@ { octave_idx_type n_idx = idx.length (); - Array<idx_vector> ia (n_idx, 1); + Array<idx_vector> ia (dim_vector (n_idx, 1)); for (octave_idx_type i = 0; i < n_idx; i++) { @@ -1698,7 +1698,7 @@ if (n_idx > 0) { - Array<idx_vector> ra_idx (n_idx, 1); + Array<idx_vector> ra_idx (dim_vector (n_idx, 1)); for (octave_idx_type i = 0; i < n_idx; i++) {
--- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -50,7 +50,7 @@ : data (dim_vector (1, n), val) { } octave_value_list (const octave_value& tc) - : data (1, 1, tc) { } + : data (dim_vector (1, 1), tc) { } octave_value_list (const Array<octave_value>& d) : data (d.as_row ()) { }
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -154,7 +154,7 @@ } scanf_format_list::scanf_format_list (const std::string& s) - : nconv (0), curr_idx (0), list (16, 1), buf (0) + : nconv (0), curr_idx (0), list (dim_vector (16, 1)), buf (0) { octave_idx_type num_elts = 0; @@ -574,7 +574,7 @@ // Ugh again. printf_format_list::printf_format_list (const std::string& s) - : nconv (0), curr_idx (0), list (16, 1), buf (0) + : nconv (0), curr_idx (0), list (dim_vector (16, 1)), buf (0) { octave_idx_type num_elts = 0;
--- a/src/oct-stream.h +++ b/src/oct-stream.h @@ -158,6 +158,7 @@ // Index to current element; octave_idx_type curr_idx; + // FIXME -- maybe LIST should be a std::list object? // List of format elements. Array<scanf_format_elt*> list; @@ -291,6 +292,7 @@ // Index to current element; octave_idx_type curr_idx; + // FIXME -- maybe LIST should be a std::list object? // List of format elements. Array<printf_format_elt*> list;
--- a/src/ov-base-mat.cc +++ b/src/ov-base-mat.cc @@ -181,7 +181,7 @@ default: { - Array<idx_vector> idx_vec (n_idx, 1); + Array<idx_vector> idx_vec (dim_vector (n_idx, 1)); bool scalar_opt = n_idx == nd && ! resize_ok; const dim_vector dv = matrix.dims (); @@ -246,7 +246,7 @@ default: { - Array<idx_vector> idx_vec (n_idx, 1); + Array<idx_vector> idx_vec (dim_vector (n_idx, 1)); for (octave_idx_type i = 0; i < n_idx; i++) { @@ -330,7 +330,7 @@ default: { - Array<idx_vector> idx_vec (n_idx, 1); + Array<idx_vector> idx_vec (dim_vector (n_idx, 1)); bool scalar_opt = n_idx == nd; const dim_vector dv = matrix.dims ().redim (n_idx); @@ -376,7 +376,7 @@ { octave_idx_type len = idx.length (); - Array<idx_vector> ra_idx (len, 1); + Array<idx_vector> ra_idx (dim_vector (len, 1)); for (octave_idx_type i = 0; i < len; i++) ra_idx(i) = idx(i).index_vector ();
--- a/src/ov-base-scalar.cc +++ b/src/ov-base-scalar.cc @@ -103,21 +103,21 @@ octave_value octave_base_scalar<ST>::permute (const Array<int>& vec, bool inv) const { - return Array<ST> (1, 1, scalar).permute (vec, inv); + return Array<ST> (dim_vector (1, 1), scalar).permute (vec, inv); } template <class ST> octave_value octave_base_scalar<ST>::reshape (const dim_vector& new_dims) const { - return Array<ST> (1, 1, scalar).reshape (new_dims); + return Array<ST> (dim_vector (1, 1), scalar).reshape (new_dims); } template <class ST> octave_value octave_base_scalar<ST>::diag (octave_idx_type k) const { - return Array<ST> (1, 1, scalar).diag (k); + return Array<ST> (dim_vector (1, 1), scalar).diag (k); } template <class ST>
--- a/src/ov-base-scalar.h +++ b/src/ov-base-scalar.h @@ -109,7 +109,7 @@ { return mode ? mode : ASCENDING; } Array<octave_idx_type> sort_rows_idx (sortmode) const - { return Array<octave_idx_type> (1, 0); } + { return Array<octave_idx_type> (dim_vector (1, 0)); } sortmode is_sorted_rows (sortmode mode = UNSORTED) const { return mode ? mode : ASCENDING; }
--- a/src/ov-perm.cc +++ b/src/ov-perm.cc @@ -286,7 +286,7 @@ } else { - Array<octave_idx_type> pvec (n, 1); + Array<octave_idx_type> pvec (dim_vector (n, 1)); for (octave_idx_type i = 0; i < n; i++) pvec(i) = tmp(i) - 1; matrix = PermMatrix (pvec, colp); @@ -326,7 +326,7 @@ && is.read (reinterpret_cast<char *> (&colp), 1))) return false; - MArray<octave_idx_type> m (sz, 1); + MArray<octave_idx_type> m (dim_vector (sz, 1)); if (! is.read (reinterpret_cast<char *> (m.fortran_vec ()), m.byte_size ())) return false;
--- a/src/ov-range.h +++ b/src/ov-range.h @@ -150,7 +150,7 @@ { return range.is_sorted (mode); } Array<octave_idx_type> sort_rows_idx (sortmode) const - { return Array<octave_idx_type> (1, 0); } + { return Array<octave_idx_type> (dim_vector (1, 0)); } sortmode is_sorted_rows (sortmode mode = UNSORTED) const { return mode ? mode : ASCENDING; }
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -123,7 +123,7 @@ default: { - Array<idx_vector> idx_vec (len, 1); + Array<idx_vector> idx_vec (dim_vector (len, 1)); for (octave_idx_type i = 0; i < len; i++) idx_vec(i) = idx(i).index_vector ();
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -2081,7 +2081,7 @@ } octave_map map (rdv); - Array<idx_vector> ia (nd, 1, idx_vector::colon); + Array<idx_vector> ia (dim_vector (nd, 1), idx_vector::colon); for (octave_idx_type i = 0; i < ext; i++) {
--- a/src/ov-typeinfo.cc +++ b/src/ov-typeinfo.cc @@ -36,7 +36,6 @@ octave_value_typeinfo::instance (0); #include <Array.h> -#include <Array3.h> bool octave_value_typeinfo::instance_ok (void) @@ -191,32 +190,34 @@ { len *= 2; - types.resize (len, 1, std::string ()); + types.resize (dim_vector (len, 1), std::string ()); - vals.resize (len, 1, octave_value ()); + vals.resize (dim_vector (len, 1), octave_value ()); - unary_ops.resize (static_cast<int> (octave_value::num_unary_ops), len, 0); + unary_ops.resize (dim_vector (octave_value::num_unary_ops, len), 0); non_const_unary_ops.resize - (static_cast<int> (octave_value::num_unary_ops), len, 0); + (dim_vector (octave_value::num_unary_ops, len), 0); - binary_ops.resize (static_cast<int> (octave_value::num_binary_ops), - len, len, 0); + binary_ops.resize + (dim_vector (octave_value::num_binary_ops, len, len), 0); - compound_binary_ops.resize (static_cast<int> (octave_value::num_compound_binary_ops), - len, len, 0); + compound_binary_ops.resize + (dim_vector (octave_value::num_compound_binary_ops, len, len), 0); - cat_ops.resize (len, len, 0); + cat_ops.resize (dim_vector (len, len), 0); - assign_ops.resize (static_cast<int> (octave_value::num_assign_ops), len, len, 0); + assign_ops.resize + (dim_vector (octave_value::num_assign_ops, len, len), 0); - assignany_ops.resize (static_cast<int> (octave_value::num_assign_ops), len, 0); + assignany_ops.resize + (dim_vector (octave_value::num_assign_ops, len), 0); - pref_assign_conv.resize (len, len, -1); + pref_assign_conv.resize (dim_vector (len, len), -1); - type_conv_ops.resize (len, len, 0); + type_conv_ops.resize (dim_vector (len, len), 0); - widening_ops.resize (len, len, 0); + widening_ops.resize (dim_vector (len, len), 0); } types (i) = t_name;
--- a/src/ov-typeinfo.h +++ b/src/ov-typeinfo.h @@ -26,7 +26,6 @@ #include <string> #include "Array.h" -#include "Array3.h" #include "ov.h" @@ -51,7 +50,8 @@ (const octave_base_value&, const octave_base_value&); typedef octave_value (*cat_op_fcn) - (octave_base_value&, const octave_base_value&, const Array<octave_idx_type>& ra_idx); + (octave_base_value&, const octave_base_value&, + const Array<octave_idx_type>& ra_idx); typedef octave_value (*assign_op_fcn) (octave_base_value&, const octave_value_list&, const octave_base_value&); @@ -192,21 +192,21 @@ protected: octave_value_typeinfo (void) - : num_types (0), types (init_tab_sz, 1, std::string ()), - vals (init_tab_sz, 1), - unary_class_ops (octave_value::num_unary_ops, 1, 0), - unary_ops (octave_value::num_unary_ops, init_tab_sz, 0), - non_const_unary_ops (octave_value::num_unary_ops, init_tab_sz, 0), - binary_class_ops (octave_value::num_binary_ops, 1, 0), - binary_ops (octave_value::num_binary_ops, init_tab_sz, init_tab_sz, 0), - compound_binary_class_ops (octave_value::num_compound_binary_ops, 1, 0), - compound_binary_ops (octave_value::num_compound_binary_ops, init_tab_sz, init_tab_sz, 0), - cat_ops (init_tab_sz, init_tab_sz, 0), - assign_ops (octave_value::num_assign_ops, init_tab_sz, init_tab_sz, 0), - assignany_ops (octave_value::num_assign_ops, init_tab_sz, 0), - pref_assign_conv (init_tab_sz, init_tab_sz, -1), - type_conv_ops (init_tab_sz, init_tab_sz, 0), - widening_ops (init_tab_sz, init_tab_sz, 0) { } + : num_types (0), types (dim_vector (init_tab_sz, 1), std::string ()), + vals (dim_vector (init_tab_sz, 1)), + unary_class_ops (dim_vector (octave_value::num_unary_ops, 1), 0), + unary_ops (dim_vector (octave_value::num_unary_ops, init_tab_sz), 0), + non_const_unary_ops (dim_vector (octave_value::num_unary_ops, init_tab_sz), 0), + binary_class_ops (dim_vector (octave_value::num_binary_ops, 1), 0), + binary_ops (dim_vector (octave_value::num_binary_ops, init_tab_sz, init_tab_sz), 0), + compound_binary_class_ops (dim_vector (octave_value::num_compound_binary_ops, 1), 0), + compound_binary_ops (dim_vector (octave_value::num_compound_binary_ops, init_tab_sz, init_tab_sz), 0), + cat_ops (dim_vector (init_tab_sz, init_tab_sz), 0), + assign_ops (dim_vector (octave_value::num_assign_ops, init_tab_sz, init_tab_sz), 0), + assignany_ops (dim_vector (octave_value::num_assign_ops, init_tab_sz), 0), + pref_assign_conv (dim_vector (init_tab_sz, init_tab_sz), -1), + type_conv_ops (dim_vector (init_tab_sz, init_tab_sz), 0), + widening_ops (dim_vector (init_tab_sz, init_tab_sz), 0) { } private: @@ -228,15 +228,15 @@ Array<void *> binary_class_ops; - Array3<void *> binary_ops; + Array<void *> binary_ops; Array<void *> compound_binary_class_ops; - Array3<void *> compound_binary_ops; + Array<void *> compound_binary_ops; Array<void *> cat_ops; - Array3<void *> assign_ops; + Array<void *> assign_ops; Array<void *> assignany_ops;
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -2011,7 +2011,7 @@ \ dim_vector dims = nda.dims (); \ \ - Array<octave_idx_type> ra_idx (ndims, 1, 0); \ + Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0);\ \ octave_idx_type m = 1; \ \ @@ -2046,7 +2046,7 @@ nm += buf.str (); \ } \ \ - Array<idx_vector> idx (ndims, 1); \ + Array<idx_vector> idx (dim_vector (ndims, 1)); \ \ idx(0) = idx_vector (':'); \ idx(1) = idx_vector (':'); \ @@ -2055,7 +2055,7 @@ idx(k) = idx_vector (ra_idx(k)); \ \ octave_value page \ - = MAT_T (Array<ELT_T> (nda.index (idx), nr, nc)); \ + = MAT_T (Array<ELT_T> (nda.index (idx), dim_vector (nr, nc))); \ \ if (i != m - 1) \ { \ @@ -2855,7 +2855,7 @@ dim_vector dims = nda.dims (); - Array<octave_idx_type> ra_idx (ndims, 1, 0); + Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0); octave_idx_type m = 1; @@ -2888,7 +2888,7 @@ nm += buf.str (); } - Array<idx_vector> idx (ndims, 1); + Array<idx_vector> idx (dim_vector (ndims, 1)); idx(0) = idx_vector (':'); idx(1) = idx_vector (':'); @@ -2896,7 +2896,7 @@ for (int k = 2; k < ndims; k++) idx(k) = idx_vector (ra_idx(k)); - Array<std::string> page (nda.index (idx), nr, nc); + Array<std::string> page (nda.index (idx), dim_vector (nr, nc)); // FIXME -- need to do some more work to put these // in neatly aligned columns... @@ -3120,7 +3120,7 @@ { int ndims = nda.ndims (); - Array<octave_idx_type> ra_idx (ndims, 1, 0); + Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0); dim_vector dims = nda.dims (); @@ -3155,7 +3155,7 @@ os << nm << " =\n\n"; } - Array<idx_vector> idx (ndims, 1); + Array<idx_vector> idx (dim_vector (ndims, 1)); idx(0) = idx_vector (':'); idx(1) = idx_vector (':'); @@ -3163,7 +3163,7 @@ for (int k = 2; k < ndims; k++) idx(k) = idx_vector (ra_idx(k)); - Array<T> page (nda.index (idx), nr, nc); + Array<T> page (nda.index (idx), dim_vector (nr, nc)); for (octave_idx_type ii = 0; ii < nr; ii++) { @@ -3191,7 +3191,7 @@ dim_vector dims = nda.dims (); - Array<octave_idx_type> ra_idx (ndims, 1, 0); + Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0); octave_idx_type m = 1; @@ -3260,7 +3260,7 @@ os << nm << " =\n\n"; } - Array<idx_vector> idx (ndims, 1); + Array<idx_vector> idx (dim_vector (ndims, 1)); idx(0) = idx_vector (':'); idx(1) = idx_vector (':'); @@ -3268,7 +3268,7 @@ for (int k = 2; k < ndims; k++) idx(k) = idx_vector (ra_idx(k)); - Array<T> page (nda.index (idx), nr, nc); + Array<T> page (nda.index (idx), dim_vector (nr, nc)); if (free_format) {
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -1057,7 +1057,8 @@ // insert them in the result matrix. int dv_len = dv.length (); - Array<octave_idx_type> ra_idx (dv_len > 1 ? dv_len : 2, 1, 0); + octave_idx_type ntmp = dv_len > 1 ? dv_len : 2; + Array<octave_idx_type> ra_idx (dim_vector (ntmp, 1), 0); for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) {
--- a/src/txt-eng-ft.cc +++ b/src/txt-eng-ft.cc @@ -396,13 +396,13 @@ break; case ROTATION_90: { - Array<octave_idx_type> perm (3, 1); + Array<octave_idx_type> perm (dim_vector (3, 1)); perm(0) = 0; perm(1) = 2; perm(2) = 1; pixels = pixels.permute (perm); - Array<idx_vector> idx (3, 1); + Array<idx_vector> idx (dim_vector (3, 1)); idx(0) = idx_vector (':'); idx(1) = idx_vector (pixels.dim2()-1, -1, -1); idx(2) = idx_vector (':'); @@ -411,7 +411,7 @@ break; case ROTATION_180: { - Array<idx_vector> idx (3, 1); + Array<idx_vector> idx (dim_vector (3, 1)); idx(0) = idx_vector (':'); idx(1) = idx_vector (pixels.dim2()-1, -1, -1); idx(2)= idx_vector (pixels.dim3()-1, -1, -1); @@ -420,13 +420,13 @@ break; case ROTATION_270: { - Array<octave_idx_type> perm (3, 1); + Array<octave_idx_type> perm (dim_vector (3, 1)); perm(0) = 0; perm(1) = 2; perm(2) = 1; pixels = pixels.permute (perm); - Array<idx_vector> idx (3, 1); + Array<idx_vector> idx (dim_vector (3, 1)); idx(0) = idx_vector (':'); idx(1) = idx_vector (':'); idx(2) = idx_vector (pixels.dim3()-1, -1, -1);