STK++ 1.0
STK_EigenvaluesSymmetric.h
Go to the documentation of this file.
00001 /*--------------------------------------------------------------------*/
00002 /*     Copyright (C) 2004-2007  Serge Iovleff
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU Lesser General Public License as
00006     published by the Free Software Foundation; either version 2 of the
00007     License, or (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU Lesser General Public License for more details.
00013 
00014     You should have received a copy of the GNU Lesser General Public
00015     License along with this program; if not, write to the
00016     Free Software Foundation, Inc.,
00017     59 Temple Place,
00018     Suite 330,
00019     Boston, MA 02111-1307
00020     USA
00021 
00022     Contact : Serge.Iovleff@stkpp.org
00023 */
00024 
00025 /*
00026  * Project:  stkpp::Algebra
00027  * Purpose:  Define The EigenvaluesSymmetric Class.
00028  * Author:   Serge Iovleff, serge.iovleff@stkpp.org
00029  **/
00030 
00036 #ifndef STK_EIGENVALUESSYMMETRIC_H
00037 #define STK_EIGENVALUESSYMMETRIC_H
00038 
00039 #include "../../Sdk/include/STK_IRunnerPtr2D.h"
00040 
00041 #include "../../Arrays/include/STK_MatrixSquare.h"
00042 
00043 namespace STK
00044 {
00062 class EigenvaluesSymmetric : public IRunnerPtr2D<Real, Matrix>
00063 {
00065   typedef IRunnerPtr2D<Real, Matrix> IRunnerPtrMatrix;
00066 
00067   public:
00071     EigenvaluesSymmetric( MatrixSquare const* A);
00072     
00076     EigenvaluesSymmetric(const EigenvaluesSymmetric& S);
00077 
00079     virtual ~EigenvaluesSymmetric();
00080 
00084     virtual bool run();
00085 
00090     virtual bool run(Vector const& weights);
00091 
00096     EigenvaluesSymmetric& operator=(const EigenvaluesSymmetric &S);
00097 
00101     inline Real norm()  const { return norm_;}
00105     inline Integer rank()  const { return rank_;}
00109     inline Real det()  const { return det_;}
00113     inline MatrixSquare const& rotation() const{ return P_;}
00117     inline Vector const& eigenvalues() const { return D_;}
00121     inline Integer const& first() const{ return first_;}
00125     inline Integer const& last() const { return last_;}
00126 
00132     MatrixSquare* ginv();
00133 
00138     void ginv(MatrixSquare& res);
00139 
00140   protected:
00146     MatrixSquare P_;
00148     Vector D_;
00150     Integer first_;
00152     Integer last_;
00154     Real norm_;
00156     Integer rank_;
00158     Real det_;
00160     bool error_;
00161 
00162   private:
00164     Vector F_;
00166     void tridiagonalize();
00168     void compHouse();
00170     void diagonalize();
00172     void compEstimates();
00173 };
00174 
00175 } // Namespace STK
00176 
00177 #endif //STK_EIGENVALUESSYMMETRIC_H