Mercurial > hg > octave-lyh
changeset 3585:d9803711e047
[project @ 2000-02-08 04:35:39 by jwe]
author | jwe |
---|---|
date | Tue, 08 Feb 2000 04:35:47 +0000 |
parents | aa31644d9779 |
children | 2a38a5ddf20d |
files | liboctave/Array.h liboctave/Array2.h liboctave/Array3.h liboctave/CColVector.cc liboctave/CColVector.h liboctave/CDiagMatrix.cc liboctave/CDiagMatrix.h liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/CRowVector.h liboctave/ChangeLog liboctave/CmplxAEPBAL.cc liboctave/DiagArray2.h liboctave/EIG.cc liboctave/LP.h liboctave/MArray.h liboctave/MArray2.h liboctave/MDiagArray2.h liboctave/base-lu.h liboctave/dColVector.h liboctave/dDiagMatrix.h liboctave/dMatrix.cc liboctave/dMatrix.h liboctave/dRowVector.h liboctave/mx-op-defs.h liboctave/str-vec.h src/BaseSLList.h src/ChangeLog src/DLList.h src/Map.h src/SLList.h src/error.cc src/lex.h src/pt-except.cc src/xpow.cc |
diffstat | 35 files changed, 324 insertions(+), 113 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -44,7 +44,8 @@ // all the derived classes. template <class T> -class Array +class +Array { protected: @@ -64,7 +65,7 @@ ArrayRep (void) : data (0), len (0), count (1) { } - ArrayRep (int n) : data (new T [n]), len (n), count (1) { } + explicit ArrayRep (int n) : data (new T [n]), len (n), count (1) { } ArrayRep (const ArrayRep& a) : data (new T [a.len]), len (a.len), count (1) @@ -130,7 +131,7 @@ #endif } - Array (int n) + explicit Array (int n) { rep = new ArrayRep (n);
--- a/liboctave/Array2.h +++ b/liboctave/Array2.h @@ -41,7 +41,8 @@ // Two dimensional array class. template <class T> -class Array2 : public Array<T> +class +Array2 : public Array<T> { protected:
--- a/liboctave/Array3.h +++ b/liboctave/Array3.h @@ -39,7 +39,8 @@ // Three dimensional array class. template <class T> -class Array3 : public Array2<T> +class +Array3 : public Array2<T> { protected:
--- a/liboctave/CColVector.cc +++ b/liboctave/CColVector.cc @@ -440,7 +440,7 @@ if (len != a_len) { gripe_nonconformant ("product", len, a_len); - return ColumnVector (); + return ComplexColumnVector (); } if (len == 0) @@ -459,7 +459,7 @@ if (len != a_len) { gripe_nonconformant ("quotient", len, a_len); - return ColumnVector (); + return ComplexColumnVector (); } if (len == 0) @@ -490,7 +490,7 @@ if (nc != a_len) { gripe_nonconformant ("operator *", nr, nc, a_len, 1); - return ColumnVector (); + return ComplexColumnVector (); } if (nc == 0 || nr == 0)
--- a/liboctave/CColVector.h +++ b/liboctave/CColVector.h @@ -31,7 +31,8 @@ #include "mx-defs.h" -class ComplexColumnVector : public MArray<Complex> +class +ComplexColumnVector : public MArray<Complex> { friend class ComplexMatrix; friend class ComplexRowVector; @@ -39,11 +40,17 @@ public: ComplexColumnVector (void) : MArray<Complex> () { } - ComplexColumnVector (int n) : MArray<Complex> (n) { } - ComplexColumnVector (int n, const Complex& val) : MArray<Complex> (n, val) { } - ComplexColumnVector (const ColumnVector& a); + + explicit ComplexColumnVector (int n) : MArray<Complex> (n) { } + + ComplexColumnVector (int n, const Complex& val) + : MArray<Complex> (n, val) { } + + ComplexColumnVector (const ComplexColumnVector& a) : MArray<Complex> (a) { } + ComplexColumnVector (const MArray<Complex>& a) : MArray<Complex> (a) { } - ComplexColumnVector (const ComplexColumnVector& a) : MArray<Complex> (a) { } + + explicit ComplexColumnVector (const ColumnVector& a); ComplexColumnVector& operator = (const ComplexColumnVector& a) {
--- a/liboctave/CDiagMatrix.cc +++ b/liboctave/CDiagMatrix.cc @@ -287,7 +287,7 @@ if (i < 0 || i >= r) { (*current_liboctave_error_handler) ("invalid row selection"); - return RowVector (); + return ComplexRowVector (); } ComplexRowVector retval (c, 0.0); @@ -326,7 +326,7 @@ if (i < 0 || i >= c) { (*current_liboctave_error_handler) ("invalid column selection"); - return ColumnVector (); + return ComplexColumnVector (); } ComplexColumnVector retval (r, 0.0); @@ -342,7 +342,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid column selection"); - return ColumnVector (); + return ComplexColumnVector (); } char c = *s; @@ -353,7 +353,7 @@ else { (*current_liboctave_error_handler) ("invalid column selection"); - return ColumnVector (); + return ComplexColumnVector (); } } @@ -372,7 +372,7 @@ if (r != c) { (*current_liboctave_error_handler) ("inverse requires square matrix"); - return DiagMatrix (); + return ComplexDiagMatrix (); } ComplexDiagMatrix retval (r, c);
--- a/liboctave/CDiagMatrix.h +++ b/liboctave/CDiagMatrix.h @@ -36,25 +36,37 @@ #include "mx-defs.h" -class ComplexDiagMatrix : public MDiagArray2<Complex> +class +ComplexDiagMatrix : public MDiagArray2<Complex> { public: ComplexDiagMatrix (void) : MDiagArray2<Complex> () { } + ComplexDiagMatrix (int r, int c) : MDiagArray2<Complex> (r, c) { } + ComplexDiagMatrix (int r, int c, const Complex& val) : MDiagArray2<Complex> (r, c, val) { } - ComplexDiagMatrix (const RowVector& a) + + explicit ComplexDiagMatrix (const RowVector& a) : MDiagArray2<Complex> (ComplexRowVector (a)) { } - ComplexDiagMatrix (const ComplexRowVector& a) : MDiagArray2<Complex> (a) { } - ComplexDiagMatrix (const ColumnVector& a) + + explicit ComplexDiagMatrix (const ComplexRowVector& a) + : MDiagArray2<Complex> (a) { } + + explicit ComplexDiagMatrix (const ColumnVector& a) : MDiagArray2<Complex> (ComplexColumnVector (a)) { } - ComplexDiagMatrix (const ComplexColumnVector& a) + + explicit ComplexDiagMatrix (const ComplexColumnVector& a) : MDiagArray2<Complex> (a) { } - ComplexDiagMatrix (const DiagMatrix& a); + + explicit ComplexDiagMatrix (const DiagMatrix& a); + ComplexDiagMatrix (const MDiagArray2<Complex>& a) : MDiagArray2<Complex> (a) { } - ComplexDiagMatrix (const ComplexDiagMatrix& a) : MDiagArray2<Complex> (a) { } + + ComplexDiagMatrix (const ComplexDiagMatrix& a) + : MDiagArray2<Complex> (a) { } ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) {
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -1350,6 +1350,34 @@ } ComplexColumnVector +ComplexMatrix::solve (const ColumnVector& b) const +{ + int info; + double rcond; + return solve (ComplexColumnVector (b), info, rcond, 0); +} + +ComplexColumnVector +ComplexMatrix::solve (const ColumnVector& b, int& info) const +{ + double rcond; + return solve (ComplexColumnVector (b), info, rcond, 0); +} + +ComplexColumnVector +ComplexMatrix::solve (const ColumnVector& b, int& info, double& rcond) const +{ + return solve (ComplexColumnVector (b), info, rcond, 0); +} + +ComplexColumnVector +ComplexMatrix::solve (const ColumnVector& b, int& info, double& rcond, + solve_singularity_handler sing_handler) const +{ + return solve (ComplexColumnVector (b), info, rcond, sing_handler); +} + +ComplexColumnVector ComplexMatrix::solve (const ComplexColumnVector& b) const { int info; @@ -1435,6 +1463,27 @@ } ComplexMatrix +ComplexMatrix::lssolve (const Matrix& b) const +{ + int info; + int rank; + return lssolve (ComplexMatrix (b), info, rank); +} + +ComplexMatrix +ComplexMatrix::lssolve (const Matrix& b, int& info) const +{ + int rank; + return lssolve (ComplexMatrix (b), info, rank); +} + +ComplexMatrix +ComplexMatrix::lssolve (const Matrix& b, int& info, int& rank) const +{ + return lssolve (ComplexMatrix (b), info, rank); +} + +ComplexMatrix ComplexMatrix::lssolve (const ComplexMatrix& b) const { int info; @@ -1517,6 +1566,27 @@ } ComplexColumnVector +ComplexMatrix::lssolve (const ColumnVector& b) const +{ + int info; + int rank; + return lssolve (ComplexColumnVector (b), info, rank); +} + +ComplexColumnVector +ComplexMatrix::lssolve (const ColumnVector& b, int& info) const +{ + int rank; + return lssolve (ComplexColumnVector (b), info, rank); +} + +ComplexColumnVector +ComplexMatrix::lssolve (const ColumnVector& b, int& info, int& rank) const +{ + return lssolve (ComplexColumnVector (b), info, rank); +} + +ComplexColumnVector ComplexMatrix::lssolve (const ComplexColumnVector& b) const { int info;
--- a/liboctave/CMatrix.h +++ b/liboctave/CMatrix.h @@ -34,29 +34,41 @@ #include "mx-op-defs.h" #include "oct-cmplx.h" -class ComplexMatrix : public MArray2<Complex> +class +ComplexMatrix : public MArray2<Complex> { public: typedef void (*solve_singularity_handler) (double rcond); ComplexMatrix (void) : MArray2<Complex> () { } + ComplexMatrix (int r, int c) : MArray2<Complex> (r, c) { } + ComplexMatrix (int r, int c, const Complex& val) : MArray2<Complex> (r, c, val) { } - ComplexMatrix (const Matrix& a); - ComplexMatrix (const MArray2<Complex>& a) : MArray2<Complex> (a) { } + ComplexMatrix (const ComplexMatrix& a) : MArray2<Complex> (a) { } - ComplexMatrix (const RowVector& rv); - ComplexMatrix (const ColumnVector& cv); - ComplexMatrix (const DiagMatrix& a); - // ComplexMatrix (const MDiagArray2<Complex>& a) : MArray2<Complex> (a) { } - ComplexMatrix (const ComplexRowVector& rv); - ComplexMatrix (const ComplexColumnVector& cv); - ComplexMatrix (const ComplexDiagMatrix& a); + + ComplexMatrix (const MArray2<Complex>& a) : MArray2<Complex> (a) { } + + explicit ComplexMatrix (const Matrix& a); + + explicit ComplexMatrix (const RowVector& rv); + + explicit ComplexMatrix (const ColumnVector& cv); - ComplexMatrix (const boolMatrix& a); - ComplexMatrix (const charMatrix& a); + explicit ComplexMatrix (const DiagMatrix& a); + + explicit ComplexMatrix (const ComplexRowVector& rv); + + explicit ComplexMatrix (const ComplexColumnVector& cv); + + explicit ComplexMatrix (const ComplexDiagMatrix& a); + + explicit ComplexMatrix (const boolMatrix& a); + + explicit ComplexMatrix (const charMatrix& a); ComplexMatrix& operator = (const ComplexMatrix& a) { @@ -152,6 +164,13 @@ ComplexMatrix solve (const ComplexMatrix& b, int& info, double& rcond, solve_singularity_handler sing_handler) const; + ComplexColumnVector solve (const ColumnVector& b) const; + ComplexColumnVector solve (const ColumnVector& b, int& info) const; + ComplexColumnVector solve (const ColumnVector& b, int& info, + double& rcond) const; + ComplexColumnVector solve (const ColumnVector& b, int& info, double& rcond, + solve_singularity_handler sing_handler) const; + ComplexColumnVector solve (const ComplexColumnVector& b) const; ComplexColumnVector solve (const ComplexColumnVector& b, int& info) const; ComplexColumnVector solve (const ComplexColumnVector& b, int& info, @@ -160,11 +179,20 @@ double& rcond, solve_singularity_handler sing_handler) const; + ComplexMatrix lssolve (const Matrix& b) const; + ComplexMatrix lssolve (const Matrix& b, int& info) const; + ComplexMatrix lssolve (const Matrix& b, int& info, int& rank) const; + ComplexMatrix lssolve (const ComplexMatrix& b) const; ComplexMatrix lssolve (const ComplexMatrix& b, int& info) const; ComplexMatrix lssolve (const ComplexMatrix& b, int& info, int& rank) const; + ComplexColumnVector lssolve (const ColumnVector& b) const; + ComplexColumnVector lssolve (const ColumnVector& b, int& info) const; + ComplexColumnVector lssolve (const ColumnVector& b, int& info, + int& rank) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b) const; ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info) const; ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info,
--- a/liboctave/CRowVector.h +++ b/liboctave/CRowVector.h @@ -31,18 +31,24 @@ #include "mx-defs.h" -class ComplexRowVector : public MArray<Complex> +class +ComplexRowVector : public MArray<Complex> { friend class ComplexColumnVector; public: ComplexRowVector (void) : MArray<Complex> () { } - ComplexRowVector (int n) : MArray<Complex> (n) { } + + explicit ComplexRowVector (int n) : MArray<Complex> (n) { } + ComplexRowVector (int n, const Complex& val) : MArray<Complex> (n, val) { } - ComplexRowVector (const RowVector& a); + + ComplexRowVector (const ComplexRowVector& a) : MArray<Complex> (a) { } + ComplexRowVector (const MArray<Complex>& a) : MArray<Complex> (a) { } - ComplexRowVector (const ComplexRowVector& a) : MArray<Complex> (a) { } + + explicit ComplexRowVector (const RowVector& a); ComplexRowVector& operator = (const ComplexRowVector& a) {
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,33 @@ +2000-02-07 John W. Eaton <jwe@bevo.che.wisc.edu> + + * CMatrix.h, CMatrix.cc: Add lssolve methods for real-valued RHS + matrix and vector objects. + + * mx-op-defs.h (DMM_BIN_OP): Explicitly request conversion to + return type from second arg type. + (MDM_BIN_OP): Likewise, for first arg type. + + * dMatrix.cc (Matrix::fourier, Matrix::ifourier, + Matrix::fourier2d, Matrix::ifourier2d): Likewise. + + * EIG.cc (EIG::symmetric_init, EIG::hermitian_init): Explicitly + request ColumnVector to ComplexColumnVector, and Matrix to + ComplexMatrix conversions. + + * CmplxAEPBAL.cc (ComplexAEPBALANCE::init): Give balancing_mat its + initial value using ComplexMatrix constructor. + + * CColVector.cc (product, quotient, + operator * (const DiagMatrix&, const ComplexColumnVetor&)): + Fix type of returned value. + * CDiagMatrix.cc (ComplexDiagMatrix::row, + ComplexDiagMatrix::column, ComplexDiagMatrix::inverse): Likewise. + + * Array.h, CColVector.h, CDiagMatrix.h, CMatrix.h, CRowVector.h, + MArray.h, MDiagArray2.h, dColVector.h, dDiagMatrix.h, dMatrix.h, + dRowVector.h: Declare some constructors explicit, to disallow + potentially problematic automatic type conversions. + 2000-02-05 John W. Eaton <jwe@bevo.che.wisc.edu> * vx-rv-crv.h, vx-cv-ccv.h, vx-crv-rv.h, vx-ccv-cv.h,
--- a/liboctave/CmplxAEPBAL.cc +++ b/liboctave/CmplxAEPBAL.cc @@ -77,7 +77,7 @@ (*current_liboctave_error_handler) ("unrecoverable error in zgebal"); else { - balancing_mat = Matrix (n, n, 0.0); + balancing_mat = ComplexMatrix (n, n, 0.0); for (int i = 0; i < n; i++) balancing_mat.elem (i, i) = 1.0;
--- a/liboctave/DiagArray2.h +++ b/liboctave/DiagArray2.h @@ -50,7 +50,8 @@ // GABI Software, Sarl., 8 rue du Faisan, F-67000 Strasbourg, France template <class T> -class DiagArray2 : public Array<T> +class +DiagArray2 : public Array<T> { private:
--- a/liboctave/EIG.cc +++ b/liboctave/EIG.cc @@ -160,7 +160,7 @@ Matrix atmp = a; double *tmp_data = atmp.fortran_vec (); - Array<double> wr (n); + ColumnVector wr (n); double *pwr = wr.fortran_vec (); // XXX FIXME XXX -- it might be possible to choose a better value of @@ -175,19 +175,12 @@ if (f77_exception_encountered || info < 0) (*current_liboctave_error_handler) ("unrecoverable error in dsyev"); + else if (info > 0) + (*current_liboctave_error_handler) ("dsyev failed to converge"); else { - if (info > 0) - (*current_liboctave_error_handler) ("dsyev failed to converge"); - else - { - lambda.resize (n); - - for (int j = 0; j < n; j++) - lambda.elem (j) = Complex (wr.elem (j)); - - v = atmp; - } + lambda = ComplexColumnVector (wr); + v = ComplexMatrix (atmp); } return info; @@ -264,8 +257,8 @@ ComplexMatrix atmp = a; Complex *tmp_data = atmp.fortran_vec (); - ColumnVector w (n); - double *pw = w.fortran_vec (); + ColumnVector wr (n); + double *pwr = wr.fortran_vec (); // XXX FIXME XXX -- it might be possible to choose a better value of // lwork that would result in more efficient computations. @@ -278,7 +271,7 @@ Array<double> rwork (lrwork); double *prwork = rwork.fortran_vec (); - F77_XFCN (zheev, ZHEEV, ("V", "U", n, tmp_data, n, pw, pwork, + F77_XFCN (zheev, ZHEEV, ("V", "U", n, tmp_data, n, pwr, pwork, lwork, prwork, info, 1L, 1L)); if (f77_exception_encountered || info < 0) @@ -287,8 +280,8 @@ (*current_liboctave_error_handler) ("zheev failed to converge"); else { - lambda = w; - v = atmp; + lambda = ComplexColumnVector (wr); + v = ComplexMatrix (atmp); } return info;
--- a/liboctave/LP.h +++ b/liboctave/LP.h @@ -28,7 +28,8 @@ #include "LinConst.h" #include "base-min.h" -class LP : public base_minimizer +class +LP : public base_minimizer { public:
--- a/liboctave/MArray.h +++ b/liboctave/MArray.h @@ -39,7 +39,8 @@ MARRAY_OPS_FORWARD_DECLS (MArray) template <class T> -class MArray : public Array<T> +class +MArray : public Array<T> { protected: @@ -48,10 +49,14 @@ public: MArray (void) : Array<T> () { } - MArray (int n) : Array<T> (n) { } + + explicit MArray (int n) : Array<T> (n) { } + MArray (int n, const T& val) : Array<T> (n, val) { } + + MArray (const MArray<T>& a) : Array<T> (a) { } + MArray (const Array<T>& a) : Array<T> (a) { } - MArray (const MArray<T>& a) : Array<T> (a) { } ~MArray (void) { }
--- a/liboctave/MArray2.h +++ b/liboctave/MArray2.h @@ -39,7 +39,8 @@ MARRAY_OPS_FORWARD_DECLS (MArray2) template <class T> -class MArray2 : public Array2<T> +class +MArray2 : public Array2<T> { protected: @@ -48,10 +49,14 @@ public: MArray2 (void) : Array2<T> () { } + MArray2 (int n, int m) : Array2<T> (n, m) { } + MArray2 (int n, int m, const T& val) : Array2<T> (n, m, val) { } + + MArray2 (const MArray2<T>& a) : Array2<T> (a) { } + MArray2 (const Array2<T>& a) : Array2<T> (a) { } - MArray2 (const MArray2<T>& a) : Array2<T> (a) { } ~MArray2 (void) { }
--- a/liboctave/MDiagArray2.h +++ b/liboctave/MDiagArray2.h @@ -40,7 +40,8 @@ MDIAGARRAY2_OPS_FORWARD_DECLS (MDiagArray2) template <class T> -class MDiagArray2 : public DiagArray2<T> +class +MDiagArray2 : public DiagArray2<T> { protected: @@ -49,11 +50,16 @@ public: MDiagArray2 (void) : DiagArray2<T> () { } + MDiagArray2 (int r, int c) : DiagArray2<T> (r, c) { } + MDiagArray2 (int r, int c, const T& val) : DiagArray2<T> (r, c, val) { } - MDiagArray2 (const Array<T>& a) : DiagArray2<T> (a) { } + + MDiagArray2 (const MDiagArray2<T>& a) : DiagArray2<T> (a) { } + MDiagArray2 (const DiagArray2<T>& a) : DiagArray2<T> (a) { } - MDiagArray2 (const MDiagArray2<T>& a) : DiagArray2<T> (a) { } + + explicit MDiagArray2 (const Array<T>& a) : DiagArray2<T> (a) { } ~MDiagArray2 (void) { }
--- a/liboctave/base-lu.h +++ b/liboctave/base-lu.h @@ -30,7 +30,8 @@ #include "MArray.h" template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> -class base_lu +class +base_lu { public:
--- a/liboctave/dColVector.h +++ b/liboctave/dColVector.h @@ -31,15 +31,20 @@ #include "mx-defs.h" -class ColumnVector : public MArray<double> +class +ColumnVector : public MArray<double> { public: ColumnVector (void) : MArray<double> () { } - ColumnVector (int n) : MArray<double> (n) { } + + explicit ColumnVector (int n) : MArray<double> (n) { } + ColumnVector (int n, double val) : MArray<double> (n, val) { } + + ColumnVector (const ColumnVector& a) : MArray<double> (a) { } + ColumnVector (const MArray<double>& a) : MArray<double> (a) { } - ColumnVector (const ColumnVector& a) : MArray<double> (a) { } ColumnVector& operator = (const ColumnVector& a) {
--- a/liboctave/dDiagMatrix.h +++ b/liboctave/dDiagMatrix.h @@ -34,7 +34,8 @@ #include "mx-defs.h" -class DiagMatrix : public MDiagArray2<double> +class +DiagMatrix : public MDiagArray2<double> { friend class SVD; friend class ComplexSVD; @@ -42,12 +43,18 @@ public: DiagMatrix (void) : MDiagArray2<double> () { } + DiagMatrix (int r, int c) : MDiagArray2<double> (r, c) { } + DiagMatrix (int r, int c, double val) : MDiagArray2<double> (r, c, val) { } - DiagMatrix (const RowVector& a) : MDiagArray2<double> (a) { } - DiagMatrix (const ColumnVector& a) : MDiagArray2<double> (a) { } + + DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } + DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { } - DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } + + explicit DiagMatrix (const RowVector& a) : MDiagArray2<double> (a) { } + + explicit DiagMatrix (const ColumnVector& a) : MDiagArray2<double> (a) { } DiagMatrix& operator = (const DiagMatrix& a) {
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -672,7 +672,7 @@ Array<Complex> wsave (nn); Complex *pwsave = wsave.fortran_vec (); - retval = *this; + retval = ComplexMatrix (*this); Complex *tmp_data = retval.fortran_vec (); F77_FCN (cffti, CFFTI) (npts, pwsave); @@ -709,7 +709,7 @@ Array<Complex> wsave (nn); Complex *pwsave = wsave.fortran_vec (); - retval = *this; + retval = ComplexMatrix (*this); Complex *tmp_data = retval.fortran_vec (); F77_FCN (cffti, CFFTI) (npts, pwsave); @@ -749,7 +749,7 @@ Array<Complex> wsave (nn); Complex *pwsave = wsave.fortran_vec (); - retval = *this; + retval = ComplexMatrix (*this); Complex *tmp_data = retval.fortran_vec (); F77_FCN (cffti, CFFTI) (npts, pwsave); @@ -809,7 +809,7 @@ Array<Complex> wsave (nn); Complex *pwsave = wsave.fortran_vec (); - retval = *this; + retval = ComplexMatrix (*this); Complex *tmp_data = retval.fortran_vec (); F77_FCN (cffti, CFFTI) (npts, pwsave);
--- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -36,24 +36,32 @@ #include "data-conv.h" #include "mach-info.h" -class Matrix : public MArray2<double> +class +Matrix : public MArray2<double> { public: typedef void (*solve_singularity_handler) (double rcond); Matrix (void) : MArray2<double> () { } + Matrix (int r, int c) : MArray2<double> (r, c) { } + Matrix (int r, int c, double val) : MArray2<double> (r, c, val) { } - Matrix (const MArray2<double>& a) : MArray2<double> (a) { } + Matrix (const Matrix& a) : MArray2<double> (a) { } - Matrix (const RowVector& rv); - Matrix (const ColumnVector& cv); - // Matrix (const MDiagArray2<double>& a) : MArray2<double> (a) { } - Matrix (const DiagMatrix& a); + + Matrix (const MArray2<double>& a) : MArray2<double> (a) { } + + explicit Matrix (const RowVector& rv); - Matrix (const boolMatrix& a); - Matrix (const charMatrix& a); + explicit Matrix (const ColumnVector& cv); + + explicit Matrix (const DiagMatrix& a); + + explicit Matrix (const boolMatrix& a); + + explicit Matrix (const charMatrix& a); Matrix& operator = (const Matrix& a) {
--- a/liboctave/dRowVector.h +++ b/liboctave/dRowVector.h @@ -31,15 +31,20 @@ #include "mx-defs.h" -class RowVector : public MArray<double> +class +RowVector : public MArray<double> { public: RowVector (void) : MArray<double> () { } - RowVector (int n) : MArray<double> (n) { } + + explicit RowVector (int n) : MArray<double> (n) { } + RowVector (int n, double val) : MArray<double> (n, val) { } + + RowVector (const RowVector& a) : MArray<double> (a) { } + RowVector (const MArray<double>& a) : MArray<double> (a) { } - RowVector (const RowVector& a) : MArray<double> (a) { } RowVector& operator = (const RowVector& a) {
--- a/liboctave/mx-op-defs.h +++ b/liboctave/mx-op-defs.h @@ -569,7 +569,7 @@ \ if (m_nr > 0 && m_nc > 0) \ { \ - r = m; \ + r = R (m); \ \ int len = dm.length (); \ \ @@ -630,14 +630,12 @@ // diagonal matrix by matrix operations. -// XXX FIXME XXX -- DM - M will not give the correct result. - #define DMM_BIN_OP_DECLS(R, DM, M) \ BIN_OP_DECL (R, operator +, DM, M); \ BIN_OP_DECL (R, operator -, DM, M); \ BIN_OP_DECL (R, operator *, DM, M); -#define DMM_BIN_OP(R, OP, DM, M, OPEQ) \ +#define DMM_BIN_OP(R, OP, DM, M, OPEQ, PREOP) \ R \ OP (const DM& dm, const M& m) \ { \ @@ -655,7 +653,7 @@ { \ if (m_nr > 0 && m_nc > 0) \ { \ - r = m; \ + r = R (PREOP m); \ \ int len = dm.length (); \ \ @@ -709,9 +707,9 @@ } #define DMM_BIN_OPS(R, DM, M, ZERO) \ - DMM_BIN_OP (R, operator +, DM, M, +=) \ - DMM_BIN_OP (R, operator -, DM, M, -=) \ - DMM_MULTIPLY_OP(R, DM, M, ZERO) + DMM_BIN_OP (R, operator +, DM, M, +=, ) \ + DMM_BIN_OP (R, operator -, DM, M, +=, -) \ + DMM_MULTIPLY_OP (R, DM, M, ZERO) #define DMM_OP_DECLS(R, DM, M) \ DMM_BIN_OP_DECLS(R, DM, M)
--- a/liboctave/str-vec.h +++ b/liboctave/str-vec.h @@ -44,7 +44,7 @@ string_vector (void) : Array<std::string> () { } - string_vector (int n) : Array<std::string> (n) { } + explicit string_vector (int n) : Array<std::string> (n) { } string_vector (const char *s) : Array<std::string> (1, s) { }
--- a/src/BaseSLList.h +++ b/src/BaseSLList.h @@ -36,7 +36,9 @@ void *item() {return (void*)(this+1);} // Return ((SLNode<T>*)this)->hd }; -class BaseSLList { +class +BaseSLList +{ protected: BaseSLNode *last; virtual void delete_node(BaseSLNode*node) = 0;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2000-02-07 John W. Eaton <jwe@bevo.che.wisc.edu> + * error.cc (panic): Turn off buffering of error messages. + Don't call flush_octave_stdout here, verror will do it for us. + (verror): Don't call flush_octave_stdout if buffering error messages. + * pt-except.cc (tree_try_catch_command::eval): Only restore buffer_error_message value (by running the unwind_protect element for it) if it has been saved.
--- a/src/DLList.h +++ b/src/DLList.h @@ -35,7 +35,8 @@ }; template<class T> -class DLNode : public BaseDLNode +class +DLNode : public BaseDLNode { public: T hd; @@ -45,7 +46,9 @@ ~DLNode() { } }; -class BaseDLList { +class +BaseDLList +{ protected: BaseDLNode *h; @@ -79,7 +82,9 @@ }; template <class T> -class DLList : public BaseDLList { +class +DLList : public BaseDLList +{ //friend class <T>DLListTrav; virtual void delete_node(BaseDLNode *node) { delete (DLNode<T>*)node; }
--- a/src/Map.h +++ b/src/Map.h @@ -45,7 +45,8 @@ #include <Pix.h> template <class C> -class Map +class +Map { protected: int count; @@ -112,7 +113,8 @@ #endif template <class C> -class CHMap : public Map<C> +class +CHMap : public Map<C> { protected: CHNode<C> **tab;
--- a/src/SLList.h +++ b/src/SLList.h @@ -28,7 +28,8 @@ #include "BaseSLList.h" template<class T> -class SLNode : public BaseSLNode +class +SLNode : public BaseSLNode { public: T hd; // Data part of node @@ -39,7 +40,8 @@ }; template <class T> -class SLList : public BaseSLList +class +SLList : public BaseSLList { private: virtual void delete_node(BaseSLNode *node) { delete (SLNode<T>*)node; }
--- a/src/error.cc +++ b/src/error.cc @@ -82,7 +82,8 @@ static void verror (const char *name, const char *fmt, va_list args) { - flush_octave_stdout (); + if (! buffer_error_messages) + flush_octave_stdout (); bool to_beep_or_not_to_beep_p = Vbeep_on_error && ! error_state; @@ -222,10 +223,9 @@ void panic (const char *fmt, ...) { - flush_octave_stdout (); - va_list args; va_start (args, fmt); + buffer_error_messages = false; verror ("panic", fmt, args); va_end (args); abort ();
--- a/src/lex.h +++ b/src/lex.h @@ -112,7 +112,8 @@ // For communication between the lexer and parser. -class lexical_feedback +class +lexical_feedback { public: