File: korder_stoch.cweb

package info (click to toggle)
dynare 4.5.7-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 49,408 kB
  • sloc: cpp: 84,998; ansic: 29,058; pascal: 13,843; sh: 4,833; objc: 4,236; yacc: 3,622; makefile: 2,278; lex: 1,541; python: 236; lisp: 69; xml: 8
file content (127 lines) | stat: -rw-r--r-- 4,805 bytes parent folder | download | duplicates (5)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
@q $Id: korder_stoch.cweb 148 2005-04-19 15:12:26Z kamenik $ @>
@q Copyright 2005, Ondra Kamenik @>

@ Start of {\tt korder\_stoch.cpp} file.
@c
#include "korder_stoch.h"

@<|MatrixAA| constructor code@>;
@<|KOrderStoch| folded constructor code@>;
@<|KOrderStoch| unfolded constructor code@>;
@<|KOrderStoch| convenience method specializations@>;

@ Same as |@<|MatrixA| constructor code@>|, but the submatrix |gss_ys| is passed directly.
@<|MatrixAA| constructor code@>=
MatrixAA::MatrixAA(const FSSparseTensor& f, const IntSequence& ss,
				   const TwoDMatrix& gss_ys, const PartitionY& ypart)
	: PLUMatrix(ypart.ny())
{
	zeros();

	IntSequence c(1); c[0] = 1;
	FGSTensor f_y(f, ss, c, TensorDimens(ss, c));
	add(1.0, f_y);

	c[0] = 0;
	FGSTensor f_yss(f, ss, c, TensorDimens(ss, c));
	TwoDMatrix sub(*this, ypart.nstat, ypart.nys());
	sub.multAndAdd(f_yss, gss_ys);

	calcPLU();
}
	

@ 
@<|KOrderStoch| folded constructor code@>=
KOrderStoch::KOrderStoch(const PartitionY& yp, int nu,
						 const TensorContainer<FSSparseTensor>& fcont,
						 const FGSContainer& hh, Journal& jr)
	: nvs(4), ypart(yp), journal(jr),@/
	  _ug(4), _fg(4), _ugs(4), _fgs(4), _uG(4), _fG(4),@/
	  _uh(NULL), _fh(&hh),@/
	  _uZstack(&_uG, ypart.nyss(), &_ug, ypart.ny(), ypart.nys(), nu),@/
	  _fZstack(&_fG, ypart.nyss(), &_fg, ypart.ny(), ypart.nys(), nu),@/
	  _uGstack(&_ugs, ypart.nys(), nu),@/
	  _fGstack(&_fgs, ypart.nys(), nu),@/
	  f(fcont),@/
	  matA(*(fcont.get(Symmetry(1))), _uZstack.getStackSizes(), *(hh.get(Symmetry(1,0,0,0))),
		   ypart)
{
	nvs[0] = ypart.nys();
	nvs[1] = nu;
	nvs[2] = nu;
	nvs[3] = 1;
}

@ 
@<|KOrderStoch| unfolded constructor code@>=
KOrderStoch::KOrderStoch(const PartitionY& yp, int nu,
						 const TensorContainer<FSSparseTensor>& fcont,
						 const UGSContainer& hh, Journal& jr)
	: nvs(4), ypart(yp), journal(jr),@/
	  _ug(4), _fg(4), _ugs(4), _fgs(4), _uG(4), _fG(4),@/
	  _uh(&hh), _fh(NULL),@/
	  _uZstack(&_uG, ypart.nyss(), &_ug, ypart.ny(), ypart.nys(), nu),@/
	  _fZstack(&_fG, ypart.nyss(), &_fg, ypart.ny(), ypart.nys(), nu),@/
	  _uGstack(&_ugs, ypart.nys(), nu),@/
	  _fGstack(&_fgs, ypart.nys(), nu),@/
	  f(fcont),@/
	  matA(*(fcont.get(Symmetry(1))), _uZstack.getStackSizes(), *(hh.get(Symmetry(1,0,0,0))),
		   ypart)
{
	nvs[0] = ypart.nys();
	nvs[1] = nu;
	nvs[2] = nu;
	nvs[3] = 1;
}


