From 6cecc181dcc2e660c479d2bf6b2d9f2db69f04bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Fri, 16 Dec 2011 15:14:59 +0100
Subject: [PATCH] Added unitary test.

---
 matlab/gauss_hermite_weights_and_nodes.m | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/matlab/gauss_hermite_weights_and_nodes.m b/matlab/gauss_hermite_weights_and_nodes.m
index d035f520c2..6ae5d5b223 100644
--- a/matlab/gauss_hermite_weights_and_nodes.m
+++ b/matlab/gauss_hermite_weights_and_nodes.m
@@ -56,4 +56,19 @@ JacobiMatrix = diag(b,1)+diag(b,-1);
 JacobiEigenVector = JacobiEigenVectors(1,:);
 JacobiEigenVector = transpose(JacobiEigenVector(idx));
 weights = JacobiEigenVector.^2;
-nodes = sqrt(2)*nodes;
\ No newline at end of file
+nodes = sqrt(2)*nodes;
+
+%@test:1
+%$ n = 5;
+%$ [nodes,weights] = gauss_hermite_weights_and_nodes(n);
+%$
+%$ sum_of_weights = sum(weights);
+%$
+%$ % Expected nodes (taken from Judd (1998, table 7.4).
+%$ enodes = [-2.020182870; -0.9585724646; 0; 0.9585724646;   2.020182870]; 
+%$
+%$ % Check the results.
+%$ t(1) = dyn_assert(1.0,sum_of_weights,1e-12);
+%$ t(2) = dyn_assert(enodes,nodes/sqrt(2),1e-8);
+%$ T = all(t);
+%@eof:1
\ No newline at end of file
-- 
GitLab