Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
061bfc34
Commit
061bfc34
authored
8 years ago
by
Johannes Pfeifer
Committed by
MichelJuillard
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add correctness check for trigonometric functions to use_dll test
parent
58b23bdf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/ramst_normcdf_and_friends.mod
+72
-2
72 additions, 2 deletions
tests/ramst_normcdf_and_friends.mod
with
72 additions
and
2 deletions
tests/ramst_normcdf_and_friends.mod
+
72
−
2
View file @
061bfc34
// Tests the normcdf(), normpdf() and erf() functions, in the static M-file, and in a dynamic C-file
// Tests the normcdf(), normpdf() and erf() functions, in the static M-file, and in a dynamic C-file
var c k t u v;
var c k t u v
sin_x cos_x tan_x asin_y acos_y atan_y
;
varexo x;
varexo x
y
;
parameters alph gam delt bet aa;
parameters alph gam delt bet aa;
alph=0.5;
alph=0.5;
...
@@ -16,10 +16,17 @@ c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
...
@@ -16,10 +16,17 @@ c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
t = normcdf(x, 2, 3);
t = normcdf(x, 2, 3);
u = normpdf(x, 1, 0.5);
u = normpdf(x, 1, 0.5);
v = erf(x);
v = erf(x);
sin_x = sin(x);
cos_x = cos(x);
tan_x = tan(x);
asin_y = asin(y);
acos_y = acos(y);
atan_y = atan(y);
end;
end;
initval;
initval;
x = 1;
x = 1;
y = 0;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
c = aa*k^alph-delt*k;
t = 0;
t = 0;
...
@@ -35,6 +42,9 @@ shocks;
...
@@ -35,6 +42,9 @@ shocks;
var x;
var x;
periods 1;
periods 1;
values 1.2;
values 1.2;
var y;
periods 1,2;
values 0.5, 1;
end;
end;
simul(periods=20);
simul(periods=20);
...
@@ -63,3 +73,63 @@ if (abs(oo_.endo_simul(3, 2) - normcdf(1.2, 2, 3)) > 1e-10)
...
@@ -63,3 +73,63 @@ if (abs(oo_.endo_simul(3, 2) - normcdf(1.2, 2, 3)) > 1e-10)
error('Test failed in dynamic M-file for normcdf')
error('Test failed in dynamic M-file for normcdf')
end
end
sin_x_pos=strmatch('sin_x',M_.endo_names,'exact');
if(abs(oo_.steady_state(sin_x_pos) - sin(1)) > 1e-10)
error('Test failed in static M-file for sin')
end
if (abs(oo_.endo_simul(sin_x_pos, 2) - sin(1.2)) > 1e-10)
error('Test failed in dynamic M-file for sin')
end
cos_x_pos=strmatch('cos_x',M_.endo_names,'exact');
if(abs(oo_.steady_state(cos_x_pos) - cos(1)) > 1e-10)
error('Test failed in static M-file for cos')
end
if (abs(oo_.endo_simul(cos_x_pos, 2) - cos(1.2)) > 1e-10)
error('Test failed in dynamic M-file for cos')
end
tan_x_pos=strmatch('tan_x',M_.endo_names,'exact');
if(abs(oo_.steady_state(tan_x_pos) - tan(1)) > 1e-10)
error('Test failed in static M-file for tan')
end
if (abs(oo_.endo_simul(tan_x_pos, 2) - tan(1.2)) > 1e-10)
error('Test failed in dynamic M-file for tan')
end
asin_y_pos=strmatch('asin_y',M_.endo_names,'exact');
if(abs(oo_.steady_state(asin_y_pos) - asin(0)) > 1e-10)
error('Test failed in static M-file for asin')
end
if (abs(oo_.endo_simul(asin_y_pos,1) - asin(0)) > 1e-10) || ...
(abs(oo_.endo_simul(asin_y_pos, 2) - asin(0.5)) > 1e-10) || ...
(abs(oo_.endo_simul(asin_y_pos, 3) - asin(1)) > 1e-10)
error('Test failed in dynamic M-file for asin')
end
acos_y_pos=strmatch('acos_y',M_.endo_names,'exact');
if(abs(oo_.steady_state(acos_y_pos) - acos(0)) > 1e-10)
error('Test failed in static M-file for acos')
end
if (abs(oo_.endo_simul(acos_y_pos,1) - acos(0)) > 1e-10) || ...
(abs(oo_.endo_simul(acos_y_pos, 2) - acos(0.5)) > 1e-10) || ...
(abs(oo_.endo_simul(acos_y_pos, 3) - acos(1)) > 1e-10)
error('Test failed in dynamic M-file for acos')
end
atan_y_pos=strmatch('atan_y',M_.endo_names,'exact');
if(abs(oo_.steady_state(atan_y_pos) - atan(0)) > 1e-10)
error('Test failed in static M-file for atan')
end
if (abs(oo_.endo_simul(atan_y_pos,1) - atan(0)) > 1e-10) || ...
(abs(oo_.endo_simul(atan_y_pos, 2) - atan(0.5)) > 1e-10) || ...
(abs(oo_.endo_simul(atan_y_pos, 3) - atan(1)) > 1e-10)
error('Test failed in dynamic M-file for atan')
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment