| [9c5296] | 1 | /*
 | 
|---|
 | 2 |  * Eigenspace.hpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  Created on: Nov 22, 2010
 | 
|---|
 | 5 |  *      Author: heber
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | #ifndef EIGENSPACE_HPP_
 | 
|---|
 | 9 | #define EIGENSPACE_HPP_
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | #include <boost/shared_ptr.hpp>
 | 
|---|
 | 12 | 
 | 
|---|
 | 13 | #include <iosfwd>
 | 
|---|
 | 14 | #include <set>
 | 
|---|
 | 15 | #include <vector>
 | 
|---|
 | 16 | #include "MatrixContent.hpp"
 | 
|---|
 | 17 | #include "VectorContent.hpp"
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | /** Container for a matrix and its eigenvectors and -values.
 | 
|---|
 | 20 |  *
 | 
|---|
 | 21 |  *  Note that a set of eigenvectors always forms a subspace within a vector
 | 
|---|
 | 22 |  *  space, the so-called eigenspace. Hence, the name of this class is
 | 
|---|
 | 23 |  *  eigenspace.
 | 
|---|
 | 24 |  *
 | 
|---|
 | 25 |  *  Eigenvector are stored internally as a matrix. A returned set of
 | 
|---|
 | 26 |  *  eigenvectors is just a set of VectorViewContent on row vectors in
 | 
|---|
 | 27 |  *  this matrix.
 | 
|---|
 | 28 |  */
 | 
|---|
 | 29 | class Eigenspace
 | 
|---|
 | 30 | {
 | 
|---|
| [a06042] | 31 |   friend std::ostream & operator<<(std::ostream &ost, const Eigenspace &_s);
 | 
|---|
| [9c5296] | 32 | public:
 | 
|---|
 | 33 |   typedef std::vector< boost::shared_ptr<VectorContent> > eigenvectorset;
 | 
|---|
 | 34 |   typedef std::vector< double > eigenvalueset;
 | 
|---|
 | 35 |   typedef std::set<size_t> indexset;
 | 
|---|
 | 36 | 
 | 
|---|
 | 37 |   Eigenspace(const indexset &_Indices);
 | 
|---|
 | 38 |   Eigenspace(const indexset &_Indices, const MatrixContent &_matrix);
 | 
|---|
 | 39 |   virtual ~Eigenspace();
 | 
|---|
 | 40 | 
 | 
|---|
 | 41 |   void calculateEigenSubspace();
 | 
|---|
 | 42 | 
 | 
|---|
 | 43 |   // accessors
 | 
|---|
 | 44 |   const MatrixContent & getEigenspaceMatrix() const;
 | 
|---|
| [a06042] | 45 |   const VectorContent & getEigenvector(size_t i) const;
 | 
|---|
| [9c5296] | 46 |   const indexset & getIndices() const;
 | 
|---|
 | 47 |   void setEigenspaceMatrix(const MatrixContent &_content);
 | 
|---|
 | 48 | 
 | 
|---|
| [a06042] | 49 |   void setEigenpairs(const eigenvectorset &CurrentEigenvectors, const eigenvalueset &CurrentEigenvalues);
 | 
|---|
 | 50 | 
 | 
|---|
| [9c5296] | 51 |   bool contains(const Eigenspace &_indexset);
 | 
|---|
 | 52 | 
 | 
|---|
 | 53 | protected:
 | 
|---|
 | 54 |   const indexset Indices;
 | 
|---|
 | 55 |   eigenvectorset Eigenvectors;
 | 
|---|
 | 56 |   eigenvalueset Eigenvalues;
 | 
|---|
 | 57 |   MatrixContent EigenspaceMatrix;
 | 
|---|
 | 58 |   MatrixContent EigenvectorMatrix;
 | 
|---|
 | 59 | 
 | 
|---|
 | 60 | private:
 | 
|---|
 | 61 |   void createEigenvectorViews();
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 | };
 | 
|---|
 | 64 | 
 | 
|---|
 | 65 | std::ostream & operator<<(std::ostream &ost, const Eigenspace &_s);
 | 
|---|
 | 66 | 
 | 
|---|
 | 67 | #endif /* EIGENSPACE_HPP_ */
 | 
|---|