File: SylvMatrix.h

package info (click to toggle)
dynare 4.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 40,640 kB
  • sloc: fortran: 82,231; cpp: 72,734; ansic: 28,874; pascal: 13,241; sh: 4,300; objc: 3,281; yacc: 2,833; makefile: 1,288; lex: 1,162; python: 162; lisp: 54; xml: 8
file content (81 lines) | stat: -rw-r--r-- 2,796 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* $Header: /var/lib/cvs/dynare_cpp/sylv/cc/SylvMatrix.h,v 1.1.1.1 2004/06/04 13:00:44 kamenik Exp $ */

/* Tag $Name:  $ */

#ifndef SYLV_MATRIX_H
#define SYLV_MATRIX_H

#include "GeneralMatrix.h"
#include "KronVector.h"

class SqSylvMatrix;

class SylvMatrix : public GeneralMatrix {
public:
	SylvMatrix(int m, int n)
		: GeneralMatrix(m,n) {}
	SylvMatrix(const double* d, int m, int n)
		: GeneralMatrix(d, m, n) {}
	SylvMatrix(double* d, int m, int n)
		: GeneralMatrix(d, m, n) {}
	SylvMatrix(const GeneralMatrix& m)
		: GeneralMatrix(m) {}
	SylvMatrix(const GeneralMatrix& m, int i, int j, int nrows, int ncols)
		: GeneralMatrix(m, i, j, nrows, ncols) {}
	SylvMatrix(GeneralMatrix& m, int i, int j, int nrows, int ncols)
		: GeneralMatrix(m, i, j, nrows, ncols) {}
	SylvMatrix(const GeneralMatrix& a, const GeneralMatrix& b)
		: GeneralMatrix(a, b) {}

	/* this = |I 0|* this
	          |0 m|         */
	void multLeftI(const SqSylvMatrix& m);
	/* this = |I  0|* this
	          |0 m'|         */
	void multLeftITrans(const SqSylvMatrix& m);
	/* this = |0 a|*b, so that |0 a| is square */
	void multLeft(int zero_cols, const GeneralMatrix& a, const GeneralMatrix& b);
	/* this = this * (m\otimes m..\otimes m) */
	void multRightKron(const SqSylvMatrix& m, int order);
	/* this = this * (m'\otimes m'..\otimes m') */
	void multRightKronTrans(const SqSylvMatrix& m, int order);
	/* this = P*this, x = P*x, where P is gauss transformation setting
	 * a given element to zero */
	void eliminateLeft(int row, int col, Vector& x);
	/* this = this*P, x = P'*x, where P is gauss transformation setting
	 * a given element to zero */
	void eliminateRight(int row, int col, Vector& x);
};


class SqSylvMatrix : public SylvMatrix {
public:
	SqSylvMatrix(int m) : SylvMatrix(m, m) {}
	SqSylvMatrix(const double* d, int m) : SylvMatrix(d, m, m) {}
	SqSylvMatrix(double* d, int m) : SylvMatrix(d, m, m) {}
	SqSylvMatrix(const SqSylvMatrix& m) : SylvMatrix(m) {}
	SqSylvMatrix(const GeneralMatrix& m, int i, int j, int nrows)
		: SylvMatrix(m, i, j, nrows, nrows) {} 
	SqSylvMatrix(GeneralMatrix& m, int i, int j, int nrows)
		: SylvMatrix(m, i, j, nrows, nrows) {} 
	SqSylvMatrix(const GeneralMatrix& a, const GeneralMatrix& b);
	const SqSylvMatrix& operator=(const SqSylvMatrix& m)
		{GeneralMatrix::operator=(m); return *this;}
	/* x = (this \otimes this..\otimes this)*d */
	void multVecKron(KronVector& x, const KronVector& d) const;
	/* x = (this' \otimes this'..\otimes this')*d */
	void multVecKronTrans(KronVector& x, const KronVector& d) const;
	/* a = inv(this)*a, b=inv(this)*b */
	void multInvLeft2(GeneralMatrix& a, GeneralMatrix& b,
					  double& rcond1, double& rcondinf) const;
	/* this = I */
	void setUnit();
};


#endif /* SYLV_MATRIX_H */


// Local Variables:
// mode:C++
// End: