Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
DynareJulia
LinearRationalExpectations.jl
Commits
6836fcb5
Commit
6836fcb5
authored
Jul 28, 2020
by
MichelJuillard
Browse files
update dgees
parent
469c396a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/extended_lyapunov.jl
View file @
6836fcb5
...
...
@@ -10,7 +10,7 @@ struct LyapdWs
BB
::
Matrix
{
Float64
}
temp1
::
Matrix
{
Float64
}
XX
::
Vector
{
Float64
}
u
nsta
ble
_variables
::
Vector
{
Bool
}
no
nsta
tionary
_variables
::
Vector
{
Bool
}
dgees_ws
::
DgeesWs
linsolve_ws1
::
LinSolveWs
linsolve_ws2
::
LinSolveWs
...
...
@@ -21,11 +21,11 @@ struct LyapdWs
BB
=
similar
(
AA
)
temp1
=
Matrix
{
Float64
}(
undef
,
n
,
n
)
XX
=
Vector
{
Float64
}(
undef
,
2
*
n
)
u
nsta
ble
_variables
=
Vector
{
Bool
}(
undef
,
n
)
no
nsta
tionary
_variables
=
Vector
{
Bool
}(
undef
,
n
)
dgees_ws
=
DgeesWs
(
n
)
linsolve_ws1
=
LinSolveWs
(
n
)
linsolve_ws2
=
LinSolveWs
(
2
*
n
)
new
(
AA
,
AAtemp
,
AA2
,
BB
,
temp1
,
XX
,
u
nsta
ble
_variables
,
new
(
AA
,
AAtemp
,
AA2
,
BB
,
temp1
,
XX
,
no
nsta
tionary
_variables
,
dgees_ws
,
linsolve_ws1
,
linsolve_ws2
)
end
end
...
...
@@ -96,18 +96,17 @@ function extended_lyapd!(Σ, A, B, ws)
n
=
size
(
A
,
1
)
copy!
(
ws
.
AA
,
A
)
dgees!
(
ws
.
dgees_ws
,
ws
.
AA
,
>
,
1
-
1e-6
)
mul!
(
ws
.
temp1
,
ws
.
dgees_ws
.
vs
'
,
B
)
mul!
(
ws
.
temp1
,
transpose
(
ws
.
dgees_ws
.
vs
),
B
)
mul!
(
ws
.
BB
,
ws
.
temp1
,
ws
.
dgees_ws
.
vs
)
fill!
(
ws
.
u
nsta
ble
_variables
,
false
)
fill!
(
ws
.
no
nsta
tionary
_variables
,
false
)
rowu
=
1
while
rowu
<=
n
if
rowu
==
n
||
ws
.
AA
[
rowu
+
1
,
rowu
]
==
0
if
abs
(
ws
.
AA
[
rowu
,
rowu
])
>
1
-
1e-6
for
i
=
1
:
n
if
abs
(
ws
.
dgees_ws
.
vs
[
i
,
rowu
])
>
1e-10
ws
.
u
nsta
ble
_variables
[
i
]
=
true
ws
.
no
nsta
tionary
_variables
[
i
]
=
true
end
end
else
...
...
@@ -118,12 +117,12 @@ function extended_lyapd!(Σ, A, B, ws)
if
ws
.
AA
[
rowu
,
rowu
]
*
ws
.
AA
[
rowu
,
rowu
]
+
ws
.
AA
[
rowu
+
1
,
rowu
]
*
ws
.
AA
[
rowu
,
rowu
+
1
]
>
1
-
2e-6
for
i
=
1
:
n
if
abs
(
ws
.
dgees_ws
.
vs
[
i
,
rowu
])
>
1e-10
ws
.
u
nsta
ble
_variables
[
i
]
=
true
ws
.
no
nsta
tionary
_variables
[
i
]
=
true
end
end
for
i
=
1
:
n
if
abs
(
ws
.
dgees_ws
.
vs
[
i
,
rowu
+
1
])
>
1e-10
ws
.
u
nsta
ble
_variables
[
i
]
=
true
ws
.
no
nsta
tionary
_variables
[
i
]
=
true
end
end
else
...
...
@@ -175,14 +174,14 @@ function extended_lyapd!(Σ, A, B, ws)
if
rowu
>
1
for
i
=
1
:
n
if
ws
.
u
nsta
ble
_variables
[
i
]
if
ws
.
no
nsta
tionary
_variables
[
i
]
for
j
=
i
:
n
Σ
[
j
,
i
]
=
NaN
Σ
[
i
,
j
]
=
NaN
end
else
for
j
=
i
:
n
if
ws
.
u
nsta
ble
_variables
[
j
]
if
ws
.
no
nsta
tionary
_variables
[
j
]
Σ
[
j
,
i
]
=
NaN
Σ
[
i
,
j
]
=
NaN
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment