2019-06-19 14:34:30 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2004-2011 Ondra Kamenik
|
|
|
|
* Copyright © 2019 Dynare Team
|
|
|
|
*
|
|
|
|
* This file is part of Dynare.
|
|
|
|
*
|
|
|
|
* Dynare is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Dynare is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2009-09-08 15:55:19 +02:00
|
|
|
|
|
|
|
#ifndef SCHUR_DECOMP_H
|
|
|
|
#define SCHUR_DECOMP_H
|
|
|
|
|
2019-01-08 17:12:05 +01:00
|
|
|
#include "SylvMatrix.hh"
|
|
|
|
#include "QuasiTriangular.hh"
|
2009-09-08 15:55:19 +02:00
|
|
|
|
2019-01-15 18:55:09 +01:00
|
|
|
#include <memory>
|
|
|
|
|
2009-09-08 15:55:19 +02:00
|
|
|
class QuasiTriangular;
|
2017-05-16 16:30:27 +02:00
|
|
|
class SchurDecomp
|
|
|
|
{
|
2019-01-15 18:55:09 +01:00
|
|
|
SqSylvMatrix q;
|
|
|
|
// Stores t if is owned
|
|
|
|
std::unique_ptr<QuasiTriangular> t_storage;
|
2017-05-16 16:30:27 +02:00
|
|
|
QuasiTriangular *t;
|
2009-09-08 15:55:19 +02:00
|
|
|
public:
|
2017-05-16 16:30:27 +02:00
|
|
|
SchurDecomp(const SqSylvMatrix &m);
|
|
|
|
SchurDecomp(const QuasiTriangular &tr);
|
|
|
|
SchurDecomp(QuasiTriangular &tr);
|
|
|
|
const SqSylvMatrix &
|
|
|
|
getQ() const
|
|
|
|
{
|
2019-01-15 18:55:09 +01:00
|
|
|
return q;
|
2017-05-16 16:30:27 +02:00
|
|
|
}
|
|
|
|
const QuasiTriangular &
|
|
|
|
getT() const
|
|
|
|
{
|
|
|
|
return *t;
|
|
|
|
}
|
|
|
|
SqSylvMatrix &
|
|
|
|
getQ()
|
|
|
|
{
|
2019-01-15 18:55:09 +01:00
|
|
|
return q;
|
2017-05-16 16:30:27 +02:00
|
|
|
}
|
|
|
|
QuasiTriangular &
|
|
|
|
getT()
|
|
|
|
{
|
|
|
|
return *t;
|
|
|
|
}
|
|
|
|
virtual int getDim() const;
|
2019-01-15 18:55:09 +01:00
|
|
|
virtual ~SchurDecomp() = default;
|
2009-09-08 15:55:19 +02:00
|
|
|
};
|
|
|
|
|
2017-05-16 16:30:27 +02:00
|
|
|
class SchurDecompZero : public SchurDecomp
|
|
|
|
{
|
2019-03-27 19:22:35 +01:00
|
|
|
GeneralMatrix ru; // right upper matrix
|
2009-09-08 15:55:19 +02:00
|
|
|
public:
|
2017-05-16 16:30:27 +02:00
|
|
|
SchurDecompZero(const GeneralMatrix &m);
|
2019-01-24 15:22:36 +01:00
|
|
|
ConstGeneralMatrix
|
2017-05-16 16:30:27 +02:00
|
|
|
getRU() const
|
|
|
|
{
|
|
|
|
return ru;
|
|
|
|
}
|
2019-01-09 16:26:42 +01:00
|
|
|
int getDim() const override;
|
2017-05-16 16:30:27 +02:00
|
|
|
int
|
|
|
|
getZeroCols() const
|
|
|
|
{
|
2019-04-16 12:40:50 +02:00
|
|
|
return ru.nrows();
|
2017-05-16 16:30:27 +02:00
|
|
|
}
|
2009-09-08 15:55:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* SCHUR_DECOMP_H */
|