| 1 | /*
|
|---|
| 2 | * MatrixContainer.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Sep 15, 2011
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef MATRIXCONTAINER_HPP_
|
|---|
| 9 | #define MATRIXCONTAINER_HPP_
|
|---|
| 10 |
|
|---|
| 11 | // include config.h
|
|---|
| 12 | #ifdef HAVE_CONFIG_H
|
|---|
| 13 | #include <config.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #include <vector>
|
|---|
| 17 |
|
|---|
| 18 | /** Contains a sequence of matrices parsed from file.
|
|---|
| 19 | *
|
|---|
| 20 | */
|
|---|
| 21 | class MatrixContainer {
|
|---|
| 22 | public:
|
|---|
| 23 | typedef std::vector<std::vector<double> > MatrixArray;
|
|---|
| 24 | typedef std::vector<MatrixArray> ArrayOfMatrices;
|
|---|
| 25 | typedef std::vector<std::string> StringVector;
|
|---|
| 26 | typedef std::vector<int> IntVector;
|
|---|
| 27 | typedef std::vector<IntVector> VectorOfIntVectors;
|
|---|
| 28 |
|
|---|
| 29 | ArrayOfMatrices Matrix;
|
|---|
| 30 | VectorOfIntVectors Indices;
|
|---|
| 31 | StringVector Header;
|
|---|
| 32 | int MatrixCounter;
|
|---|
| 33 | IntVector RowCounter;
|
|---|
| 34 | IntVector ColumnCounter;
|
|---|
| 35 |
|
|---|
| 36 | MatrixContainer();
|
|---|
| 37 | virtual ~MatrixContainer();
|
|---|
| 38 |
|
|---|
| 39 | bool InitialiseIndices(class MatrixContainer *Matrix = NULL);
|
|---|
| 40 | bool ParseMatrix(std::istream &input, int skiplines, int skipcolumns, size_t MatrixNr);
|
|---|
| 41 | virtual bool ParseFragmentMatrix(const std::string name, const std::string prefix, std::string suffix, int skiplines, int skipcolumns);
|
|---|
| 42 | bool AllocateMatrix(StringVector GivenHeader, int MCounter, IntVector RCounter, IntVector CCounter);
|
|---|
| 43 | bool ResetMatrix();
|
|---|
| 44 | double FindMinValue();
|
|---|
| 45 | double FindMaxValue();
|
|---|
| 46 | bool SetLastMatrix(double value, int skipcolumns);
|
|---|
| 47 | bool SetLastMatrix(const MatrixArray &values, int skipcolumns);
|
|---|
| 48 | //bool ParseIndices();
|
|---|
| 49 | //bool SumSubValues();
|
|---|
| 50 | bool SumSubManyBodyTerms(class MatrixContainer &Matrix, class KeySetsContainer &KeySets, int Order);
|
|---|
| 51 | bool WriteTotalFragments(const std::string name, const std::string prefix);
|
|---|
| 52 | bool WriteLastMatrix(const std::string name, const std::string prefix, const std::string suffix);
|
|---|
| 53 | };
|
|---|
| 54 |
|
|---|
| 55 | std::ostream & operator << (std::ostream &ost, const MatrixContainer &m);
|
|---|
| 56 |
|
|---|
| 57 | #endif /* MATRIXCONTAINER_HPP_ */
|
|---|