@ 
@<|KOrderStoch| convenience method specializations@>=
	template<> ctraits<KOrder::unfold>::Tg& KOrderStoch::g<KOrder::unfold>()
		{@+ return _ug;@+}
	template<>@; const ctraits<KOrder::unfold>::Tg& KOrderStoch::g<KOrder::unfold>()@+const@;
		{@+ return _ug;@+}
	template<> ctraits<KOrder::fold>::Tg& KOrderStoch::g<KOrder::fold>()
		{@+ return _fg;@+}
	template<> const ctraits<KOrder::fold>::Tg& KOrderStoch::g<KOrder::fold>()@+const@;
		{@+ return _fg;@+}
	template<> ctraits<KOrder::unfold>::Tgs& KOrderStoch::gs<KOrder::unfold>()
		{@+ return _ugs;@+}
	template<> const ctraits<KOrder::unfold>::Tgs& KOrderStoch::gs<KOrder::unfold>()@+const@;
		{@+ return _ugs;@+}
	template<> ctraits<KOrder::fold>::Tgs& KOrderStoch::gs<KOrder::fold>()
		{@+ return _fgs;@+}
	template<> const ctraits<KOrder::fold>::Tgs& KOrderStoch::gs<KOrder::fold>()@+const@;
		{@+ return _fgs;@+}
	template<> const ctraits<KOrder::unfold>::Tgss& KOrderStoch::h<KOrder::unfold>()@+const@;
		{@+ return *_uh;@+}
	template<> const ctraits<KOrder::fold>::Tgss& KOrderStoch::h<KOrder::fold>()@+const@;
		{@+ return *_fh;@+}
	template<> ctraits<KOrder::unfold>::TG& KOrderStoch::G<KOrder::unfold>()
		{@+ return _uG;@+}
	template<> const ctraits<KOrder::unfold>::TG& KOrderStoch::G<KOrder::unfold>()@+const@;
		{@+ return _uG;@+}
	template<> ctraits<KOrder::fold>::TG& KOrderStoch::G<KOrder::fold>()
		{@+ return _fG;@+}
	template<> const ctraits<KOrder::fold>::TG& KOrderStoch::G<KOrder::fold>()@+const@;
		{@+ return _fG;@+}
	template<> ctraits<KOrder::unfold>::TZXstack& KOrderStoch::Zstack<KOrder::unfold>()
		{@+ return _uZstack;@+}
	template<> const ctraits<KOrder::unfold>::TZXstack& KOrderStoch::Zstack<KOrder::unfold>()@+const@;
		{@+ return _uZstack;@+}
	template<> ctraits<KOrder::fold>::TZXstack& KOrderStoch::Zstack<KOrder::fold>()
		{@+ return _fZstack;@+}
	template<> const ctraits<KOrder::fold>::TZXstack& KOrderStoch::Zstack<KOrder::fold>()@+const@;
		{@+ return _fZstack;@+}
	template<> ctraits<KOrder::unfold>::TGXstack& KOrderStoch::Gstack<KOrder::unfold>()
		{@+ return _uGstack;@+}
	template<> const ctraits<KOrder::unfold>::TGXstack& KOrderStoch::Gstack<KOrder::unfold>()@+const@;
		{@+ return _uGstack;@+}
	template<> ctraits<KOrder::fold>::TGXstack& KOrderStoch::Gstack<KOrder::fold>()
		{@+ return _fGstack;@+}
	template<> const ctraits<KOrder::fold>::TGXstack& KOrderStoch::Gstack<KOrder::fold>()@+const@;
		{@+ return _fGstack;@+}


@ End of {\tt korder\_stoch.cpp} file.