Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

doublematrix.h

Go to the documentation of this file.
00001 //****************************************************
00002 //  April, 1993, University of Illinois
00003 // Copyright (C) 1993, 1994 Tianlin Wang
00004 /* Copyright (C) 1994-2003 Matvec Development Team. 
00005 
00006   This program is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Library General Public
00008   License as published by the Free Software Foundation; either
00009   version 2 of the License, or (at your option) any later version.
00010   
00011   This program is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Library General Public License for more details.
00015     
00016   You should have received a copy of the GNU Library General Public
00017   License along with this library; if not, write to the Free
00018   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019   MA 02111-1307, USA 
00020 */
00021 
00022 #ifndef MATVEC_DOUBLE_MATRIX_H
00023 #define MATVEC_DOUBLE_MATRIX_H
00024 #include "session.h"
00025 #include "matrix.h"
00026 
00027 namespace matvec {
00028 class doubleMatrix : public Matrix<double> {
00029   friend class Model;
00030 public:
00031    doubleMatrix(void) : Matrix<double>() {}
00032    explicit doubleMatrix(const size_type m,const size_type n) : Matrix<double>(m,n)  {}
00033    doubleMatrix(const size_type m,const size_type n,const double** a) : Matrix<double>(m,n,a) {}
00034    doubleMatrix(const doubleMatrix& a) : Matrix<double>(a) { }
00035    doubleMatrix(const Matrix<double>& a) : Matrix<double>(a) { }
00036 
00037    doubleMatrix&   operator = (const Matrix<double> &a) { copy(a); return *this; }
00038    doubleMatrix&   operator = (const Matrix<bool> &a);
00039 
00040    bool            psd(void) const;
00041    void            svd(doubleMatrix& u,Vector<double>& s,doubleMatrix& v);
00042    int             rank(void);
00043    doubleMatrix&   inv();
00044    doubleMatrix    ginv0(void) const;
00045    doubleMatrix    splines(const doubleMatrix knots,const unsigned type=0) const;
00046    doubleMatrix&   ginv1(unsigned *irank=0);
00047   doubleMatrix   mat_log(double tol=0) const; //Returns Matrix log
00048   doubleMatrix   mat_exp(double tol=0) const;  //Returns Matrix exp
00049   void    mat_exp_der(Vector<doubleMatrix> &der,double tol=0) const; // Returns  partial derivatives
00050    doubleMatrix    covariance(const doubleMatrix &B) const;
00051    Vector<double>  variance(orientation orien = COLUMN) const;
00052    doubleMatrix    lu_solve(const doubleMatrix& rhs);
00053    Vector<double>  lu_solve(const Vector<double>& rhs);
00054    void            gs_solve(const doubleMatrix& v,doubleMatrix& solmat,const double relax=1.0,
00055                       const double stopval=0.001,const int mxiter=1000);
00056    void            gs_solve(const Vector<double>& v,Vector<double>& solvec,const double relax=1.0,
00057                       const double stopval=0.001,const int mxiter=1000);
00058 
00059    Vector<double>  eigen(const int job=1);
00060    double          cond(void);
00061    double          det(void) const;
00062    double          norm(const int p) const;
00063    double          norm(const std::string &s) const;
00064    double          logdet(void);
00065    double          quadratic(const Vector<double> &a,const Vector<double> &b) const;
00066    doubleMatrix&   sqrtm(void);
00067    doubleMatrix&   identity(const int m,const int n);
00068    doubleMatrix&   identity(const int m) {return identity(m,m);}
00069    doubleMatrix&   identity(void) {return identity(num_rows(),num_cols());}
00070    doubleMatrix&   sweep(const size_type i0,const size_type i1);
00071    doubleMatrix&   sweep(void) {return sweep(num_rows() - 1, num_cols() - 1);}
00072   bool            symmetric(void) const {if (!me) return false;
00073   for (int i=1; i<nrow; ++i) for (int j=0; j<i; ++j) if (fabs(me[i][j]-me[j][i])> (fabs(me[i][j]+me[j][i])*SESSION.epsilon) && fabs(me[i][j]-me[j][i]) > SESSION.epsilon) return false;
00074    return true;
00075   } ;
00076 
00077 protected:
00078   //   int nrow,ncol;
00079   //   double** me;
00080 };
00081 
00082 } ///////// end of namespace matvec
00083 #endif
00084 

Generated on Thu Jun 16 17:13:39 2005 for Matvec by doxygen1.2.16