[9c5296] | 1 | /*
|
---|
| 2 | * Subspace.hpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Nov 22, 2010
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef SUBSPACE_HPP_
|
---|
| 9 | #define SUBSPACE_HPP_
|
---|
| 10 |
|
---|
| 11 | #include <map>
|
---|
| 12 | #include <set>
|
---|
| 13 | #include <vector>
|
---|
| 14 | #include "Eigenspace.hpp"
|
---|
| 15 | #include "MatrixContent.hpp"
|
---|
| 16 | #include "VectorContent.hpp"
|
---|
[a06042] | 17 | #include "unittests/SubspaceFactorizerUnittest.hpp"
|
---|
[9c5296] | 18 |
|
---|
| 19 | /** A subset of eigenvectors from an Eigenspace.
|
---|
| 20 | *
|
---|
| 21 | * In this class we regard a sub set of eigenvectors of an Eigenspace
|
---|
| 22 | * which span a subspace of the eigenspace. This is used for diagonalization
|
---|
| 23 | * of the Eigenspace's matrix in linear-scaling, subspace decomposition
|
---|
| 24 | * schemes.
|
---|
| 25 | *
|
---|
| 26 | * Here, beyond the contents of Eigenspace, we need projection matrices from
|
---|
| 27 | * and to this subspace and also mappings from the global indices to the local
|
---|
| 28 | * indices, to identify local eigenvectors in this Subspace with their
|
---|
| 29 | * counterparts in the full Eigenspace.
|
---|
| 30 | *
|
---|
| 31 | */
|
---|
| 32 | class Subspace : public Eigenspace
|
---|
| 33 | {
|
---|
[a06042] | 34 | // TODO: Remove if not needed anymore
|
---|
| 35 | friend void SubspaceFactorizerUnittest::SubspaceTest();
|
---|
[9c5296] | 36 | public:
|
---|
| 37 | typedef std::map<size_t, size_t> mapping;
|
---|
| 38 | typedef std::set< boost::shared_ptr<Subspace> > subset;
|
---|
| 39 |
|
---|
| 40 | Subspace(indexset &_s, Eigenspace &_FullSpace);
|
---|
| 41 | ~Subspace();
|
---|
| 42 |
|
---|
| 43 | // manipulate subsets
|
---|
| 44 | bool addSubset(boost::shared_ptr<Subspace> &_s);
|
---|
| 45 | bool removeSubset(boost::shared_ptr<Subspace> &_s);
|
---|
| 46 |
|
---|
[e828c0] | 47 | // solving
|
---|
[9c5296] | 48 | void calculateEigenSubspace();
|
---|
[e828c0] | 49 |
|
---|
| 50 | // accessing
|
---|
[286af5f] | 51 | const MatrixContent & getEigenvectorMatrixInFullSpace();
|
---|
| 52 | const eigenvectorset & getEigenvectorsInFullSpace();
|
---|
| 53 | const VectorContent getEigenvectorParallelToFullOne(size_t i);
|
---|
| 54 | const double getEigenvalueOfEigenvectorParallelToFullOne(size_t i);
|
---|
[e828c0] | 55 | const subset & getSubIndices() const;
|
---|
[9c5296] | 56 |
|
---|
| 57 | private:
|
---|
| 58 |
|
---|
[e828c0] | 59 | void createLocalMapping();
|
---|
[9c5296] | 60 | void invertLocalToGlobalMapping();
|
---|
| 61 | void getSubspacematrixFromBigmatrix(const MatrixContent & bigmatrix);
|
---|
[e828c0] | 62 | void sortEigenvectors();
|
---|
| 63 | void correctEigenvectorsFromSubIndices();
|
---|
| 64 | void correctProjectionMatricesFromSubIndices();
|
---|
| 65 | void scaleEigenvectorsbyEigenvalue();
|
---|
| 66 | void getNormofEigenvectorAsEigenvalue();
|
---|
[a06042] | 67 | void createProjectionMatrices();
|
---|
[e828c0] | 68 | const MatrixContent projectFullspaceMatrixToSubspace(const MatrixContent &_fullmatrix) const;
|
---|
| 69 | const MatrixContent projectSubspaceMatrixToFullspace(const MatrixContent &_subspacematrix) const;
|
---|
[9c5296] | 70 |
|
---|
| 71 | mapping LocalToGlobal;
|
---|
| 72 | mapping GlobalToLocal;
|
---|
| 73 | subset SubIndices;
|
---|
| 74 | MatrixContent ProjectToSubspace;
|
---|
| 75 | MatrixContent ProjectFromSubspace;
|
---|
| 76 | Eigenspace &FullSpace;
|
---|
[286af5f] | 77 |
|
---|
| 78 | const VectorContent ZeroVector;
|
---|
[9c5296] | 79 | };
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | #endif /* SUBSPACE_HPP_ */
|
---|