| 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 | {
|
|---|
| 31 | friend std::ostream & operator<<(std::ostream &ost, const Eigenspace &_s);
|
|---|
| 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;
|
|---|
| 45 | const VectorContent & getEigenvector(const size_t i) const;
|
|---|
| 46 | const MatrixContent & getEigenvectorMatrix() const;
|
|---|
| 47 | const double getEigenvalue(const size_t i) const;
|
|---|
| 48 | const eigenvalueset & getEigenvalues() const;
|
|---|
| 49 | const indexset & getIndices() const;
|
|---|
| 50 | void setEigenspaceMatrix(const MatrixContent &_content);
|
|---|
| 51 |
|
|---|
| 52 | void setEigenpairs(const eigenvectorset &CurrentEigenvectors, const eigenvalueset &CurrentEigenvalues);
|
|---|
| 53 |
|
|---|
| 54 | bool contains(const Eigenspace &_indexset);
|
|---|
| 55 |
|
|---|
| 56 | protected:
|
|---|
| 57 | const indexset Indices;
|
|---|
| 58 | eigenvectorset Eigenvectors;
|
|---|
| 59 | eigenvalueset Eigenvalues;
|
|---|
| 60 | MatrixContent EigenspaceMatrix;
|
|---|
| 61 | MatrixContent EigenvectorMatrix;
|
|---|
| 62 |
|
|---|
| 63 | private:
|
|---|
| 64 | void createEigenvectorViews();
|
|---|
| 65 |
|
|---|
| 66 | };
|
|---|
| 67 |
|
|---|
| 68 | std::ostream & operator<<(std::ostream &ost, const Eigenspace &_s);
|
|---|
| 69 |
|
|---|
| 70 | #endif /* EIGENSPACE_HPP_ */
|
|---|