# HG changeset patch # User jwe # Date 774734215 0 # Node ID 2ca256b77602bf859fcf86a69f27e091de775c27 # Parent 1be78be437c79b82ec2a086a4d98fe2e72ab492b [project @ 1994-07-20 19:56:55 by jwe] diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CColVector.cc --- a/liboctave/CColVector.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CColVector.cc Wed Jul 20 19:56:55 1994 +0000 @@ -649,6 +649,7 @@ break; } } + return is; } /* diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CColVector.h --- a/liboctave/CColVector.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CColVector.h Wed Jul 20 19:56:55 1994 +0000 @@ -36,7 +36,9 @@ class ComplexColumnVector : public Array { +friend class ColumnVector; friend class ComplexRowVector; +friend class ComplexMatrix; public: @@ -144,7 +146,7 @@ // i/o friend ostream& operator << (ostream& os, const ComplexColumnVector& a); - friend ostream& operator >> (ostream& is, ComplexColumnVector& a); + friend istream& operator >> (istream& is, ComplexColumnVector& a); #define KLUDGE_VECTORS #define TYPE Complex @@ -154,8 +156,10 @@ #undef TYPE #undef KL_VEC_TYPE -private: - +// private: +// XXX FIXME XXX -- why does it not work to make this private, with +// ColumnVector declared as a friend of ComplexColumnVector? It seems +// to work for the similar case with Matrix/ComplexMatrix. Hmm... ComplexColumnVector (Complex *d, int l) : Array (d, l) { } }; diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CDiagMatrix.h --- a/liboctave/CDiagMatrix.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CDiagMatrix.h Wed Jul 20 19:56:55 1994 +0000 @@ -41,6 +41,8 @@ class ComplexDiagMatrix : public DiagArray { + friend DiagMatrix; + public: ComplexDiagMatrix (void) : DiagArray () { } diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CMatrix.cc Wed Jul 20 19:56:55 1994 +0000 @@ -917,7 +917,7 @@ } ComplexMatrix -ComplexMatrix::inverse (int& info, volatile double& rcond) const +ComplexMatrix::inverse (int& info, double& rcond) const { int nr = rows (); int nc = cols (); @@ -936,7 +936,8 @@ F77_FCN (zgeco) (tmp_data, &nr, &nc, ipvt, &rcond, z); - if (rcond + 1.0 == 1.0) + volatile double tmp_rcond = rcond; + if (tmp_rcond + 1.0 == 1.0) { info = -1; copy (tmp_data, data (), len); // Restore contents. @@ -1036,7 +1037,7 @@ } ComplexDET -ComplexMatrix::determinant (int& info, volatile double& rcond) const +ComplexMatrix::determinant (int& info, double& rcond) const { ComplexDET retval; @@ -1060,7 +1061,8 @@ F77_FCN (zgeco) (tmp_data, &nr, &nr, ipvt, &rcond, z); - if (rcond + 1.0 == 1.0) + volatile double tmp_rcond = rcond; + if (tmp_rcond + 1.0 == 1.0) { info = -1; retval = ComplexDET (); @@ -1118,8 +1120,7 @@ return solve (b, info, rcond); } ComplexMatrix -ComplexMatrix::solve (const ComplexMatrix& b, int& info, - volatile double& rcond) const +ComplexMatrix::solve (const ComplexMatrix& b, int& info, double& rcond) const { ComplexMatrix retval; @@ -1142,7 +1143,8 @@ F77_FCN (zgeco) (tmp_data, &nr, &nr, ipvt, &rcond, z); - if (rcond + 1.0 == 1.0) + volatile double tmp_rcond = rcond; + if (tmp_rcond + 1.0 == 1.0) { info = -2; } @@ -1182,7 +1184,7 @@ ComplexColumnVector ComplexMatrix::solve (const ComplexColumnVector& b, int& info, - volatile double& rcond) const + double& rcond) const { ComplexColumnVector retval; @@ -1204,7 +1206,8 @@ F77_FCN (zgeco) (tmp_data, &nr, &nr, ipvt, &rcond, z); - if (rcond + 1.0 == 1.0) + volatile double tmp_rcond = rcond; + if (tmp_rcond + 1.0 == 1.0) { info = -2; } diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CMatrix.h --- a/liboctave/CMatrix.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CMatrix.h Wed Jul 20 19:56:55 1994 +0000 @@ -38,8 +38,14 @@ class ComplexMatrix : public Array2 { +friend class ComplexCHOL; +friend class ComplexHESS; friend class ComplexLU; +friend class ComplexQR; +friend class ComplexSCHUR; friend class ComplexSVD; +friend class ComplexColumnVector; +friend class Matrix; public: diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CRowVector.cc --- a/liboctave/CRowVector.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CRowVector.cc Wed Jul 20 19:56:55 1994 +0000 @@ -678,6 +678,7 @@ break; } } + return is; } /* diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CRowVector.h --- a/liboctave/CRowVector.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CRowVector.h Wed Jul 20 19:56:55 1994 +0000 @@ -37,6 +37,7 @@ class ComplexRowVector : public Array { friend class ComplexColumnVector; +friend class RowVector; public: @@ -142,7 +143,7 @@ // i/o friend ostream& operator << (ostream& os, const ComplexRowVector& a); - friend ostream& operator >> (ostream& is, ComplexRowVector& a); + friend istream& operator >> (istream& is, ComplexRowVector& a); #define KLUDGE_VECTORS #define TYPE Complex diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CmplxDET.h --- a/liboctave/CmplxDET.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CmplxDET.h Wed Jul 20 19:56:55 1994 +0000 @@ -36,6 +36,8 @@ class ComplexDET { + friend class ComplexMatrix; + public: ComplexDET (void); diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CmplxHESS.cc --- a/liboctave/CmplxHESS.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CmplxHESS.cc Wed Jul 20 19:56:55 1994 +0000 @@ -93,8 +93,8 @@ F77_FCN (zgebak) (&job, &side, &n, &ilo, &ihi, scale, &n, z, &n, &info, 1L, 1L); - hess_mat = ComplexMatrix (h,n,n); - unitary_hess_mat = ComplexMatrix (z,n,n); + hess_mat = ComplexMatrix (h, n, n); + unitary_hess_mat = ComplexMatrix (z, n, n); // If someone thinks of a more graceful way of doing this (or faster for // that matter :-)), please let me know! diff -r 1be78be437c7 -r 2ca256b77602 liboctave/CmplxSCHUR.cc --- a/liboctave/CmplxSCHUR.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/CmplxSCHUR.cc Wed Jul 20 19:56:55 1994 +0000 @@ -116,8 +116,8 @@ &lwork, rwork, bwork, &info, 1L, 1L); } - schur_mat = ComplexMatrix (s,n,n); - unitary_mat = ComplexMatrix (q,n,n); + schur_mat = ComplexMatrix (s, n, n); + unitary_mat = ComplexMatrix (q, n, n); delete [] w; delete [] work; diff -r 1be78be437c7 -r 2ca256b77602 liboctave/DAEFunc.cc --- a/liboctave/DAEFunc.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/DAEFunc.cc Wed Jul 20 19:56:55 1994 +0000 @@ -64,7 +64,7 @@ return *this; } -DAERHSFunc +DAEFunc::DAERHSFunc DAEFunc::function (void) const { return fun; @@ -77,7 +77,7 @@ return *this; } -DAEJacFunc +DAEFunc::DAEJacFunc DAEFunc::jacobian_function (void) const { return jac; diff -r 1be78be437c7 -r 2ca256b77602 liboctave/DAEFunc.h --- a/liboctave/DAEFunc.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/DAEFunc.h Wed Jul 20 19:56:55 1994 +0000 @@ -40,21 +40,24 @@ #if !defined (octave_DAEFunc_typedefs) #define octave_DAEFunc_typedefs 1 -typedef struct DAEJac -{ - Matrix *dfdxdot; - Matrix *dfdx; -}; - -typedef Vector (*DAERHSFunc) (const Vector& x, const Vector& xdot, double); -typedef DAEJac (*DAEJacFunc) (const Vector& x, const Vector& xdot, double); - #endif class DAEFunc { public: + struct DAEJac + { + Matrix *dfdxdot; + Matrix *dfdx; + }; + + typedef Vector (*DAERHSFunc) (const Vector& x, + const Vector& xdot, double); + + typedef DAEJac (*DAEJacFunc) (const Vector& x, + const Vector& xdot, double); + DAEFunc (void); DAEFunc (DAERHSFunc f); DAEFunc (DAERHSFunc f, DAEJacFunc j); diff -r 1be78be437c7 -r 2ca256b77602 liboctave/DASSL.cc --- a/liboctave/DASSL.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/DASSL.cc Wed Jul 20 19:56:55 1994 +0000 @@ -45,8 +45,8 @@ double*, double*, int*)); } -static DAERHSFunc user_fun; -static DAEJacFunc user_jac; +static DAEFunc::DAERHSFunc user_fun; +static DAEFunc::DAEJacFunc user_jac; static int nn; DAE::DAE (void) @@ -232,7 +232,7 @@ Matrix tmp_dfdxdot (nn, nn); Matrix tmp_dfdx (nn, nn); - DAEJac tmp_jac; + DAEFunc::DAEJac tmp_jac; tmp_jac.dfdxdot = &tmp_dfdxdot; tmp_jac.dfdx = &tmp_dfdx; @@ -254,7 +254,7 @@ { integration_error = 0; - if (DAEFunc::jac) + if (DAEFunc::jacobian_function ()) iwork [4] = 1; else iwork [4] = 0; diff -r 1be78be437c7 -r 2ca256b77602 liboctave/LPsolve.cc --- a/liboctave/LPsolve.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/LPsolve.cc Wed Jul 20 19:56:55 1994 +0000 @@ -35,6 +35,7 @@ Vector LPsolve::minimize (double& objf, int& inform, Vector& lambda) { + return Vector (); } void diff -r 1be78be437c7 -r 2ca256b77602 liboctave/LSODE.cc --- a/liboctave/LSODE.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/LSODE.cc Wed Jul 20 19:56:55 1994 +0000 @@ -47,8 +47,8 @@ double*, int*), int *); } -static ColumnVector (*user_fun) (ColumnVector&, double); -static Matrix (*user_jac) (ColumnVector&, double); +static ODEFunc::ODERHSFunc user_fun; +static ODEFunc::ODEJacFunc user_jac; static ColumnVector *tmp_x; ODE::ODE (void) diff -r 1be78be437c7 -r 2ca256b77602 liboctave/ODEFunc.cc --- a/liboctave/ODEFunc.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/ODEFunc.cc Wed Jul 20 19:56:55 1994 +0000 @@ -64,7 +64,7 @@ return *this; } -ODERHSFunc +ODEFunc::ODERHSFunc ODEFunc::function (void) const { return fun; @@ -77,7 +77,7 @@ return *this; } -ODEJacFunc +ODEFunc::ODEJacFunc ODEFunc::jacobian_function (void) const { return jac; diff -r 1be78be437c7 -r 2ca256b77602 liboctave/ODEFunc.h --- a/liboctave/ODEFunc.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/ODEFunc.h Wed Jul 20 19:56:55 1994 +0000 @@ -37,18 +37,13 @@ #define Vector ColumnVector #endif -#ifndef _ODEFunc_typedefs -#define _ODEFunc_typedefs 1 - -typedef Vector (*ODERHSFunc) (const Vector&, double); -typedef Matrix (*ODEJacFunc) (const Vector&, double); - -#endif - class ODEFunc { public: + typedef Vector (*ODERHSFunc) (const Vector&, double); + typedef Matrix (*ODEJacFunc) (const Vector&, double); + ODEFunc (void); ODEFunc (ODERHSFunc f); ODEFunc (ODERHSFunc f, ODEJacFunc j); diff -r 1be78be437c7 -r 2ca256b77602 liboctave/dColVector.cc --- a/liboctave/dColVector.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/dColVector.cc Wed Jul 20 19:56:55 1994 +0000 @@ -481,6 +481,7 @@ break; } } + return is; } /* diff -r 1be78be437c7 -r 2ca256b77602 liboctave/dColVector.h --- a/liboctave/dColVector.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/dColVector.h Wed Jul 20 19:56:55 1994 +0000 @@ -36,7 +36,9 @@ class ColumnVector : public Array { +friend class Matrix; friend class RowVector; +friend class ComplexColumnVector; public: @@ -132,7 +134,7 @@ // i/o friend ostream& operator << (ostream& os, const ColumnVector& a); - friend ostream& operator >> (ostream& is, ColumnVector& a); + friend istream& operator >> (istream& is, ColumnVector& a); #define KLUDGE_VECTORS #define TYPE double diff -r 1be78be437c7 -r 2ca256b77602 liboctave/dDiagMatrix.h --- a/liboctave/dDiagMatrix.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/dDiagMatrix.h Wed Jul 20 19:56:55 1994 +0000 @@ -41,6 +41,7 @@ { friend class SVD; friend class ComplexSVD; +friend class ComplexDiagMatrix; public: diff -r 1be78be437c7 -r 2ca256b77602 liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/dMatrix.cc Wed Jul 20 19:56:55 1994 +0000 @@ -566,7 +566,7 @@ } Matrix -Matrix::inverse (int& info, volatile double& rcond) const +Matrix::inverse (int& info, double& rcond) const { int nr = rows (); int nc = cols (); @@ -585,7 +585,8 @@ F77_FCN (dgeco) (tmp_data, &nr, &nc, ipvt, &rcond, z); - if (rcond + 1.0 == 1.0) + volatile double tmp_rcond = rcond; + if (tmp_rcond + 1.0 == 1.0) { info = -1; copy (tmp_data, data (), len); // Restore matrix contents. @@ -685,7 +686,7 @@ } DET -Matrix::determinant (int& info, volatile double& rcond) const +Matrix::determinant (int& info, double& rcond) const { DET retval; @@ -709,7 +710,8 @@ F77_FCN (dgeco) (tmp_data, &nr, &nr, ipvt, &rcond, z); - if (rcond + 1.0 == 1.0) + volatile double tmp_rcond = rcond; + if (tmp_rcond + 1.0 == 1.0) { info = -1; retval = DET (); @@ -746,7 +748,7 @@ } Matrix -Matrix::solve (const Matrix& b, int& info, volatile double& rcond) const +Matrix::solve (const Matrix& b, int& info, double& rcond) const { Matrix retval; @@ -767,7 +769,8 @@ F77_FCN (dgeco) (tmp_data, &nr, &nr, ipvt, &rcond, z); - if (rcond + 1.0 == 1.0) + volatile double tmp_rcond = rcond; + if (tmp_rcond + 1.0 == 1.0) { info = -2; } @@ -827,7 +830,7 @@ } ColumnVector -Matrix::solve (const ColumnVector& b, int& info, volatile double& rcond) const +Matrix::solve (const ColumnVector& b, int& info, double& rcond) const { ColumnVector retval; @@ -848,7 +851,8 @@ F77_FCN (dgeco) (tmp_data, &nr, &nr, ipvt, &rcond, z); - if (rcond + 1.0 == 1.0) + volatile double tmp_rcond = rcond; + if (tmp_rcond + 1.0 == 1.0) { info = -2; } diff -r 1be78be437c7 -r 2ca256b77602 liboctave/dMatrix.h --- a/liboctave/dMatrix.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/dMatrix.h Wed Jul 20 19:56:55 1994 +0000 @@ -28,6 +28,9 @@ #pragma interface #endif +// For FILE... +#include + #include "Array.h" #include "mx-defs.h" @@ -36,8 +39,16 @@ class Matrix : public Array2 { +friend class ColumnVector; +friend class AEPBAL; +friend class CHOL; +friend class GEPBAL; +friend class HESS; friend class LU; +friend class QR; +friend class SCHUR; friend class SVD; +friend class ComplexMatrix; public: diff -r 1be78be437c7 -r 2ca256b77602 liboctave/dRowVector.cc --- a/liboctave/dRowVector.cc Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/dRowVector.cc Wed Jul 20 19:56:55 1994 +0000 @@ -506,6 +506,7 @@ break; } } + return is; } /* diff -r 1be78be437c7 -r 2ca256b77602 liboctave/dRowVector.h --- a/liboctave/dRowVector.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/dRowVector.h Wed Jul 20 19:56:55 1994 +0000 @@ -37,6 +37,7 @@ class RowVector : public Array { friend class ColumnVector; +friend class ComplexRowVector; public: @@ -128,7 +129,7 @@ // i/o friend ostream& operator << (ostream& os, const RowVector& a); - friend ostream& operator >> (ostream& is, RowVector& a); + friend istream& operator >> (istream& is, RowVector& a); #define KLUDGE_VECTORS #define TYPE double diff -r 1be78be437c7 -r 2ca256b77602 liboctave/dbleDET.h --- a/liboctave/dbleDET.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/dbleDET.h Wed Jul 20 19:56:55 1994 +0000 @@ -34,6 +34,8 @@ class DET { +friend class Matrix; + public: DET (void); diff -r 1be78be437c7 -r 2ca256b77602 liboctave/mx-defs.h --- a/liboctave/mx-defs.h Wed Jul 20 19:47:27 1994 +0000 +++ b/liboctave/mx-defs.h Wed Jul 20 19:56:55 1994 +0000 @@ -61,10 +61,6 @@ class istream; class ostream; -#ifndef FILE -struct FILE; -#endif - #ifndef MAPPER_FCN_TYPEDEFS #define MAPPER_FCN_TYPEDEFS 1