[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN Makefile.in numdiff.awk regressions/gauss_...
From: |
Edward Rosten |
Subject: |
[Toon-members] TooN Makefile.in numdiff.awk regressions/gauss_... |
Date: |
Mon, 28 Sep 2009 10:48:14 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Changes by: Edward Rosten <edrosten> 09/09/28 10:48:14
Modified files:
. : Makefile.in numdiff.awk
Added files:
regressions : gauss_jordan.cc gauss_jordan.txt lu.cc lu.txt
Removed files:
regressions : invert.cc invert.txt
Log message:
Some more test code.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/Makefile.in?cvsroot=toon&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/TooN/numdiff.awk?cvsroot=toon&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/TooN/regressions/gauss_jordan.cc?cvsroot=toon&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/TooN/regressions/gauss_jordan.txt?cvsroot=toon&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/TooN/regressions/lu.cc?cvsroot=toon&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/TooN/regressions/lu.txt?cvsroot=toon&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/TooN/regressions/invert.cc?cvsroot=toon&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/regressions/invert.txt?cvsroot=toon&r1=1.1&r2=0
Patches:
Index: Makefile.in
===================================================================
RCS file: /cvsroot/toon/TooN/Makefile.in,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- Makefile.in 28 Sep 2009 08:31:58 -0000 1.13
+++ Makefile.in 28 Sep 2009 10:48:13 -0000 1.14
@@ -36,7 +36,7 @@
doxygen
-TESTS=invert slice vector_resize
+TESTS=lu slice vector_resize gauss_jordan
TEST_RESULT=$(TESTS:%=regressions/%.result)
@@ -45,6 +45,9 @@
testclean:
rm -f $(TEST_FILES)
+foo:
+ echo $(MAKEFLAGS)
+
test:regressions/results
@echo -------------- Test Results ---------------
@cat regressions/results
@@ -54,12 +57,18 @@
.PRECIOUS: regressions/%.out regressions/%.test
+#Build a test executable from a test program. On compile error,
+#create an execuaable which decalres the error.
regressions/%.test: regressions/%.cc
- $(CXX) -I. $< -o $@ -llapack -DTOON_INITIALIZE_SNAN
+ $(CXX) -I. $< -o $@ -llapack -DTOON_INITIALIZE_SNAN -I .. -I . ||\
+ { \
+ echo "echo 'Compile error!'" > $@ ; \
+ chmod +x $@; \
+ }
regressions/%.out: regressions/%.test
$< > $@ || ( echo Crash!!! > $@ )
-regressions/%.result: regressions/%.out
+regressions/%.result: regressions/%.out regressions/%.txt
awk -vname=$* -f numdiff.awk -vf1=$< -vf2=regressions/$*.txt > $@
Index: numdiff.awk
===================================================================
RCS file: /cvsroot/toon/TooN/numdiff.awk,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- numdiff.awk 28 Sep 2009 08:31:58 -0000 1.2
+++ numdiff.awk 28 Sep 2009 10:48:13 -0000 1.3
@@ -11,9 +11,9 @@
function ignore_and_process(line, a)
{
- if(line ~ /^[[:space:]]*$/)
+ if(line ~ /^[[:space:]]*$/) #Ignore blank linkes
return 1
- else if (line ~ /^[[:space:]]*#>/)
+ else if (line ~ /^[[:space:]]*#>/) #Process directives, then ignore the
line
{
split(line, a)
if(a[2] == "t")
@@ -21,9 +21,9 @@
return 1
}
- else if (line ~ /^[[:space:]]*#/)
+ else if (line ~ /^[[:space:]]*#/) #Ignore comments
return 1
- else
+ else #The line should not be ignored
return 0
}
@@ -65,6 +65,9 @@
if(s1 == "Crash!!!" || s2 == "Crash!!!")
fail("Crash!!!")
+ if(s1 == "Compile error!" || s2 == "Compile error!")
+ fail("Compile error!")
+
#If there are valid lines left, then split them
#into fields
n1 = split(s1, a1)
Index: regressions/gauss_jordan.cc
===================================================================
RCS file: regressions/gauss_jordan.cc
diff -N regressions/gauss_jordan.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ regressions/gauss_jordan.cc 28 Sep 2009 10:48:13 -0000 1.1
@@ -0,0 +1,34 @@
+#include "regressions/regression.h"
+#include <TooN/gauss_jordan.h>
+
+
+template<int C, int D>
+void test(Matrix<C, D> m)
+{
+ gauss_jordan(m);
+
+ cout << setprecision(10) << m << endl;
+}
+
+int main()
+{
+ Matrix<10, 20> m;
+
+ m.slice<0,10,10,10>() = Identity;
+ m.slice<0,0,10,10>()= Data(
+ 0.34797399, 0.99949284, 0.79089508, 0.77106323,
0.42008832, 0.34115353, 0.82386306, 0.30355494, 0.43675765, 0.14701409,
+ 0.79196638, 0.89361322, 0.01607914, 0.80605940,
0.65770431, 0.78196315, 0.72096826, 0.72992854, 0.59231807, 0.29441620,
+ 0.87756469, 0.13676905, 0.24987969, 0.70330337,
0.14679752, 0.24212448, 0.54797729, 0.39780385, 0.28859592, 0.56037868,
+ 0.28673516, 0.50161131, 0.68057626, 0.49395349,
0.40353230, 0.87453874, 0.40320916, 0.81494509, 0.08367898, 0.30109605,
+ 0.63965121, 0.81584239, 0.41207698, 0.62649440,
0.17279511, 0.20152095, 0.68882719, 0.25012805, 0.59680722, 0.08332985,
+ 0.28651408, 0.79504551, 0.33326702, 0.26440896,
0.95748781, 0.22512739, 0.01047784, 0.85470217, 0.85677470, 0.65734012,
+ 0.59521552, 0.78840112, 0.96281698, 0.31079097,
0.31028381, 0.10117889, 0.87224212, 0.29233044, 0.63348397, 0.45734703,
+ 0.76090196, 0.19765961, 0.34467370, 0.13664008,
0.03025330, 0.04633244, 0.85239184, 0.51009616, 0.29205931, 0.01302757,
+ 0.74295611, 0.33527418, 0.62969038, 0.50725507,
0.64402412, 0.89390381, 0.59720718, 0.74400470, 0.98612919, 0.53410648,
+ 0.93191033, 0.22050625, 0.78088493, 0.06762009,
0.56923140, 0.24980766, 0.74376115, 0.14729345, 0.02183219, 0.42504135);
+
+ test(m);
+
+ Matrix<> md = m;
+ test(md);
+}
Index: regressions/gauss_jordan.txt
===================================================================
RCS file: regressions/gauss_jordan.txt
diff -N regressions/gauss_jordan.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ regressions/gauss_jordan.txt 28 Sep 2009 10:48:13 -0000 1.1
@@ -0,0 +1,28 @@
+# Range of the matrix is 0--1, and the matrix is 10x10. Errors should be small
+#> t 1e-18
+
+1 0 0 0 0 0 0 0 0 0 -1.551543207 -0.6170670429 -0.01958382347 0.5329244158
2.811560915 0.2566023602 -0.960779849 -0.2223209796 -0.2455688735 1.013525462
+0 1 0 0 0 0 0 0 0 0 -1.426671321 0.710147444 -0.5562041531 0.7238990064
1.303602262 0.01983165255 1.157534206 -0.7281900184 -1.027510747 0.003788887042
+0 0 1 0 0 0 0 0 0 0 0.3009307806 -1.566556566 -0.07073552232 0.6160470071
1.224820531 0.2588621457 -0.7573429524 -0.02303798156 0.2934242048 0.4443150044
+0 0 0 1 0 0 0 0 0 0 1.764758704 -0.8150240542 1.098587487 -0.3268667315
0.02153549423 0.2168926172 -1.594789032 0.03681640417 0.2301763236 -0.1767072075
+0 0 0 0 1 0 0 0 0 0 1.897529332 -0.04294243314 -0.249874082 -1.030103757
-1.160903179 0.6282496553 -1.602078304 0.3579156554 0.4060880781 0.8911522925
+0 0 0 0 0 1 0 0 0 0 -1.105668985 0.8301231929 -0.5990176892 0.6342165265
0.2529281369 -0.861275016 0.7874166282 -0.8958773159 0.4667702043 0.02395407106
+0 0 0 0 0 0 1 0 0 0 1.306478199 1.436191451 -0.002947540335 -1.025853643
-3.239998669 -0.747333896 1.377343306 0.8332918069 0.1386250684 -0.6068951722
+0 0 0 0 0 0 0 1 0 0 0.03043670964 -0.4138316668 0.1953495288 0.692959407
-0.2368993519 0.6543598778 -0.4719442413 1.236594252 -0.3576214366 -0.518558341
+0 0 0 0 0 0 0 0 1 0 -0.02115899807 -0.2928083293 -0.2559350939 -0.6613822999
0.3744957069 0.03602627845 0.08987841652 0.06119708305 1.00709108 -0.477145536
+0 0 0 0 0 0 0 0 0 1 -0.8787238558 1.207196902 0.9239763198 -0.02805539928
-1.955888008 -0.3390472793 2.582672951 -0.9409297108 -0.4927776515 -0.600961771
+
+
+
+1 0 0 0 0 0 0 0 0 0 -1.551543207 -0.6170670429 -0.01958382347 0.5329244158
2.811560915 0.2566023602 -0.960779849 -0.2223209796 -0.2455688735 1.013525462
+0 1 0 0 0 0 0 0 0 0 -1.426671321 0.710147444 -0.5562041531 0.7238990064
1.303602262 0.01983165255 1.157534206 -0.7281900184 -1.027510747 0.003788887042
+0 0 1 0 0 0 0 0 0 0 0.3009307806 -1.566556566 -0.07073552232 0.6160470071
1.224820531 0.2588621457 -0.7573429524 -0.02303798156 0.2934242048 0.4443150044
+0 0 0 1 0 0 0 0 0 0 1.764758704 -0.8150240542 1.098587487 -0.3268667315
0.02153549423 0.2168926172 -1.594789032 0.03681640417 0.2301763236 -0.1767072075
+0 0 0 0 1 0 0 0 0 0 1.897529332 -0.04294243314 -0.249874082 -1.030103757
-1.160903179 0.6282496553 -1.602078304 0.3579156554 0.4060880781 0.8911522925
+0 0 0 0 0 1 0 0 0 0 -1.105668985 0.8301231929 -0.5990176892 0.6342165265
0.2529281369 -0.861275016 0.7874166282 -0.8958773159 0.4667702043 0.02395407106
+0 0 0 0 0 0 1 0 0 0 1.306478199 1.436191451 -0.002947540335 -1.025853643
-3.239998669 -0.747333896 1.377343306 0.8332918069 0.1386250684 -0.6068951722
+0 0 0 0 0 0 0 1 0 0 0.03043670964 -0.4138316668 0.1953495288 0.692959407
-0.2368993519 0.6543598778 -0.4719442413 1.236594252 -0.3576214366 -0.518558341
+0 0 0 0 0 0 0 0 1 0 -0.02115899807 -0.2928083293 -0.2559350939 -0.6613822999
0.3744957069 0.03602627845 0.08987841652 0.06119708305 1.00709108 -0.477145536
+0 0 0 0 0 0 0 0 0 1 -0.8787238558 1.207196902 0.9239763198 -0.02805539928
-1.955888008 -0.3390472793 2.582672951 -0.9409297108 -0.4927776515 -0.600961771
+
+
Index: regressions/lu.cc
===================================================================
RCS file: regressions/lu.cc
diff -N regressions/lu.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ regressions/lu.cc 28 Sep 2009 10:48:14 -0000 1.1
@@ -0,0 +1,29 @@
+#include "regressions/regression.h"
+
+
+template<int C>
+void test(const Matrix<10, 10>& m)
+{
+ LU<C> lu(m);
+ cout << setprecision(10) << lu.get_inverse() << endl
+ << lu.get_inverse() * m << endl;
+
+}
+
+int main()
+{
+ Matrix<10> m = Data(
+ 0.34797399, 0.99949284, 0.79089508, 0.77106323,
0.42008832, 0.34115353, 0.82386306, 0.30355494, 0.43675765, 0.14701409,
+ 0.79196638, 0.89361322, 0.01607914, 0.80605940,
0.65770431, 0.78196315, 0.72096826, 0.72992854, 0.59231807, 0.29441620,
+ 0.87756469, 0.13676905, 0.24987969, 0.70330337,
0.14679752, 0.24212448, 0.54797729, 0.39780385, 0.28859592, 0.56037868,
+ 0.28673516, 0.50161131, 0.68057626, 0.49395349,
0.40353230, 0.87453874, 0.40320916, 0.81494509, 0.08367898, 0.30109605,
+ 0.63965121, 0.81584239, 0.41207698, 0.62649440,
0.17279511, 0.20152095, 0.68882719, 0.25012805, 0.59680722, 0.08332985,
+ 0.28651408, 0.79504551, 0.33326702, 0.26440896,
0.95748781, 0.22512739, 0.01047784, 0.85470217, 0.85677470, 0.65734012,
+ 0.59521552, 0.78840112, 0.96281698, 0.31079097,
0.31028381, 0.10117889, 0.87224212, 0.29233044, 0.63348397, 0.45734703,
+ 0.76090196, 0.19765961, 0.34467370, 0.13664008,
0.03025330, 0.04633244, 0.85239184, 0.51009616, 0.29205931, 0.01302757,
+ 0.74295611, 0.33527418, 0.62969038, 0.50725507,
0.64402412, 0.89390381, 0.59720718, 0.74400470, 0.98612919, 0.53410648,
+ 0.93191033, 0.22050625, 0.78088493, 0.06762009,
0.56923140, 0.24980766, 0.74376115, 0.14729345, 0.02183219, 0.42504135);
+
+ test<Dynamic>(m);
+ test<10>(m);
+}
Index: regressions/lu.txt
===================================================================
RCS file: regressions/lu.txt
diff -N regressions/lu.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ regressions/lu.txt 28 Sep 2009 10:48:14 -0000 1.1
@@ -0,0 +1,50 @@
+# Range of the matrix is 0--1, and the matrix is 10x10. Errors should be small
+#> t 1e-18
+
+-1.551543207 -0.6170670429 -0.01958382347 0.5329244158 2.811560915
0.2566023602 -0.960779849 -0.2223209796 -0.2455688735 1.013525462
+-1.426671321 0.710147444 -0.5562041531 0.7238990064 1.303602262 0.01983165255
1.157534206 -0.7281900184 -1.027510747 0.003788887042
+0.3009307806 -1.566556566 -0.07073552232 0.6160470071 1.224820531 0.2588621457
-0.7573429524 -0.02303798156 0.2934242048 0.4443150044
+1.764758704 -0.8150240542 1.098587487 -0.3268667315 0.02153549423 0.2168926172
-1.594789032 0.03681640417 0.2301763236 -0.1767072075
+1.897529332 -0.04294243314 -0.249874082 -1.030103757 -1.160903179 0.6282496553
-1.602078304 0.3579156554 0.4060880781 0.8911522925
+-1.105668985 0.8301231929 -0.5990176892 0.6342165265 0.2529281369 -0.861275016
0.7874166282 -0.8958773159 0.4667702043 0.02395407106
+1.306478199 1.436191451 -0.002947540335 -1.025853643 -3.239998669 -0.747333896
1.377343306 0.8332918069 0.1386250684 -0.6068951722
+0.03043670964 -0.4138316668 0.1953495288 0.692959407 -0.2368993519
0.6543598778 -0.4719442413 1.236594252 -0.3576214366 -0.518558341
+-0.02115899807 -0.2928083293 -0.2559350939 -0.6613822999 0.3744957069
0.03602627845 0.08987841652 0.06119708305 1.00709108 -0.477145536
+-0.8787238558 1.207196902 0.9239763198 -0.02805539928 -1.955888008
-0.3390472793 2.582672951 -0.9409297108 -0.4927776515 -0.600961771
+
+#More errors in matrix-matrix multiply
+#> t 2e-15
+1 0 0 0 0 0 0 0 0 0
+0 1 0 0 0 0 0 0 0 0
+0 0 1 0 0 0 0 0 0 0
+0 0 0 1 0 0 0 0 0 0
+0 0 0 0 1 0 0 0 0 0
+0 0 0 0 0 1 0 0 0 0
+0 0 0 0 0 0 1 0 0 0
+0 0 0 0 0 0 0 1 0 0
+0 0 0 0 0 0 0 0 1 0
+0 0 0 0 0 0 0 0 0 1
+
+#> t 1e-18
+-1.551543207 -0.6170670429 -0.01958382347 0.5329244158 2.811560915
0.2566023602 -0.960779849 -0.2223209796 -0.2455688735 1.013525462
+-1.426671321 0.710147444 -0.5562041531 0.7238990064 1.303602262 0.01983165255
1.157534206 -0.7281900184 -1.027510747 0.003788887042
+0.3009307806 -1.566556566 -0.07073552232 0.6160470071 1.224820531 0.2588621457
-0.7573429524 -0.02303798156 0.2934242048 0.4443150044
+1.764758704 -0.8150240542 1.098587487 -0.3268667315 0.02153549423 0.2168926172
-1.594789032 0.03681640417 0.2301763236 -0.1767072075
+1.897529332 -0.04294243314 -0.249874082 -1.030103757 -1.160903179 0.6282496553
-1.602078304 0.3579156554 0.4060880781 0.8911522925
+-1.105668985 0.8301231929 -0.5990176892 0.6342165265 0.2529281369 -0.861275016
0.7874166282 -0.8958773159 0.4667702043 0.02395407106
+1.306478199 1.436191451 -0.002947540335 -1.025853643 -3.239998669 -0.747333896
1.377343306 0.8332918069 0.1386250684 -0.6068951722
+0.03043670964 -0.4138316668 0.1953495288 0.692959407 -0.2368993519
0.6543598778 -0.4719442413 1.236594252 -0.3576214366 -0.518558341
+-0.02115899807 -0.2928083293 -0.2559350939 -0.6613822999 0.3744957069
0.03602627845 0.08987841652 0.06119708305 1.00709108 -0.477145536
+-0.8787238558 1.207196902 0.9239763198 -0.02805539928 -1.955888008
-0.3390472793 2.582672951 -0.9409297108 -0.4927776515 -0.600961771
+
+#> t 2e-15
+1 0 0 0 0 0 0 0 0 0
+0 1 0 0 0 0 0 0 0 0
+0 0 1 0 0 0 0 0 0 0
+0 0 0 1 0 0 0 0 0 0
+0 0 0 0 1 0 0 0 0 0
+0 0 0 0 0 1 0 0 0 0
+0 0 0 0 0 0 1 0 0 0
+0 0 0 0 0 0 0 1 0 0
+0 0 0 0 0 0 0 0 1 0
+0 0 0 0 0 0 0 0 0 1
Index: regressions/invert.cc
===================================================================
RCS file: regressions/invert.cc
diff -N regressions/invert.cc
--- regressions/invert.cc 23 Sep 2009 13:43:55 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,7 +0,0 @@
-#include "regressions/regression.h"
-
-int main()
-{
- cout << setprecision(10)
- << LU<2>(Matrix<2>(Data(1, 2, 3, 4))).get_inverse();
-}
Index: regressions/invert.txt
===================================================================
RCS file: regressions/invert.txt
diff -N regressions/invert.txt
--- regressions/invert.txt 23 Sep 2009 13:43:55 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
- -2.00000 1.00000
- 1.50000 -0.50000
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Toon-members] TooN Makefile.in numdiff.awk regressions/gauss_...,
Edward Rosten <=