Mercurial > hg > octave-terminal
changeset 532:2ca256b77602
[project @ 1994-07-20 19:56:55 by jwe]
author | jwe |
---|---|
date | Wed, 20 Jul 1994 19:56:55 +0000 |
parents | 1be78be437c7 |
children | 883197c5ad75 |
files | liboctave/CColVector.cc liboctave/CColVector.h liboctave/CDiagMatrix.h liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/CRowVector.cc liboctave/CRowVector.h liboctave/CmplxDET.h liboctave/CmplxHESS.cc liboctave/CmplxSCHUR.cc liboctave/DAEFunc.cc liboctave/DAEFunc.h liboctave/DASSL.cc liboctave/LPsolve.cc liboctave/LSODE.cc liboctave/ODEFunc.cc liboctave/ODEFunc.h liboctave/dColVector.cc liboctave/dColVector.h liboctave/dDiagMatrix.h liboctave/dMatrix.cc liboctave/dMatrix.h liboctave/dRowVector.cc liboctave/dRowVector.h liboctave/dbleDET.h liboctave/mx-defs.h |
diffstat | 26 files changed, 96 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CColVector.cc +++ b/liboctave/CColVector.cc @@ -649,6 +649,7 @@ break; } } + return is; } /*
--- a/liboctave/CColVector.h +++ b/liboctave/CColVector.h @@ -36,7 +36,9 @@ class ComplexColumnVector : public Array<Complex> { +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<Complex> (d, l) { } };
--- a/liboctave/CDiagMatrix.h +++ b/liboctave/CDiagMatrix.h @@ -41,6 +41,8 @@ class ComplexDiagMatrix : public DiagArray<Complex> { + friend DiagMatrix; + public: ComplexDiagMatrix (void) : DiagArray<Complex> () { }
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -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; }
--- a/liboctave/CMatrix.h +++ b/liboctave/CMatrix.h @@ -38,8 +38,14 @@ class ComplexMatrix : public Array2<Complex> { +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:
--- a/liboctave/CRowVector.cc +++ b/liboctave/CRowVector.cc @@ -678,6 +678,7 @@ break; } } + return is; } /*
--- a/liboctave/CRowVector.h +++ b/liboctave/CRowVector.h @@ -37,6 +37,7 @@ class ComplexRowVector : public Array<Complex> { 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
--- a/liboctave/CmplxDET.h +++ b/liboctave/CmplxDET.h @@ -36,6 +36,8 @@ class ComplexDET { + friend class ComplexMatrix; + public: ComplexDET (void);
--- a/liboctave/CmplxHESS.cc +++ b/liboctave/CmplxHESS.cc @@ -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!
--- a/liboctave/CmplxSCHUR.cc +++ b/liboctave/CmplxSCHUR.cc @@ -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;
--- a/liboctave/DAEFunc.cc +++ b/liboctave/DAEFunc.cc @@ -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;
--- a/liboctave/DAEFunc.h +++ b/liboctave/DAEFunc.h @@ -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);
--- a/liboctave/DASSL.cc +++ b/liboctave/DASSL.cc @@ -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;
--- a/liboctave/LPsolve.cc +++ b/liboctave/LPsolve.cc @@ -35,6 +35,7 @@ Vector LPsolve::minimize (double& objf, int& inform, Vector& lambda) { + return Vector (); } void
--- a/liboctave/LSODE.cc +++ b/liboctave/LSODE.cc @@ -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)
--- a/liboctave/ODEFunc.cc +++ b/liboctave/ODEFunc.cc @@ -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;
--- a/liboctave/ODEFunc.h +++ b/liboctave/ODEFunc.h @@ -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);
--- a/liboctave/dColVector.cc +++ b/liboctave/dColVector.cc @@ -481,6 +481,7 @@ break; } } + return is; } /*
--- a/liboctave/dColVector.h +++ b/liboctave/dColVector.h @@ -36,7 +36,9 @@ class ColumnVector : public Array<double> { +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
--- a/liboctave/dDiagMatrix.h +++ b/liboctave/dDiagMatrix.h @@ -41,6 +41,7 @@ { friend class SVD; friend class ComplexSVD; +friend class ComplexDiagMatrix; public:
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -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; }
--- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -28,6 +28,9 @@ #pragma interface #endif +// For FILE... +#include <stdio.h> + #include "Array.h" #include "mx-defs.h" @@ -36,8 +39,16 @@ class Matrix : public Array2<double> { +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:
--- a/liboctave/dRowVector.cc +++ b/liboctave/dRowVector.cc @@ -506,6 +506,7 @@ break; } } + return is; } /*
--- a/liboctave/dRowVector.h +++ b/liboctave/dRowVector.h @@ -37,6 +37,7 @@ class RowVector : public Array<double> { 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