svdrep.hpp

Go to the documentation of this file.
00001 /* Kernel Independent Fast Multipole Method
00002    Copyright (C) 2004 Lexing Ying, New York University
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2, or (at your option)
00007 any later version.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT
00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00012 for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; see the file COPYING.  If not, write to the Free
00016 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017 02111-1307, USA.  */
00019 #ifndef _SVDREP_HPP_
00020 #define _SVDREP_HPP_
00021 
00022 #include "nummat.hpp"
00023 
00024 using std::endl;
00025 
00027 
00031 class SVDRep
00032 {
00033 public:
00035   SVDRep()   {}
00037   SVDRep(const SVDRep& C): _matU(C._matU), _matS(C._matS), _matVT(C._matVT)  {}
00039   ~SVDRep()  {}
00040 
00042   SVDRep& operator=(const SVDRep& c)  { _matU = c._matU; _matS = c._matS; _matVT = c._matVT; return *this; }
00043   //access
00045   DblNumMat& U() { return _matU; }
00047   DblNumVec& S() { return _matS; }
00049   DblNumMat& VT(){ return _matVT; }
00050   //ops
00053   int construct(double epsilon, const DblNumMat& M);
00061   int dgemv(double alpha, const DblNumVec& X, double beta, DblNumVec& Y, double tol=0.0); // y <- a Mx + b y
00069   int dgemv(double alpha, double* X, double beta, double* Y, double tol=0.0);
00070 
00072   int m() const { return _matU.m(); }
00074   int k() const { return _matS.m(); } //length
00076   int n() const { return _matVT.n(); }
00077   
00078 protected:
00080   DblNumMat _matU;
00082   DblNumVec _matS;
00084   DblNumMat _matVT;
00085 };      
00087 inline ostream& operator<<( ostream& os, SVDRep& svdrep)
00088 {
00089   os<<svdrep.U().m()<<" "<<svdrep.S().m()<<" "<<svdrep.VT().n()<<endl;
00090   os<<svdrep.U()<<svdrep.S()<<svdrep.VT()<<endl;
00091   return os;
00092 }
00093 
00094 //int matvec(double a, const DblNumVec& X, double b, DblNumVec& Y); // y <- a Mx + b y
00095 //int matvec(double a, double* X, double b, double* Y);
00096 
00097 #endif

Generated on Sun Dec 4 18:13:13 2005 for common by  doxygen 1.4.5