Mercurial > hg > octave-lyh
changeset 11574:a83bad07f7e3
attempt better backward compatibility for Array resize functions
line wrap: on
line diff
--- a/liboctave/Array-util.cc +++ b/liboctave/Array-util.cc @@ -393,7 +393,7 @@ int n_dims = dims.length (); - retval.resize (n_dims, 1); + retval.resize (dim_vector (n_dims, 1)); for (int i = 0; i < n_dims; i++) retval(i) = 0;
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -948,7 +948,7 @@ template <class T> void -Array<T>::resize (octave_idx_type r, octave_idx_type c, const T& rfv) +Array<T>::resize2 (octave_idx_type r, octave_idx_type c, const T& rfv) { if (r >= 0 && c >= 0 && ndims () == 2) { @@ -994,7 +994,7 @@ { int dvl = dv.length (); if (dvl == 2) - resize (dv(0), dv(1), rfv); + resize2 (dv(0), dv(1), rfv); else if (dimensions != dv) { if (dimensions.length () <= dvl && ! dv.any_neg ()) @@ -1051,7 +1051,7 @@ if (i.is_scalar () && j.is_scalar ()) return Array<T> (dim_vector (1, 1), rfv); else - tmp.resize (rx, cx, rfv); + tmp.resize2 (rx, cx, rfv); } if (tmp.rows () != rx || tmp.columns () != cx) @@ -2173,7 +2173,7 @@ break; } if (k < n) - retval.resize (k, 1); + retval.resize2 (k, 1); octave_idx_type *rdata = retval.fortran_vec (); std::reverse (rdata, rdata + k); } @@ -2190,7 +2190,7 @@ break; } if (k < n) - retval.resize (k, 1); + retval.resize2 (k, 1); } }
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -452,8 +452,11 @@ void resize (octave_idx_type n) GCC_ATTR_DEPRECATED { resize1 (n); } - void resize (octave_idx_type nr, octave_idx_type nc, - const T& rfv = resize_fill_value ()); + void resize (octave_idx_type nr, octave_idx_type nc, + const T& rfv = resize_fill_value ()) GCC_ATTR_DEPRECATED + { + resize2 (nr, nc, rfv); + } void resize (const dim_vector& dv, const T& rfv = resize_fill_value ()); @@ -659,6 +662,10 @@ bool optimize_dimensions (const dim_vector& dv); private: + + void resize2 (octave_idx_type nr, octave_idx_type nc, + const T& rfv = resize_fill_value ()); + static void instantiation_guard (); };
--- a/liboctave/CColVector.h +++ b/liboctave/CColVector.h @@ -132,8 +132,11 @@ friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexColumnVector& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexColumnVector& a); - void resize (octave_idx_type n, const Complex& rfv = Array<Complex>::resize_fill_value ()) - { Array<Complex>::resize (n, 1, rfv); } + void resize (octave_idx_type n, + const Complex& rfv = Array<Complex>::resize_fill_value ()) + { + Array<Complex>::resize (dim_vector (n, 1), rfv); + } void clear (octave_idx_type n) { Array<Complex>::clear (n, 1); }
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -1081,7 +1081,7 @@ lwork = static_cast<octave_idx_type> (std::real(z(0))); lwork = (lwork < 2 *nc ? 2*nc : lwork); - z.resize (lwork, 1); + z.resize (dim_vector (lwork, 1)); Complex *pz = z.fortran_vec (); info = 0; @@ -1447,7 +1447,7 @@ nsamples = nr; nn = 4*npts+15; - wsave.resize (nn, 1); + wsave.resize (dim_vector (nn, 1)); pwsave = wsave.fortran_vec (); Array<Complex> tmp (npts, 1); @@ -1516,7 +1516,7 @@ nsamples = nr; nn = 4*npts+15; - wsave.resize (nn, 1); + wsave.resize (dim_vector (nn, 1)); pwsave = wsave.fortran_vec (); Array<Complex> tmp (npts, 1); @@ -2709,7 +2709,7 @@ } lwork = static_cast<octave_idx_type> (std::real (work(0))); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, @@ -2868,9 +2868,9 @@ lwork, prwork, piwork, info)); lwork = static_cast<octave_idx_type> (std::real (work(0))); - work.resize (lwork, 1); - rwork.resize (static_cast<octave_idx_type> (rwork(0)), 1); - iwork.resize (iwork(0), 1); + work.resize (dim_vector (lwork, 1)); + rwork.resize (dim_vector (static_cast<octave_idx_type> (rwork(0)), 1)); + iwork.resize (dim_vector (iwork(0), 1)); F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, @@ -3293,7 +3293,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - idx_arg.resize (nr, 1); + idx_arg.resize (dim_vector (nr, 1)); for (octave_idx_type i = 0; i < nr; i++) { @@ -3367,7 +3367,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - idx_arg.resize (nr, 1); + idx_arg.resize (dim_vector (nr, 1)); for (octave_idx_type i = 0; i < nr; i++) { @@ -3441,7 +3441,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - idx_arg.resize (1, nc); + idx_arg.resize (dim_vector (1, nc)); for (octave_idx_type j = 0; j < nc; j++) { @@ -3515,7 +3515,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - idx_arg.resize (1, nc); + idx_arg.resize (dim_vector (1, nc)); for (octave_idx_type j = 0; j < nc; j++) {
--- a/liboctave/CMatrix.h +++ b/liboctave/CMatrix.h @@ -151,6 +151,12 @@ ComplexColumnVector column (octave_idx_type i) const; + void resize (octave_idx_type nr, octave_idx_type nc, + const Complex& rfv = resize_fill_value ()) + { + MArray<Complex>::resize (dim_vector (nr, nc), rfv); + } + private: ComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, int force, int calc_cond) const;
--- a/liboctave/CRowVector.h +++ b/liboctave/CRowVector.h @@ -112,8 +112,11 @@ friend std::ostream& operator << (std::ostream& os, const ComplexRowVector& a); friend std::istream& operator >> (std::istream& is, ComplexRowVector& a); - void resize (octave_idx_type n, const Complex& rfv = Array<Complex>::resize_fill_value ()) - { Array<Complex>::resize (1, n, rfv); } + void resize (octave_idx_type n, + const Complex& rfv = Array<Complex>::resize_fill_value ()) + { + Array<Complex>::resize (dim_vector (1, n), rfv); + } void clear (octave_idx_type n) { Array<Complex>::clear (1, n); }
--- a/liboctave/CSparse.cc +++ b/liboctave/CSparse.cc @@ -330,7 +330,7 @@ } else { - idx_arg.resize (nr, 1, 0); + idx_arg.resize (dim_vector (nr, 1), 0); for (octave_idx_type i = cidx(0); i < cidx(1); i++) idx_arg.elem(ridx(i)) = -1; @@ -485,7 +485,7 @@ } else { - idx_arg.resize (nr, 1, 0); + idx_arg.resize (dim_vector (nr, 1), 0); for (octave_idx_type i = cidx(0); i < cidx(1); i++) idx_arg.elem(ridx(i)) = -1;
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,21 @@ +2011-01-20 John W. Eaton <jwe@octave.org> + + * Array.h, Array.cc + (Array<T>::resize2 (octave_idx_type, octave_idx_type, const T&)): + New private function. + (Array<T>::resize (octave_idx_type, octave_idx_type, const T&)): + Deprecate. Call resize2 to do the work. Remove all uses from + Octave. + + * CMatrix.h (ComplexMatrix::resize (octave_idx_type, + octave_idx_type, const Complex&)): New function. + * dMatrix.h (Matrix::resize (octave_idx_type, + octave_idx_type, double)): New function. + * fCMatrix.h (FloatComplexMatrix::resize (octave_idx_type, + octave_idx_type, const FloatComplex&)): New function. + * fMatrix.h (FloatMatrix::resize (octave_idx_type, + octave_idx_type, const float)): New function. + 2011-01-20 David Bateman <dbateman@free.fr> * Sparce.cc (template <class T> Sparse<T>::Sparse (const Array<T>&,
--- a/liboctave/CmplxLU.cc +++ b/liboctave/CmplxLU.cc @@ -69,7 +69,7 @@ octave_idx_type a_nc = a.cols (); octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); - ipvt.resize (mn, 1); + ipvt.resize (dim_vector (mn, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); a_fact = a;
--- a/liboctave/CmplxSVD.cc +++ b/liboctave/CmplxSVD.cc @@ -166,7 +166,7 @@ F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0).real ()); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (zgesvd, ZGESVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), F77_CONST_CHAR_ARG2 (&jobv, 1), @@ -189,7 +189,7 @@ F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0).real ()); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (zgesdd, ZGESDD, (F77_CONST_CHAR_ARG2 (&jobz, 1), m, n, tmp_data, m1, s_vec, u, m1, vt,
--- a/liboctave/DASPK-opts.in +++ b/liboctave/DASPK-opts.in @@ -31,13 +31,13 @@ TYPE = "Array<double>" SET_ARG_TYPE = "const $TYPE&" INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = ::sqrt (DBL_EPSILON); END_INIT_BODY SET_CODE void set_$OPT (double val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); reset = true; } @@ -67,13 +67,13 @@ TYPE = "Array<double>" SET_ARG_TYPE = "const $TYPE&" INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = ::sqrt (DBL_EPSILON); END_INIT_BODY SET_CODE void set_$OPT (double val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); reset = true; } @@ -167,7 +167,7 @@ TYPE = "Array<double>" SET_ARG_TYPE = "const $TYPE&" INIT_BODY - $OPTVAR.resize (6, 1); + $OPTVAR.resize (dim_vector (6, 1)); $OPTVAR(0) = 5.0; $OPTVAR(1) = 6.0; $OPTVAR(2) = 5.0; @@ -219,13 +219,13 @@ TYPE = "Array<octave_idx_type>" SET_ARG_TYPE = const $TYPE& INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = 0; END_INIT_BODY SET_CODE void set_$OPT (int val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = val; reset = true; } @@ -288,13 +288,13 @@ TYPE = "Array<octave_idx_type>" SET_ARG_TYPE = const $TYPE& INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = 0; END_INIT_BODY SET_CODE void set_$OPT (octave_idx_type val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = val; reset = true; }
--- a/liboctave/DASPK.cc +++ b/liboctave/DASPK.cc @@ -166,7 +166,7 @@ initialized = true; - info.resize (20, 1); + info.resize (dim_vector (20, 1)); for (octave_idx_type i = 0; i < 20; i++) info(i) = 0; @@ -232,8 +232,8 @@ if (eavfet == 1) lrw += n; - iwork.resize (liw, 1); - rwork.resize (lrw, 1); + iwork.resize (dim_vector (liw, 1)); + rwork.resize (dim_vector (lrw, 1)); // DASPK_options
--- a/liboctave/DASRT-opts.in +++ b/liboctave/DASRT-opts.in @@ -31,13 +31,13 @@ TYPE = "Array<double>" SET_ARG_TYPE = "const $TYPE&" INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = ::sqrt (DBL_EPSILON); END_INIT_BODY SET_CODE void set_$OPT (double val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); reset = true; } @@ -67,13 +67,13 @@ TYPE = "Array<double>" SET_ARG_TYPE = "const $TYPE&" INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = ::sqrt (DBL_EPSILON); END_INIT_BODY SET_CODE void set_$OPT (double val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); reset = true; }
--- a/liboctave/DASRT.cc +++ b/liboctave/DASRT.cc @@ -166,7 +166,7 @@ initialized = true; - info.resize (15, 1); + info.resize (dim_vector (15, 1)); for (octave_idx_type i = 0; i < 15; i++) info(i) = 0; @@ -207,8 +207,8 @@ liw = 21 + n; lrw = 50 + 9*n + n*n + 3*ng; - iwork.resize (liw, 1); - rwork.resize (lrw, 1); + iwork.resize (dim_vector (liw, 1)); + rwork.resize (dim_vector (lrw, 1)); info(0) = 0; @@ -255,7 +255,7 @@ DAEFunc::reset = false; - jroot.resize (ng, 1, 1); + jroot.resize (dim_vector (ng, 1), 1); DAERTFunc::reset = false;
--- a/liboctave/DASSL-opts.in +++ b/liboctave/DASSL-opts.in @@ -31,13 +31,13 @@ TYPE = "Array<double>" SET_ARG_TYPE = "const $TYPE&" INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = ::sqrt (DBL_EPSILON); END_INIT_BODY SET_CODE void set_$OPT (double val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); reset = true; } @@ -67,13 +67,13 @@ TYPE = "Array<double>" SET_ARG_TYPE = "const $TYPE&" INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = ::sqrt (DBL_EPSILON); END_INIT_BODY SET_CODE void set_$OPT (double val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); reset = true; }
--- a/liboctave/DASSL.cc +++ b/liboctave/DASSL.cc @@ -137,7 +137,7 @@ initialized = true; - info.resize (15, 1); + info.resize (dim_vector (15, 1)); for (octave_idx_type i = 0; i < 15; i++) info(i) = 0; @@ -149,8 +149,8 @@ nn = n; - iwork.resize (liw, 1); - rwork.resize (lrw, 1); + iwork.resize (dim_vector (liw, 1)); + rwork.resize (dim_vector (lrw, 1)); info(0) = 0;
--- a/liboctave/DiagArray2.cc +++ b/liboctave/DiagArray2.cc @@ -37,12 +37,13 @@ #include "lo-error.h" template <class T> -DiagArray2<T>::DiagArray2 (const Array<T>& a, octave_idx_type r, octave_idx_type c) +DiagArray2<T>::DiagArray2 (const Array<T>& a, octave_idx_type r, + octave_idx_type c) : Array<T> (a.as_column ()), d1 (r), d2 (c) { octave_idx_type rcmin = std::min (r, c); if (rcmin != a.length ()) - Array<T>::resize (rcmin, 1); + Array<T>::resize (dim_vector (rcmin, 1)); } template <class T> @@ -106,7 +107,7 @@ if (r != dim1 () || c != dim2 ()) { - Array<T>::resize (std::min (r, c), 1, rfv); + Array<T>::resize (dim_vector (std::min (r, c), 1), rfv); d1 = r; d2 = c; } }
--- a/liboctave/LSODE-opts.in +++ b/liboctave/LSODE-opts.in @@ -30,13 +30,13 @@ TYPE = "Array<double>" SET_ARG_TYPE = "const $TYPE&" INIT_BODY - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = ::sqrt (DBL_EPSILON); END_INIT_BODY SET_CODE void set_$OPT (double val) { - $OPTVAR.resize (1, 1); + $OPTVAR.resize (dim_vector (1, 1)); $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); reset = true; }
--- a/liboctave/LSODE.cc +++ b/liboctave/LSODE.cc @@ -155,12 +155,12 @@ maxord = maximum_order (); - iwork.resize (liw, 1); + iwork.resize (dim_vector (liw, 1)); for (octave_idx_type i = 4; i < 9; i++) iwork(i) = 0; - rwork.resize (lrw, 1); + rwork.resize (dim_vector (lrw, 1)); for (octave_idx_type i = 4; i < 9; i++) rwork(i) = 0;
--- a/liboctave/SparseCmplxLU.cc +++ b/liboctave/SparseCmplxLU.cc @@ -190,10 +190,10 @@ Rfact.xcidx (nr) = nr; double *Rx = Rfact.data (); - P.resize (nr, 1); + P.resize (dim_vector (nr, 1)); octave_idx_type *p = P.fortran_vec (); - Q.resize (nc, 1); + Q.resize (dim_vector (nc, 1)); octave_idx_type *q = Q.fortran_vec (); octave_idx_type do_recip; @@ -417,10 +417,10 @@ Rfact.xcidx (nr) = nr; double *Rx = Rfact.data (); - P.resize (nr, 1); + P.resize (dim_vector (nr, 1)); octave_idx_type *p = P.fortran_vec (); - Q.resize (nc, 1); + Q.resize (dim_vector (nc, 1)); octave_idx_type *q = Q.fortran_vec (); octave_idx_type do_recip;
--- a/liboctave/SparsedbleLU.cc +++ b/liboctave/SparsedbleLU.cc @@ -183,10 +183,10 @@ Rfact.xcidx (nr) = nr; double *Rx = Rfact.data (); - P.resize (nr, 1); + P.resize (dim_vector (nr, 1)); octave_idx_type *p = P.fortran_vec (); - Q.resize (nc, 1); + Q.resize (dim_vector (nc, 1)); octave_idx_type *q = Q.fortran_vec (); octave_idx_type do_recip; @@ -399,10 +399,10 @@ Rfact.xcidx (nr) = nr; double *Rx = Rfact.data (); - P.resize (nr, 1); + P.resize (dim_vector (nr, 1)); octave_idx_type *p = P.fortran_vec (); - Q.resize (nc, 1); + Q.resize (dim_vector (nc, 1)); octave_idx_type *q = Q.fortran_vec (); octave_idx_type do_recip;
--- a/liboctave/boolMatrix.h +++ b/liboctave/boolMatrix.h @@ -84,6 +84,12 @@ friend std::istream& operator >> (std::istream& is, Matrix& a); #endif + void resize (octave_idx_type nr, octave_idx_type nc, + bool rfv = resize_fill_value ()) + { + Array<bool>::resize (dim_vector (nr, nc), rfv); + } + static bool resize_fill_value (void) { return false; } };
--- a/liboctave/chMatrix.h +++ b/liboctave/chMatrix.h @@ -86,6 +86,12 @@ charMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + void resize (octave_idx_type nr, octave_idx_type nc, + char rfv = resize_fill_value ()) + { + Array<char>::resize (dim_vector (nr, nc), rfv); + } + charMatrix diag (octave_idx_type k = 0) const; boolMatrix all (int dim = -1) const;
--- a/liboctave/dColVector.h +++ b/liboctave/dColVector.h @@ -99,8 +99,11 @@ friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ColumnVector& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, ColumnVector& a); - void resize (octave_idx_type n, const double& rfv = Array<double>::resize_fill_value ()) - { Array<double>::resize (n, 1, rfv); } + void resize (octave_idx_type n, + const double& rfv = Array<double>::resize_fill_value ()) + { + Array<double>::resize (dim_vector (n, 1), rfv); + } void clear (octave_idx_type n) { Array<double>::clear (n, 1); }
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -755,7 +755,7 @@ lwork = static_cast<octave_idx_type> (z(0)); lwork = (lwork < 2 *nc ? 2*nc : lwork); - z.resize (lwork, 1); + z.resize (dim_vector (lwork, 1)); double *pz = z.fortran_vec (); info = 0; @@ -1116,7 +1116,7 @@ nsamples = nr; nn = 4*npts+15; - wsave.resize (nn, 1); + wsave.resize (dim_vector (nn, 1)); pwsave = wsave.fortran_vec (); Array<Complex> tmp (dim_vector (npts, 1)); @@ -1185,7 +1185,7 @@ nsamples = nr; nn = 4*npts+15; - wsave.resize (nn, 1); + wsave.resize (dim_vector (nn, 1)); pwsave = wsave.fortran_vec (); Array<Complex> tmp (dim_vector (npts, 1)); @@ -2354,7 +2354,7 @@ } lwork = static_cast<octave_idx_type> (work(0)); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, @@ -2508,7 +2508,7 @@ lwork, piwork, info)); lwork = static_cast<octave_idx_type> (work(0)); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, @@ -2792,7 +2792,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - idx_arg.resize (nr, 1); + idx_arg.resize (dim_vector (nr, 1)); for (octave_idx_type i = 0; i < nr; i++) { @@ -2847,7 +2847,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - idx_arg.resize (nr, 1); + idx_arg.resize (dim_vector (nr, 1)); for (octave_idx_type i = 0; i < nr; i++) { @@ -2902,7 +2902,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - idx_arg.resize (1, nc); + idx_arg.resize (dim_vector (1, nc)); for (octave_idx_type j = 0; j < nc; j++) { @@ -2957,7 +2957,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - idx_arg.resize (1, nc); + idx_arg.resize (dim_vector (1, nc)); for (octave_idx_type j = 0; j < nc; j++) {
--- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -125,6 +125,12 @@ ColumnVector column (octave_idx_type i) const; + void resize (octave_idx_type nr, octave_idx_type nc, + double rfv = resize_fill_value ()) + { + MArray<double>::resize (dim_vector (nr, nc), rfv); + } + private: Matrix tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, int force, int calc_cond) const; @@ -327,7 +333,6 @@ friend OCTAVE_API std::istream& operator >> (std::istream& is, Matrix& a); static double resize_fill_value (void) { return 0; } - }; // Publish externally used friend functions.
--- a/liboctave/dRowVector.h +++ b/liboctave/dRowVector.h @@ -92,8 +92,11 @@ friend OCTAVE_API std::ostream& operator << (std::ostream& os, const RowVector& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a); - void resize (octave_idx_type n, const double& rfv = Array<double>::resize_fill_value ()) - { Array<double>::resize (1, n, rfv); } + void resize (octave_idx_type n, + const double& rfv = Array<double>::resize_fill_value ()) + { + Array<double>::resize (dim_vector (1, n), rfv); + } void clear (octave_idx_type n) { Array<double>::clear (1, n); }
--- a/liboctave/dSparse.cc +++ b/liboctave/dSparse.cc @@ -365,7 +365,7 @@ } else { - idx_arg.resize (nr, 1, 0); + idx_arg.resize (dim_vector (nr, 1), 0); for (octave_idx_type i = cidx(0); i < cidx(1); i++) idx_arg.elem(ridx(i)) = -1; @@ -514,7 +514,7 @@ } else { - idx_arg.resize (nr, 1, 0); + idx_arg.resize (dim_vector (nr, 1), 0); for (octave_idx_type i = cidx(0); i < cidx(1); i++) idx_arg.elem(ridx(i)) = -1;
--- a/liboctave/dbleLU.cc +++ b/liboctave/dbleLU.cc @@ -69,7 +69,7 @@ octave_idx_type a_nc = a.cols (); octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); - ipvt.resize (mn, 1); + ipvt.resize (dim_vector (mn, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); a_fact = a;
--- a/liboctave/dbleSVD.cc +++ b/liboctave/dbleSVD.cc @@ -161,7 +161,7 @@ F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0)); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (dgesvd, DGESVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), F77_CONST_CHAR_ARG2 (&jobv, 1), @@ -183,7 +183,7 @@ F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0)); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (dgesdd, DGESDD, (F77_CONST_CHAR_ARG2 (&jobz, 1), m, n, tmp_data, m1, s_vec, u, m1, vt,
--- a/liboctave/fCColVector.h +++ b/liboctave/fCColVector.h @@ -134,8 +134,11 @@ friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexColumnVector& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexColumnVector& a); - void resize (octave_idx_type n, const FloatComplex& rfv = Array<FloatComplex>::resize_fill_value ()) - { Array<FloatComplex>::resize (n, 1, rfv); } + void resize (octave_idx_type n, + const FloatComplex& rfv = Array<FloatComplex>::resize_fill_value ()) + { + Array<FloatComplex>::resize (dim_vector (n, 1), rfv); + } void clear (octave_idx_type n) { Array<FloatComplex>::clear (n, 1); }
--- a/liboctave/fCMatrix.cc +++ b/liboctave/fCMatrix.cc @@ -1083,7 +1083,7 @@ lwork = static_cast<octave_idx_type> (std::real(z(0))); lwork = (lwork < 2 *nc ? 2*nc : lwork); - z.resize (lwork, 1); + z.resize (dim_vector (lwork, 1)); FloatComplex *pz = z.fortran_vec (); info = 0; @@ -1444,7 +1444,7 @@ nsamples = nr; nn = 4*npts+15; - wsave.resize (nn, 1); + wsave.resize (dim_vector (nn, 1)); pwsave = wsave.fortran_vec (); Array<FloatComplex> tmp (dim_vector (npts, 1)); @@ -1513,7 +1513,7 @@ nsamples = nr; nn = 4*npts+15; - wsave.resize (nn, 1); + wsave.resize (dim_vector (nn, 1)); pwsave = wsave.fortran_vec (); Array<FloatComplex> tmp (dim_vector (npts, 1)); @@ -2705,7 +2705,7 @@ } lwork = static_cast<octave_idx_type> (std::real (work(0))); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, @@ -2864,9 +2864,9 @@ lwork, prwork, piwork, info)); lwork = static_cast<octave_idx_type> (std::real (work(0))); - work.resize (lwork, 1); - rwork.resize (static_cast<octave_idx_type> (rwork(0)), 1); - iwork.resize (iwork(0), 1); + work.resize (dim_vector (lwork, 1)); + rwork.resize (dim_vector (static_cast<octave_idx_type> (rwork(0)), 1)); + iwork.resize (dim_vector (iwork(0), 1)); F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, @@ -3289,7 +3289,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - idx_arg.resize (nr, 1); + idx_arg.resize (dim_vector (nr, 1)); for (octave_idx_type i = 0; i < nr; i++) { @@ -3363,7 +3363,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - idx_arg.resize (nr, 1); + idx_arg.resize (dim_vector (nr, 1)); for (octave_idx_type i = 0; i < nr; i++) { @@ -3437,7 +3437,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - idx_arg.resize (1, nc); + idx_arg.resize (dim_vector (1, nc)); for (octave_idx_type j = 0; j < nc; j++) { @@ -3511,7 +3511,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - idx_arg.resize (1, nc); + idx_arg.resize (dim_vector (1, nc)); for (octave_idx_type j = 0; j < nc; j++) {
--- a/liboctave/fCMatrix.h +++ b/liboctave/fCMatrix.h @@ -156,6 +156,12 @@ FloatComplexColumnVector column (octave_idx_type i) const; + void resize (octave_idx_type nr, octave_idx_type nc, + const FloatComplex& rfv = resize_fill_value ()) + { + MArray<FloatComplex>::resize (dim_vector (nr, nc), rfv); + } + private: FloatComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, int force, int calc_cond) const;
--- a/liboctave/fCRowVector.h +++ b/liboctave/fCRowVector.h @@ -116,8 +116,11 @@ friend std::ostream& operator << (std::ostream& os, const FloatComplexRowVector& a); friend std::istream& operator >> (std::istream& is, FloatComplexRowVector& a); - void resize (octave_idx_type n, const FloatComplex& rfv = Array<FloatComplex>::resize_fill_value ()) - { Array<FloatComplex>::resize (1, n, rfv); } + void resize (octave_idx_type n, + const FloatComplex& rfv = Array<FloatComplex>::resize_fill_value ()) + { + Array<FloatComplex>::resize (dim_vector (1, n), rfv); + } void clear (octave_idx_type n) { Array<FloatComplex>::clear (1, n); }
--- a/liboctave/fCmplxLU.cc +++ b/liboctave/fCmplxLU.cc @@ -69,7 +69,7 @@ octave_idx_type a_nc = a.cols (); octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); - ipvt.resize (mn, 1); + ipvt.resize (dim_vector (mn, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); a_fact = a;
--- a/liboctave/fCmplxSVD.cc +++ b/liboctave/fCmplxSVD.cc @@ -168,7 +168,7 @@ F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0).real ()); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (cgesvd, CGESVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), F77_CONST_CHAR_ARG2 (&jobv, 1), @@ -191,7 +191,7 @@ F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0).real ()); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (cgesdd, CGESDD, (F77_CONST_CHAR_ARG2 (&jobz, 1), m, n, tmp_data, m1, s_vec, u, m1, vt,
--- a/liboctave/fColVector.h +++ b/liboctave/fColVector.h @@ -102,8 +102,11 @@ friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatColumnVector& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatColumnVector& a); - void resize (octave_idx_type n, const float& rfv = Array<float>::resize_fill_value ()) - { Array<float>::resize (n, 1, rfv); } + void resize (octave_idx_type n, + const float& rfv = Array<float>::resize_fill_value ()) + { + Array<float>::resize (dim_vector (n, 1), rfv); + } void clear (octave_idx_type n) { Array<float>::clear (n, 1); }
--- a/liboctave/fMatrix.cc +++ b/liboctave/fMatrix.cc @@ -755,7 +755,7 @@ lwork = static_cast<octave_idx_type> (z(0)); lwork = (lwork < 2 *nc ? 2*nc : lwork); - z.resize (lwork, 1); + z.resize (dim_vector (lwork, 1)); float *pz = z.fortran_vec (); info = 0; @@ -1116,7 +1116,7 @@ nsamples = nr; nn = 4*npts+15; - wsave.resize (nn, 1); + wsave.resize (dim_vector (nn, 1)); pwsave = wsave.fortran_vec (); Array<FloatComplex> tmp (dim_vector (npts, 1)); @@ -1185,7 +1185,7 @@ nsamples = nr; nn = 4*npts+15; - wsave.resize (nn, 1); + wsave.resize (dim_vector (nn, 1)); pwsave = wsave.fortran_vec (); Array<FloatComplex> tmp (dim_vector (npts, 1)); @@ -2354,7 +2354,7 @@ } lwork = static_cast<octave_idx_type> (work(0)); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, @@ -2508,7 +2508,7 @@ lwork, piwork, info)); lwork = static_cast<octave_idx_type> (work(0)); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, @@ -2792,7 +2792,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - idx_arg.resize (nr, 1); + idx_arg.resize (dim_vector (nr, 1)); for (octave_idx_type i = 0; i < nr; i++) { @@ -2847,7 +2847,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - idx_arg.resize (nr, 1); + idx_arg.resize (dim_vector (nr, 1)); for (octave_idx_type i = 0; i < nr; i++) { @@ -2902,7 +2902,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - idx_arg.resize (1, nc); + idx_arg.resize (dim_vector (1, nc)); for (octave_idx_type j = 0; j < nc; j++) { @@ -2957,7 +2957,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - idx_arg.resize (1, nc); + idx_arg.resize (dim_vector (1, nc)); for (octave_idx_type j = 0; j < nc; j++) {
--- a/liboctave/fMatrix.h +++ b/liboctave/fMatrix.h @@ -126,6 +126,12 @@ FloatColumnVector column (octave_idx_type i) const; + void resize (octave_idx_type nr, octave_idx_type nc, + float rfv = resize_fill_value ()) + { + MArray<float>::resize (dim_vector (nr, nc), rfv); + } + private: FloatMatrix tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, int force, int calc_cond) const;
--- a/liboctave/fRowVector.h +++ b/liboctave/fRowVector.h @@ -93,8 +93,11 @@ friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatRowVector& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatRowVector& a); - void resize (octave_idx_type n, const float& rfv = Array<float>::resize_fill_value ()) - { Array<float>::resize (1, n, rfv); } + void resize (octave_idx_type n, + const float& rfv = Array<float>::resize_fill_value ()) + { + Array<float>::resize (dim_vector (1, n), rfv); + } void clear (octave_idx_type n) { Array<float>::clear (1, n); }
--- a/liboctave/floatLU.cc +++ b/liboctave/floatLU.cc @@ -69,7 +69,7 @@ octave_idx_type a_nc = a.cols (); octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); - ipvt.resize (mn, 1); + ipvt.resize (dim_vector (mn, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); a_fact = a;
--- a/liboctave/floatSVD.cc +++ b/liboctave/floatSVD.cc @@ -161,7 +161,7 @@ F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0)); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (sgesvd, SGESVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), F77_CONST_CHAR_ARG2 (&jobv, 1), @@ -183,7 +183,7 @@ F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0)); - work.resize (lwork, 1); + work.resize (dim_vector (lwork, 1)); F77_XFCN (sgesdd, SGESDD, (F77_CONST_CHAR_ARG2 (&jobz, 1), m, n, tmp_data, m1, s_vec, u, m1, vt,
--- a/liboctave/lo-specfun.cc +++ b/liboctave/lo-specfun.cc @@ -1049,7 +1049,7 @@ ComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1067,7 +1067,7 @@ ComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1095,7 +1095,7 @@ retval.resize (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1173,7 +1173,7 @@ ComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1646,7 +1646,7 @@ FloatComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1664,7 +1664,7 @@ FloatComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1692,7 +1692,7 @@ retval.resize (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1770,7 +1770,7 @@ FloatComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1943,7 +1943,7 @@ ComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1960,7 +1960,7 @@ ComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -2073,7 +2073,7 @@ FloatComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -2090,7 +2090,7 @@ FloatComplexMatrix retval (nr, nc); - ierr.resize (nr, nc); + ierr.resize (dim_vector (nr, nc)); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++)
--- a/liboctave/sparse-dmsolve.cc +++ b/liboctave/sparse-dmsolve.cc @@ -279,7 +279,7 @@ octave_idx_type b_nr = b.rows (); octave_idx_type b_nc = b.cols (); const T *Bx = b.fortran_vec(); - a.resize(b_nr, b_nc); + a.resize (dim_vector (b_nr, b_nc)); RT *Btx = a.fortran_vec(); for (octave_idx_type j = 0; j < b_nc; j++) {
--- a/liboctave/str-vec.h +++ b/liboctave/str-vec.h @@ -89,7 +89,9 @@ } void resize (octave_idx_type n, const std::string& rfv = resize_fill_value ()) - { Array<std::string>::resize (n, 1, rfv); } + { + Array<std::string>::resize (dim_vector (n, 1), rfv); + } std::string& operator[] (octave_idx_type i) { return Array<std::string>::elem (i); }
--- a/src/DLD-FUNCTIONS/__glpk__.cc +++ b/src/DLD-FUNCTIONS/__glpk__.cc @@ -520,8 +520,8 @@ mrowsA = A.rows (); octave_idx_type Anc = A.cols (); octave_idx_type Anz = A.nnz (); - rn.resize (Anz+1, 1); - cn.resize (Anz+1, 1); + rn.resize (dim_vector (Anz+1, 1)); + cn.resize (dim_vector (Anz+1, 1)); a.resize (Anz+1, 0.0); if (Anc != mrowsc) @@ -550,8 +550,8 @@ } mrowsA = A.rows (); - rn.resize (mrowsA*mrowsc+1, 1); - cn.resize (mrowsA*mrowsc+1, 1); + rn.resize (dim_vector (mrowsA*mrowsc+1, 1)); + cn.resize (dim_vector (mrowsA*mrowsc+1, 1)); a.resize (mrowsA*mrowsc+1, 0.0); for (int i = 0; i < mrowsA; i++)
--- a/src/DLD-FUNCTIONS/filter.cc +++ b/src/DLD-FUNCTIONS/filter.cc @@ -64,9 +64,9 @@ octave_idx_type ab_len = a_len > b_len ? a_len : b_len; - b.resize (ab_len, 1, 0.0); + b.resize (dim_vector (ab_len, 1), 0.0); if (a_len > 1) - a.resize (ab_len, 1, 0.0); + a.resize (dim_vector (ab_len, 1), 0.0); T norm = a (0);
--- a/src/oct-obj.cc +++ b/src/oct-obj.cc @@ -46,7 +46,7 @@ data = lst.front ().data; else if (nel > 0) { - data.resize (1, nel); + data.resize (dim_vector (1, nel)); octave_idx_type k = 0; for (std::list<octave_value_list>::const_iterator p = lst.begin (); p != lst.end (); p++)
--- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -113,7 +113,9 @@ void resize (octave_idx_type n, const octave_value& rfv = Array<octave_value>::resize_fill_value ()) - { data.resize (1, n, rfv); } + { + data.resize (dim_vector (1, n), rfv); + } octave_value_list& prepend (const octave_value& val);
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -227,7 +227,7 @@ if (have_more) add_elt_to_list (width, discard, type, modifier, num_elts); - list.resize (num_elts, 1); + list.resize (dim_vector (num_elts, 1)); delete buf; } @@ -259,7 +259,7 @@ modifier, char_class); if (num_elts == list.length ()) - list.resize (2 * num_elts, 1); + list.resize (dim_vector (2 * num_elts, 1)); list(num_elts++) = elt; } @@ -599,7 +599,7 @@ list(num_elts++) = elt; - list.resize (num_elts, 1); + list.resize (dim_vector (num_elts, 1)); } else { @@ -654,7 +654,7 @@ if (have_more) add_elt_to_list (args, flags, fw, prec, type, modifier, num_elts); - list.resize (num_elts, 1); + list.resize (dim_vector (num_elts, 1)); delete buf; } @@ -687,7 +687,7 @@ type, modifier); if (num_elts == list.length ()) - list.resize (2 * num_elts, 1); + list.resize (dim_vector (2 * num_elts, 1)); list(num_elts++) = elt; }