tfix malloc calls - numeric - C++ library with numerical algorithms
(HTM) git clone git://src.adamsgaard.dk/numeric
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit ac0086c43f37b638e76af2316abd7f23636c1cef
(DIR) parent 47e5c22b57074c28fda527cda6bb44645e60e50d
(HTM) Author: Anders Damsgaard <andersd@riseup.net>
Date: Wed, 22 Nov 2017 10:11:07 -0500
fix malloc calls
Diffstat:
M exam/html/Makefile.html | 364 +++++++++++++++++--------------
M exam/html/README.html | 406 -------------------------------
M exam/html/check.cpp.html | 78 ++++++++++++++++++++++---------
M exam/html/check.h.html | 64 +++++++++++++++++++++++--------
M exam/html/functions.h.html | 104 ++++++++++++++++++++-----------
M exam/html/mainA.cpp.html | 174 ++++++++++++++++++-------------
M exam/html/mainB.cpp.html | 156 +++++++++++++++++++------------
M exam/html/mainC.cpp.html | 156 +++++++++++++++++++------------
M exam/html/mainD.cpp.html | 192 ++++++++++++++++++-------------
M exam/html/ode.cpp.html | 382 +++++++++++++++++--------------
M exam/html/ode.h.html | 228 ++++++++++++++++++-------------
M exam/html/plotA.gp.html | 64 +++++++++++++++++++++++--------
M exam/html/plotB.gp.html | 64 +++++++++++++++++++++++--------
M exam/html/plotC.gp.html | 66 +++++++++++++++++++++++--------
M exam/html/plotD.gp.html | 66 +++++++++++++++++++++++--------
M exam/html/typedefs.h.html | 82 +++++++++++++++++++++----------
M exam/html/vector_arithmetic.h.html | 232 ++++++++++++++++++-------------
M matrixmul/Makefile | 17 ++++++++++++++---
M matrixmul/c-gsl-cblas.c | 3 +--
M matrixmul/c-linarr.c | 6 +++---
M matrixmul/cpp-eigen.cpp | 2 +-
M matrixmul/julia.jl | 4 ++--
22 files changed, 1513 insertions(+), 1397 deletions(-)
---
(DIR) diff --git a/exam/html/Makefile.html b/exam/html/Makefile.html
t@@ -3,180 +3,212 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/Makefile.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="make">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Special { color: #ff40ff; }
-.Constant { color: #ffff00; }
-.Statement { color: #ffff00; }
-.Identifier { color: #00ffff; }
-.Comment { color: #00ffff; }
+* { font-size: 1em; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Comment { color: #008080; }
+.Constant { color: #af5f00; }
+.Special { color: #c000c0; }
+.Identifier { color: #008080; font-weight: bold; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="Comment"># Define compiler</span>
-<span class="lnr"> 2 </span><span class="Comment">#CXX=g++</span>
-<span class="lnr"> 3 </span>
-<span class="lnr"> 4 </span><span class="Comment"># Define compiler flags (show all warnings)</span>
-<span class="lnr"> 5 </span><span class="Identifier">CXXFLAGS</span>=-Wall
-<span class="lnr"> 6 </span><span class="Comment">#CXXFLAGS=-std=c++0x</span>
-<span class="lnr"> 7 </span>
-<span class="lnr"> 8 </span><span class="Comment"># Define linker flags</span>
-<span class="lnr"> 9 </span><span class="Comment">#LDFLAGS=-fopenmp</span>
-<span class="lnr"> 10 </span>
-<span class="lnr"> 11 </span><span class="Comment"># Compile optimized code</span>
-<span class="lnr"> 12 </span><span class="Identifier">CXXFLAGS</span>+=-O2
-<span class="lnr"> 13 </span>
-<span class="lnr"> 14 </span><span class="Comment"># Compile debuggable code</span>
-<span class="lnr"> 15 </span><span class="Comment">#CXXFLAGS+=-g</span>
-<span class="lnr"> 16 </span>
-<span class="lnr"> 17 </span><span class="Comment"># Compile profilable code</span>
-<span class="lnr"> 18 </span><span class="Comment">#CXXFLAGS+=-pg</span>
-<span class="lnr"> 19 </span><span class="Comment">#LDFLAGS+=-pg</span>
-<span class="lnr"> 20 </span>
-<span class="lnr"> 21 </span><span class="Comment"># Define linker</span>
-<span class="lnr"> 22 </span><span class="Identifier">LD</span>=g++
-<span class="lnr"> 23 </span>
-<span class="lnr"> 24 </span><span class="Comment"># All source code files</span>
-<span class="lnr"> 25 </span><span class="Identifier">SRC</span>=<span class="Identifier">$(</span><span class="Statement">shell</span><span class="Identifier"> ls *.cpp)</span>
-<span class="lnr"> 26 </span>
-<span class="lnr"> 27 </span>
-<span class="lnr"> 28 </span><span class="Comment"># Filenames of source code</span>
-<span class="lnr"> 29 </span><span class="Identifier">SHARED_SRC</span>=ode.cpp check.cpp
-<span class="lnr"> 30 </span><span class="Identifier">SHARED_HEADERS</span>=typedefs.h ode.h functions.h check.h
-<span class="lnr"> 31 </span><span class="Identifier">SRC_A</span>=mainA.cpp <span class="Identifier">$(SHARED_SRC)</span>
-<span class="lnr"> 32 </span><span class="Identifier">HEAD_A</span>=<span class="Identifier">$(SHARED_HEADERS)</span>
-<span class="lnr"> 33 </span><span class="Identifier">SRC_B</span>=mainB.cpp <span class="Identifier">$(SHARED_SRC)</span>
-<span class="lnr"> 34 </span><span class="Identifier">HEAD_B</span>=<span class="Identifier">$(SHARED_HEADERS)</span>
-<span class="lnr"> 35 </span><span class="Identifier">SRC_C</span>=mainC.cpp <span class="Identifier">$(SHARED_SRC)</span>
-<span class="lnr"> 36 </span><span class="Identifier">HEAD_C</span>=<span class="Identifier">$(SHARED_HEADERS)</span>
-<span class="lnr"> 37 </span><span class="Identifier">SRC_D</span>=mainD.cpp <span class="Identifier">$(SHARED_SRC)</span>
-<span class="lnr"> 38 </span><span class="Identifier">HEAD_D</span>=<span class="Identifier">$(SHARED_HEADERS)</span>
-<span class="lnr"> 39 </span>
-<span class="lnr"> 40 </span><span class="Comment"># Filenames of object files</span>
-<span class="lnr"> 41 </span><span class="Identifier">OBJ_A</span>=<span class="Identifier">$(SRC_A:.cpp=.o)</span>
-<span class="lnr"> 42 </span><span class="Identifier">OBJ_B</span>=<span class="Identifier">$(SRC_B:.cpp=.o)</span>
-<span class="lnr"> 43 </span><span class="Identifier">OBJ_C</span>=<span class="Identifier">$(SRC_C:.cpp=.o)</span>
-<span class="lnr"> 44 </span><span class="Identifier">OBJ_D</span>=<span class="Identifier">$(SRC_D:.cpp=.o)</span>
-<span class="lnr"> 45 </span>
-<span class="lnr"> 46 </span><span class="Comment"># Remove file type extension for binary filename</span>
-<span class="lnr"> 47 </span><span class="Identifier">BIN_A</span>=odeA
-<span class="lnr"> 48 </span><span class="Identifier">BIN_B</span>=odeB
-<span class="lnr"> 49 </span><span class="Identifier">BIN_C</span>=odeC
-<span class="lnr"> 50 </span><span class="Identifier">BIN_D</span>=odeD
-<span class="lnr"> 51 </span>
-<span class="lnr"> 52 </span><span class="Comment"># Define editor and options for `make edit`</span>
-<span class="lnr"> 53 </span><span class="Identifier">EDITOR</span>=vim -p
-<span class="lnr"> 54 </span>
-<span class="lnr"> 55 </span>
-<span class="lnr"> 56 </span><span class="Comment"># The default "all" depends on A and B</span>
-<span class="lnr"> 57 </span><span class="Identifier">all:</span> A B C D
-<span class="lnr"> 58 </span>
-<span class="lnr"> 59 </span><span class="Identifier">A:</span> plotA.png
-<span class="lnr"> 60 </span>
-<span class="lnr"> 61 </span><span class="Identifier">B:</span> plotB.png
-<span class="lnr"> 62 </span>
-<span class="lnr"> 63 </span><span class="Identifier">C:</span> plotC.png
-<span class="lnr"> 64 </span>
-<span class="lnr"> 65 </span><span class="Identifier">D:</span> plotD.png
-<span class="lnr"> 66 </span>
-<span class="lnr"> 67 </span><span class="Identifier">plotA.png:</span> funcA.dat plotA.gp
-<span class="lnr"> 68 </span><span class="Constant"> </span><span class="Comment"># Gnuplot: plotA.png</span>
-<span class="lnr"> 69 </span><span class="Special"> @</span><span class="Constant">gnuplot plotA.gp</span>
-<span class="lnr"> 70 </span>
-<span class="lnr"> 71 </span><span class="Identifier">plotB.png:</span> funcB.dat plotB.gp
-<span class="lnr"> 72 </span><span class="Constant"> </span><span class="Comment"># Gnuplot: plotB.png</span>
-<span class="lnr"> 73 </span><span class="Special"> @</span><span class="Constant">gnuplot plotB.gp</span>
-<span class="lnr"> 74 </span>
-<span class="lnr"> 75 </span><span class="Identifier">plotC.png:</span> funcC.dat plotC.gp
-<span class="lnr"> 76 </span><span class="Constant"> </span><span class="Comment"># Gnuplot: plotC.png</span>
-<span class="lnr"> 77 </span><span class="Special"> @</span><span class="Constant">gnuplot plotC.gp</span>
-<span class="lnr"> 78 </span>
-<span class="lnr"> 79 </span><span class="Identifier">plotD.png:</span> funcD.dat plotD.gp
-<span class="lnr"> 80 </span><span class="Constant"> </span><span class="Comment"># Gnuplot: plotD.png</span>
-<span class="lnr"> 81 </span><span class="Special"> @</span><span class="Constant">gnuplot plotD.gp</span>
-<span class="lnr"> 82 </span>
-<span class="lnr"> 83 </span><span class="Identifier">funcA.dat:</span> <span class="Identifier">$(BIN_A)</span>
-<span class="lnr"> 84 </span><span class="Special"> @</span><span class="Constant">./</span><span class="Identifier">$(BIN_A)</span>
-<span class="lnr"> 85 </span><span class="Constant"> </span>
-<span class="lnr"> 86 </span><span class="Identifier">funcB.dat:</span> <span class="Identifier">$(BIN_B)</span>
-<span class="lnr"> 87 </span><span class="Special"> @</span><span class="Constant">./</span><span class="Identifier">$(BIN_B)</span>
-<span class="lnr"> 88 </span>
-<span class="lnr"> 89 </span><span class="Identifier">funcC.dat:</span> <span class="Identifier">$(BIN_C)</span>
-<span class="lnr"> 90 </span><span class="Special"> @</span><span class="Constant">./</span><span class="Identifier">$(BIN_C)</span>
-<span class="lnr"> 91 </span><span class="Constant"> </span>
-<span class="lnr"> 92 </span><span class="Identifier">funcD.dat:</span> <span class="Identifier">$(BIN_D)</span>
-<span class="lnr"> 93 </span><span class="Special"> @</span><span class="Constant">./</span><span class="Identifier">$(BIN_D)</span>
-<span class="lnr"> 94 </span><span class="Constant"> </span>
-<span class="lnr"> 95 </span><span class="Identifier">$(BIN_A):</span> <span class="Identifier">$(OBJ_A)</span> <span class="Identifier">$(HEAD_A)</span>
-<span class="lnr"> 96 </span><span class="Special"> @</span><span class="Comment"># Link object files together</span>
-<span class="lnr"> 97 </span><span class="Constant"> </span><span class="Identifier">$(LD)</span><span class="Constant"> </span><span class="Identifier">$(LDFLAGS)</span><span class="Constant"> </span><span class="Identifier">$(OBJ_A)</span><span class="Constant"> -o </span><span class="Identifier">$@</span><span class="Constant"> </span><span class="Identifier">$(LDLIBS)</span>
-<span class="lnr"> 98 </span><span class="Constant"> </span>
-<span class="lnr"> 99 </span><span class="Identifier">$(BIN_B):</span> <span class="Identifier">$(OBJ_B)</span> <span class="Identifier">$(HEAD_B)</span>
-<span class="lnr">100 </span><span class="Special"> @</span><span class="Comment"># Link object files together</span>
-<span class="lnr">101 </span><span class="Constant"> </span><span class="Identifier">$(LD)</span><span class="Constant"> </span><span class="Identifier">$(LDFLAGS)</span><span class="Constant"> </span><span class="Identifier">$(OBJ_B)</span><span class="Constant"> -o </span><span class="Identifier">$@</span><span class="Constant"> </span><span class="Identifier">$(LDLIBS)</span>
-<span class="lnr">102 </span>
-<span class="lnr">103 </span><span class="Identifier">$(BIN_C):</span> <span class="Identifier">$(OBJ_C)</span> <span class="Identifier">$(HEAD_C)</span>
-<span class="lnr">104 </span><span class="Special"> @</span><span class="Comment"># Link object files together</span>
-<span class="lnr">105 </span><span class="Constant"> </span><span class="Identifier">$(LD)</span><span class="Constant"> </span><span class="Identifier">$(LDFLAGS)</span><span class="Constant"> </span><span class="Identifier">$(OBJ_C)</span><span class="Constant"> -o </span><span class="Identifier">$@</span><span class="Constant"> </span><span class="Identifier">$(LDLIBS)</span>
-<span class="lnr">106 </span>
-<span class="lnr">107 </span><span class="Identifier">$(BIN_D):</span> <span class="Identifier">$(OBJ_D)</span> <span class="Identifier">$(HEAD_D)</span>
-<span class="lnr">108 </span><span class="Special"> @</span><span class="Comment"># Link object files together</span>
-<span class="lnr">109 </span><span class="Constant"> </span><span class="Identifier">$(LD)</span><span class="Constant"> </span><span class="Identifier">$(LDFLAGS)</span><span class="Constant"> </span><span class="Identifier">$(OBJ_D)</span><span class="Constant"> -o </span><span class="Identifier">$@</span><span class="Constant"> </span><span class="Identifier">$(LDLIBS)</span>
-<span class="lnr">110 </span>
-<span class="lnr">111 </span><span class="Identifier">clean:</span> cleanA cleanB cleanC cleanD
-<span class="lnr">112 </span>
-<span class="lnr">113 </span><span class="Identifier">cleanA: </span>
-<span class="lnr">114 </span><span class="Special"> @</span><span class="Comment"># Remove object files</span>
-<span class="lnr">115 </span><span class="Constant"> rm -f </span><span class="Identifier">$(OBJ_A)</span><span class="Constant"> </span>
-<span class="lnr">116 </span><span class="Special"> @</span><span class="Comment"># Remove binaries</span>
-<span class="lnr">117 </span><span class="Constant"> rm -f </span><span class="Identifier">$(BIN_A)</span>
-<span class="lnr">118 </span><span class="Special"> @</span><span class="Comment"># Remove datafiles and plot</span>
-<span class="lnr">119 </span><span class="Constant"> rm -f funcA.dat plotA.png</span>
-<span class="lnr">120 </span>
-<span class="lnr">121 </span><span class="Identifier">cleanB: </span>
-<span class="lnr">122 </span><span class="Special"> @</span><span class="Comment"># Remove object files</span>
-<span class="lnr">123 </span><span class="Constant"> rm -f </span><span class="Identifier">$(OBJ_B)</span><span class="Constant"> </span>
-<span class="lnr">124 </span><span class="Special"> @</span><span class="Comment"># Remove binaries</span>
-<span class="lnr">125 </span><span class="Constant"> rm -f </span><span class="Identifier">$(BIN_B)</span>
-<span class="lnr">126 </span><span class="Special"> @</span><span class="Comment"># Remove datafiles and plot</span>
-<span class="lnr">127 </span><span class="Constant"> rm -f funcB.dat plotB.png</span>
-<span class="lnr">128 </span>
-<span class="lnr">129 </span><span class="Identifier">cleanC: </span>
-<span class="lnr">130 </span><span class="Special"> @</span><span class="Comment"># Remove object files</span>
-<span class="lnr">131 </span><span class="Constant"> rm -f </span><span class="Identifier">$(OBJ_C)</span><span class="Constant"> </span>
-<span class="lnr">132 </span><span class="Special"> @</span><span class="Comment"># Remove binaries</span>
-<span class="lnr">133 </span><span class="Constant"> rm -f </span><span class="Identifier">$(BIN_C)</span>
-<span class="lnr">134 </span><span class="Special"> @</span><span class="Comment"># Remove datafiles and plot</span>
-<span class="lnr">135 </span><span class="Constant"> rm -f funcC.dat plotC.png</span>
-<span class="lnr">136 </span>
-<span class="lnr">137 </span><span class="Identifier">cleanD: </span>
-<span class="lnr">138 </span><span class="Special"> @</span><span class="Comment"># Remove object files</span>
-<span class="lnr">139 </span><span class="Constant"> rm -f </span><span class="Identifier">$(OBJ_D)</span><span class="Constant"> </span>
-<span class="lnr">140 </span><span class="Special"> @</span><span class="Comment"># Remove binaries</span>
-<span class="lnr">141 </span><span class="Constant"> rm -f </span><span class="Identifier">$(BIN_D)</span>
-<span class="lnr">142 </span><span class="Constant"> </span><span class="Comment"># Removing datafile and plot</span>
-<span class="lnr">143 </span><span class="Special"> @</span><span class="Constant">rm -f funcD.dat plotD.png</span>
-<span class="lnr">144 </span>
-<span class="lnr">145 </span><span class="Identifier">htmlfiles:</span> html/mainA.cpp.html html/mainB.cpp.html html/mainC.cpp.html html/mainD.cpp.html html/ode.cpp.html html/check.cpp.html html/check.h.html html/functions.h.html html/ode.h.html html/typedefs.h.html html/vector_arithmetic.h.html html/plotA.gp.html html/plotB.gp.html html/plotC.gp.html html/plotD.gp.html html/Makefile.html
-<span class="lnr">146 </span><span class="Constant"> </span><span class="Comment"># Generating HTML files</span>
-<span class="lnr">147 </span><span class="Constant"> rst2html2 README.rst > html/README.html</span>
-<span class="lnr">148 </span>
-<span class="lnr">149 </span><span class="Identifier">html/%.html:</span> <span class="Identifier">%</span>
-<span class="lnr">150 </span><span class="Constant"> vim </span><span class="Identifier">$<</span><span class="Constant"> +TOhtml +</span><span class="Constant">"w </span><span class="Identifier">$@</span><span class="Constant">"</span><span class="Constant"> +</span><span class="Constant">"qall!"</span>
-<span class="lnr">151 </span>
-<span class="lnr">152 </span>
-<span class="lnr">153 </span><span class="Identifier">edit:</span>
-<span class="lnr">154 </span><span class="Special"> @</span><span class="Identifier">$(EDITOR)</span><span class="Constant"> Makefile README.rst *.cpp *.h *.gp</span>
-<span class="lnr">155 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="Comment"># Define compiler</span>
+<span id="L2" class="LineNr"> 2 </span><span class="Comment">#CXX=g++</span>
+<span id="L3" class="LineNr"> 3 </span>
+<span id="L4" class="LineNr"> 4 </span><span class="Comment"># Define compiler flags (show all warnings)</span>
+<span id="L5" class="LineNr"> 5 </span><span class="Identifier">CXXFLAGS</span>=-Wall
+<span id="L6" class="LineNr"> 6 </span><span class="Comment">#CXXFLAGS=-std=c++0x</span>
+<span id="L7" class="LineNr"> 7 </span>
+<span id="L8" class="LineNr"> 8 </span><span class="Comment"># Define linker flags</span>
+<span id="L9" class="LineNr"> 9 </span><span class="Comment">#LDFLAGS=-fopenmp</span>
+<span id="L10" class="LineNr"> 10 </span>
+<span id="L11" class="LineNr"> 11 </span><span class="Comment"># Compile optimized code</span>
+<span id="L12" class="LineNr"> 12 </span><span class="Identifier">CXXFLAGS</span>+=-O2
+<span id="L13" class="LineNr"> 13 </span>
+<span id="L14" class="LineNr"> 14 </span><span class="Comment"># Compile debuggable code</span>
+<span id="L15" class="LineNr"> 15 </span><span class="Comment">#CXXFLAGS+=-g</span>
+<span id="L16" class="LineNr"> 16 </span>
+<span id="L17" class="LineNr"> 17 </span><span class="Comment"># Compile profilable code</span>
+<span id="L18" class="LineNr"> 18 </span><span class="Comment">#CXXFLAGS+=-pg</span>
+<span id="L19" class="LineNr"> 19 </span><span class="Comment">#LDFLAGS+=-pg</span>
+<span id="L20" class="LineNr"> 20 </span>
+<span id="L21" class="LineNr"> 21 </span><span class="Comment"># Define linker</span>
+<span id="L22" class="LineNr"> 22 </span><span class="Identifier">LD</span>=g++
+<span id="L23" class="LineNr"> 23 </span>
+<span id="L24" class="LineNr"> 24 </span><span class="Comment"># All source code files</span>
+<span id="L25" class="LineNr"> 25 </span><span class="Identifier">SRC</span>=<span class="Identifier">$(</span><span class="Statement">shell</span><span class="Identifier"> ls *.cpp)</span>
+<span id="L26" class="LineNr"> 26 </span>
+<span id="L27" class="LineNr"> 27 </span>
+<span id="L28" class="LineNr"> 28 </span><span class="Comment"># Filenames of source code</span>
+<span id="L29" class="LineNr"> 29 </span><span class="Identifier">SHARED_SRC</span>=ode.cpp check.cpp
+<span id="L30" class="LineNr"> 30 </span><span class="Identifier">SHARED_HEADERS</span>=typedefs.h ode.h functions.h check.h
+<span id="L31" class="LineNr"> 31 </span><span class="Identifier">SRC_A</span>=mainA.cpp <span class="Identifier">$(SHARED_SRC)</span>
+<span id="L32" class="LineNr"> 32 </span><span class="Identifier">HEAD_A</span>=<span class="Identifier">$(SHARED_HEADERS)</span>
+<span id="L33" class="LineNr"> 33 </span><span class="Identifier">SRC_B</span>=mainB.cpp <span class="Identifier">$(SHARED_SRC)</span>
+<span id="L34" class="LineNr"> 34 </span><span class="Identifier">HEAD_B</span>=<span class="Identifier">$(SHARED_HEADERS)</span>
+<span id="L35" class="LineNr"> 35 </span><span class="Identifier">SRC_C</span>=mainC.cpp <span class="Identifier">$(SHARED_SRC)</span>
+<span id="L36" class="LineNr"> 36 </span><span class="Identifier">HEAD_C</span>=<span class="Identifier">$(SHARED_HEADERS)</span>
+<span id="L37" class="LineNr"> 37 </span><span class="Identifier">SRC_D</span>=mainD.cpp <span class="Identifier">$(SHARED_SRC)</span>
+<span id="L38" class="LineNr"> 38 </span><span class="Identifier">HEAD_D</span>=<span class="Identifier">$(SHARED_HEADERS)</span>
+<span id="L39" class="LineNr"> 39 </span>
+<span id="L40" class="LineNr"> 40 </span><span class="Comment"># Filenames of object files</span>
+<span id="L41" class="LineNr"> 41 </span><span class="Identifier">OBJ_A</span>=<span class="Identifier">$(SRC_A:.cpp=.o)</span>
+<span id="L42" class="LineNr"> 42 </span><span class="Identifier">OBJ_B</span>=<span class="Identifier">$(SRC_B:.cpp=.o)</span>
+<span id="L43" class="LineNr"> 43 </span><span class="Identifier">OBJ_C</span>=<span class="Identifier">$(SRC_C:.cpp=.o)</span>
+<span id="L44" class="LineNr"> 44 </span><span class="Identifier">OBJ_D</span>=<span class="Identifier">$(SRC_D:.cpp=.o)</span>
+<span id="L45" class="LineNr"> 45 </span>
+<span id="L46" class="LineNr"> 46 </span><span class="Comment"># Remove file type extension for binary filename</span>
+<span id="L47" class="LineNr"> 47 </span><span class="Identifier">BIN_A</span>=odeA
+<span id="L48" class="LineNr"> 48 </span><span class="Identifier">BIN_B</span>=odeB
+<span id="L49" class="LineNr"> 49 </span><span class="Identifier">BIN_C</span>=odeC
+<span id="L50" class="LineNr"> 50 </span><span class="Identifier">BIN_D</span>=odeD
+<span id="L51" class="LineNr"> 51 </span>
+<span id="L52" class="LineNr"> 52 </span><span class="Comment"># Define editor and options for `make edit`</span>
+<span id="L53" class="LineNr"> 53 </span><span class="Identifier">EDITOR</span>=vim -p
+<span id="L54" class="LineNr"> 54 </span>
+<span id="L55" class="LineNr"> 55 </span>
+<span id="L56" class="LineNr"> 56 </span><span class="Comment"># The default "all" depends on A and B</span>
+<span id="L57" class="LineNr"> 57 </span><span class="Identifier">all:</span> A B C D
+<span id="L58" class="LineNr"> 58 </span>
+<span id="L59" class="LineNr"> 59 </span><span class="Identifier">A:</span> plotA.png
+<span id="L60" class="LineNr"> 60 </span>
+<span id="L61" class="LineNr"> 61 </span><span class="Identifier">B:</span> plotB.png
+<span id="L62" class="LineNr"> 62 </span>
+<span id="L63" class="LineNr"> 63 </span><span class="Identifier">C:</span> plotC.png
+<span id="L64" class="LineNr"> 64 </span>
+<span id="L65" class="LineNr"> 65 </span><span class="Identifier">D:</span> plotD.png
+<span id="L66" class="LineNr"> 66 </span>
+<span id="L67" class="LineNr"> 67 </span><span class="Identifier">plotA.png:</span> funcA.dat plotA.gp
+<span id="L68" class="LineNr"> 68 </span><span class="Constant"> </span><span class="Comment"># Gnuplot: plotA.png</span>
+<span id="L69" class="LineNr"> 69 </span><span class="Special"> @</span><span class="Constant">gnuplot plotA.gp</span>
+<span id="L70" class="LineNr"> 70 </span>
+<span id="L71" class="LineNr"> 71 </span><span class="Identifier">plotB.png:</span> funcB.dat plotB.gp
+<span id="L72" class="LineNr"> 72 </span><span class="Constant"> </span><span class="Comment"># Gnuplot: plotB.png</span>
+<span id="L73" class="LineNr"> 73 </span><span class="Special"> @</span><span class="Constant">gnuplot plotB.gp</span>
+<span id="L74" class="LineNr"> 74 </span>
+<span id="L75" class="LineNr"> 75 </span><span class="Identifier">plotC.png:</span> funcC.dat plotC.gp
+<span id="L76" class="LineNr"> 76 </span><span class="Constant"> </span><span class="Comment"># Gnuplot: plotC.png</span>
+<span id="L77" class="LineNr"> 77 </span><span class="Special"> @</span><span class="Constant">gnuplot plotC.gp</span>
+<span id="L78" class="LineNr"> 78 </span>
+<span id="L79" class="LineNr"> 79 </span><span class="Identifier">plotD.png:</span> funcD.dat plotD.gp
+<span id="L80" class="LineNr"> 80 </span><span class="Constant"> </span><span class="Comment"># Gnuplot: plotD.png</span>
+<span id="L81" class="LineNr"> 81 </span><span class="Special"> @</span><span class="Constant">gnuplot plotD.gp</span>
+<span id="L82" class="LineNr"> 82 </span>
+<span id="L83" class="LineNr"> 83 </span><span class="Identifier">funcA.dat:</span> <span class="Identifier">$(BIN_A)</span>
+<span id="L84" class="LineNr"> 84 </span><span class="Special"> @</span><span class="Constant">./</span><span class="Identifier">$(BIN_A)</span>
+<span id="L85" class="LineNr"> 85 </span><span class="Constant"> </span>
+<span id="L86" class="LineNr"> 86 </span><span class="Identifier">funcB.dat:</span> <span class="Identifier">$(BIN_B)</span>
+<span id="L87" class="LineNr"> 87 </span><span class="Special"> @</span><span class="Constant">./</span><span class="Identifier">$(BIN_B)</span>
+<span id="L88" class="LineNr"> 88 </span>
+<span id="L89" class="LineNr"> 89 </span><span class="Identifier">funcC.dat:</span> <span class="Identifier">$(BIN_C)</span>
+<span id="L90" class="LineNr"> 90 </span><span class="Special"> @</span><span class="Constant">./</span><span class="Identifier">$(BIN_C)</span>
+<span id="L91" class="LineNr"> 91 </span><span class="Constant"> </span>
+<span id="L92" class="LineNr"> 92 </span><span class="Identifier">funcD.dat:</span> <span class="Identifier">$(BIN_D)</span>
+<span id="L93" class="LineNr"> 93 </span><span class="Special"> @</span><span class="Constant">./</span><span class="Identifier">$(BIN_D)</span>
+<span id="L94" class="LineNr"> 94 </span><span class="Constant"> </span>
+<span id="L95" class="LineNr"> 95 </span><span class="Identifier">$(BIN_A):</span> <span class="Identifier">$(OBJ_A)</span> <span class="Identifier">$(HEAD_A)</span>
+<span id="L96" class="LineNr"> 96 </span><span class="Special"> @</span><span class="Comment"># Link object files together</span>
+<span id="L97" class="LineNr"> 97 </span><span class="Constant"> </span><span class="Identifier">$(LD)</span><span class="Constant"> </span><span class="Identifier">$(LDFLAGS)</span><span class="Constant"> </span><span class="Identifier">$(OBJ_A)</span><span class="Constant"> -o </span><span class="Identifier">$@</span><span class="Constant"> </span><span class="Identifier">$(LDLIBS)</span>
+<span id="L98" class="LineNr"> 98 </span><span class="Constant"> </span>
+<span id="L99" class="LineNr"> 99 </span><span class="Identifier">$(BIN_B):</span> <span class="Identifier">$(OBJ_B)</span> <span class="Identifier">$(HEAD_B)</span>
+<span id="L100" class="LineNr">100 </span><span class="Special"> @</span><span class="Comment"># Link object files together</span>
+<span id="L101" class="LineNr">101 </span><span class="Constant"> </span><span class="Identifier">$(LD)</span><span class="Constant"> </span><span class="Identifier">$(LDFLAGS)</span><span class="Constant"> </span><span class="Identifier">$(OBJ_B)</span><span class="Constant"> -o </span><span class="Identifier">$@</span><span class="Constant"> </span><span class="Identifier">$(LDLIBS)</span>
+<span id="L102" class="LineNr">102 </span>
+<span id="L103" class="LineNr">103 </span><span class="Identifier">$(BIN_C):</span> <span class="Identifier">$(OBJ_C)</span> <span class="Identifier">$(HEAD_C)</span>
+<span id="L104" class="LineNr">104 </span><span class="Special"> @</span><span class="Comment"># Link object files together</span>
+<span id="L105" class="LineNr">105 </span><span class="Constant"> </span><span class="Identifier">$(LD)</span><span class="Constant"> </span><span class="Identifier">$(LDFLAGS)</span><span class="Constant"> </span><span class="Identifier">$(OBJ_C)</span><span class="Constant"> -o </span><span class="Identifier">$@</span><span class="Constant"> </span><span class="Identifier">$(LDLIBS)</span>
+<span id="L106" class="LineNr">106 </span>
+<span id="L107" class="LineNr">107 </span><span class="Identifier">$(BIN_D):</span> <span class="Identifier">$(OBJ_D)</span> <span class="Identifier">$(HEAD_D)</span>
+<span id="L108" class="LineNr">108 </span><span class="Special"> @</span><span class="Comment"># Link object files together</span>
+<span id="L109" class="LineNr">109 </span><span class="Constant"> </span><span class="Identifier">$(LD)</span><span class="Constant"> </span><span class="Identifier">$(LDFLAGS)</span><span class="Constant"> </span><span class="Identifier">$(OBJ_D)</span><span class="Constant"> -o </span><span class="Identifier">$@</span><span class="Constant"> </span><span class="Identifier">$(LDLIBS)</span>
+<span id="L110" class="LineNr">110 </span>
+<span id="L111" class="LineNr">111 </span><span class="Identifier">clean:</span> cleanA cleanB cleanC cleanD
+<span id="L112" class="LineNr">112 </span>
+<span id="L113" class="LineNr">113 </span><span class="Identifier">cleanA: </span>
+<span id="L114" class="LineNr">114 </span><span class="Special"> @</span><span class="Comment"># Remove object files</span>
+<span id="L115" class="LineNr">115 </span><span class="Constant"> rm -f </span><span class="Identifier">$(OBJ_A)</span><span class="Constant"> </span>
+<span id="L116" class="LineNr">116 </span><span class="Special"> @</span><span class="Comment"># Remove binaries</span>
+<span id="L117" class="LineNr">117 </span><span class="Constant"> rm -f </span><span class="Identifier">$(BIN_A)</span>
+<span id="L118" class="LineNr">118 </span><span class="Special"> @</span><span class="Comment"># Remove datafiles and plot</span>
+<span id="L119" class="LineNr">119 </span><span class="Constant"> rm -f funcA.dat plotA.png</span>
+<span id="L120" class="LineNr">120 </span>
+<span id="L121" class="LineNr">121 </span><span class="Identifier">cleanB: </span>
+<span id="L122" class="LineNr">122 </span><span class="Special"> @</span><span class="Comment"># Remove object files</span>
+<span id="L123" class="LineNr">123 </span><span class="Constant"> rm -f </span><span class="Identifier">$(OBJ_B)</span><span class="Constant"> </span>
+<span id="L124" class="LineNr">124 </span><span class="Special"> @</span><span class="Comment"># Remove binaries</span>
+<span id="L125" class="LineNr">125 </span><span class="Constant"> rm -f </span><span class="Identifier">$(BIN_B)</span>
+<span id="L126" class="LineNr">126 </span><span class="Special"> @</span><span class="Comment"># Remove datafiles and plot</span>
+<span id="L127" class="LineNr">127 </span><span class="Constant"> rm -f funcB.dat plotB.png</span>
+<span id="L128" class="LineNr">128 </span>
+<span id="L129" class="LineNr">129 </span><span class="Identifier">cleanC: </span>
+<span id="L130" class="LineNr">130 </span><span class="Special"> @</span><span class="Comment"># Remove object files</span>
+<span id="L131" class="LineNr">131 </span><span class="Constant"> rm -f </span><span class="Identifier">$(OBJ_C)</span><span class="Constant"> </span>
+<span id="L132" class="LineNr">132 </span><span class="Special"> @</span><span class="Comment"># Remove binaries</span>
+<span id="L133" class="LineNr">133 </span><span class="Constant"> rm -f </span><span class="Identifier">$(BIN_C)</span>
+<span id="L134" class="LineNr">134 </span><span class="Special"> @</span><span class="Comment"># Remove datafiles and plot</span>
+<span id="L135" class="LineNr">135 </span><span class="Constant"> rm -f funcC.dat plotC.png</span>
+<span id="L136" class="LineNr">136 </span>
+<span id="L137" class="LineNr">137 </span><span class="Identifier">cleanD: </span>
+<span id="L138" class="LineNr">138 </span><span class="Special"> @</span><span class="Comment"># Remove object files</span>
+<span id="L139" class="LineNr">139 </span><span class="Constant"> rm -f </span><span class="Identifier">$(OBJ_D)</span><span class="Constant"> </span>
+<span id="L140" class="LineNr">140 </span><span class="Special"> @</span><span class="Comment"># Remove binaries</span>
+<span id="L141" class="LineNr">141 </span><span class="Constant"> rm -f </span><span class="Identifier">$(BIN_D)</span>
+<span id="L142" class="LineNr">142 </span><span class="Constant"> </span><span class="Comment"># Removing datafile and plot</span>
+<span id="L143" class="LineNr">143 </span><span class="Special"> @</span><span class="Constant">rm -f funcD.dat plotD.png</span>
+<span id="L144" class="LineNr">144 </span>
+<span id="L145" class="LineNr">145 </span><span class="Identifier">htmlfiles:</span> html/mainA.cpp.html html/mainB.cpp.html html/mainC.cpp.html html/mainD.cpp.html html/ode.cpp.html html/check.cpp.html html/check.h.html html/functions.h.html html/ode.h.html html/typedefs.h.html html/vector_arithmetic.h.html html/plotA.gp.html html/plotB.gp.html html/plotC.gp.html html/plotD.gp.html html/Makefile.html
+<span id="L146" class="LineNr">146 </span><span class="Constant"> </span><span class="Comment"># Generating HTML files</span>
+<span id="L147" class="LineNr">147 </span><span class="Constant"> rst2html2 README.rst > html/README.html</span>
+<span id="L148" class="LineNr">148 </span>
+<span id="L149" class="LineNr">149 </span><span class="Identifier">html/%.html:</span> <span class="Identifier">%</span>
+<span id="L150" class="LineNr">150 </span><span class="Constant"> vim </span><span class="Identifier">$<</span><span class="Constant"> +TOhtml +</span><span class="Constant">"w </span><span class="Identifier">$@</span><span class="Constant">"</span><span class="Constant"> +</span><span class="Constant">"qall!"</span>
+<span id="L151" class="LineNr">151 </span>
+<span id="L152" class="LineNr">152 </span>
+<span id="L153" class="LineNr">153 </span><span class="Identifier">edit:</span>
+<span id="L154" class="LineNr">154 </span><span class="Special"> @</span><span class="Identifier">$(EDITOR)</span><span class="Constant"> Makefile README.rst *.cpp *.h *.gp</span>
+<span id="L155" class="LineNr">155 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/README.html b/exam/html/README.html
t@@ -1,406 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.9.1: http://docutils.sourceforge.net/" />
-<title>README: ODE integration with complex numbers</title>
-<style type="text/css">
-
-/*
-:Author: David Goodger (goodger@python.org)
-:Id: $Id: html4css1.css 7434 2012-05-11 21:06:27Z milde $
-:Copyright: This stylesheet has been placed in the public domain.
-
-Default cascading style sheet for the HTML output of Docutils.
-
-See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
-customize this style sheet.
-*/
-
-/* used to remove borders from tables and images */
-.borderless, table.borderless td, table.borderless th {
- border: 0 }
-
-table.borderless td, table.borderless th {
- /* Override padding for "table.docutils td" with "! important".
- The right padding separates the table cells. */
- padding: 0 0.5em 0 0 ! important }
-
-.first {
- /* Override more specific margin styles with "! important". */
- margin-top: 0 ! important }
-
-.last, .with-subtitle {
- margin-bottom: 0 ! important }
-
-.hidden {
- display: none }
-
-a.toc-backref {
- text-decoration: none ;
- color: black }
-
-blockquote.epigraph {
- margin: 2em 5em ; }
-
-dl.docutils dd {
- margin-bottom: 0.5em }
-
-object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
- overflow: hidden;
-}
-
-/* Uncomment (and remove this text!) to get bold-faced definition list terms
-dl.docutils dt {
- font-weight: bold }
-*/
-
-div.abstract {
- margin: 2em 5em }
-
-div.abstract p.topic-title {
- font-weight: bold ;
- text-align: center }
-
-div.admonition, div.attention, div.caution, div.danger, div.error,
-div.hint, div.important, div.note, div.tip, div.warning {
- margin: 2em ;
- border: medium outset ;
- padding: 1em }
-
-div.admonition p.admonition-title, div.hint p.admonition-title,
-div.important p.admonition-title, div.note p.admonition-title,
-div.tip p.admonition-title {
- font-weight: bold ;
- font-family: sans-serif }
-
-div.attention p.admonition-title, div.caution p.admonition-title,
-div.danger p.admonition-title, div.error p.admonition-title,
-div.warning p.admonition-title {
- color: red ;
- font-weight: bold ;
- font-family: sans-serif }
-
-/* Uncomment (and remove this text!) to get reduced vertical space in
- compound paragraphs.
-div.compound .compound-first, div.compound .compound-middle {
- margin-bottom: 0.5em }
-
-div.compound .compound-last, div.compound .compound-middle {
- margin-top: 0.5em }
-*/
-
-div.dedication {
- margin: 2em 5em ;
- text-align: center ;
- font-style: italic }
-
-div.dedication p.topic-title {
- font-weight: bold ;
- font-style: normal }
-
-div.figure {
- margin-left: 2em ;
- margin-right: 2em }
-
-div.footer, div.header {
- clear: both;
- font-size: smaller }
-
-div.line-block {
- display: block ;
- margin-top: 1em ;
- margin-bottom: 1em }
-
-div.line-block div.line-block {
- margin-top: 0 ;
- margin-bottom: 0 ;
- margin-left: 1.5em }
-
-div.sidebar {
- margin: 0 0 0.5em 1em ;
- border: medium outset ;
- padding: 1em ;
- background-color: #ffffee ;
- width: 40% ;
- float: right ;
- clear: right }
-
-div.sidebar p.rubric {
- font-family: sans-serif ;
- font-size: medium }
-
-div.system-messages {
- margin: 5em }
-
-div.system-messages h1 {
- color: red }
-
-div.system-message {
- border: medium outset ;
- padding: 1em }
-
-div.system-message p.system-message-title {
- color: red ;
- font-weight: bold }
-
-div.topic {
- margin: 2em }
-
-h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
-h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
- margin-top: 0.4em }
-
-h1.title {
- text-align: center }
-
-h2.subtitle {
- text-align: center }
-
-hr.docutils {
- width: 75% }
-
-img.align-left, .figure.align-left, object.align-left {
- clear: left ;
- float: left ;
- margin-right: 1em }
-
-img.align-right, .figure.align-right, object.align-right {
- clear: right ;
- float: right ;
- margin-left: 1em }
-
-img.align-center, .figure.align-center, object.align-center {
- display: block;
- margin-left: auto;
- margin-right: auto;
-}
-
-.align-left {
- text-align: left }
-
-.align-center {
- clear: both ;
- text-align: center }
-
-.align-right {
- text-align: right }
-
-/* reset inner alignment in figures */
-div.align-right {
- text-align: inherit }
-
-/* div.align-center * { */
-/* text-align: left } */
-
-ol.simple, ul.simple {
- margin-bottom: 1em }
-
-ol.arabic {
- list-style: decimal }
-
-ol.loweralpha {
- list-style: lower-alpha }
-
-ol.upperalpha {
- list-style: upper-alpha }
-
-ol.lowerroman {
- list-style: lower-roman }
-
-ol.upperroman {
- list-style: upper-roman }
-
-p.attribution {
- text-align: right ;
- margin-left: 50% }
-
-p.caption {
- font-style: italic }
-
-p.credits {
- font-style: italic ;
- font-size: smaller }
-
-p.label {
- white-space: nowrap }
-
-p.rubric {
- font-weight: bold ;
- font-size: larger ;
- color: maroon ;
- text-align: center }
-
-p.sidebar-title {
- font-family: sans-serif ;
- font-weight: bold ;
- font-size: larger }
-
-p.sidebar-subtitle {
- font-family: sans-serif ;
- font-weight: bold }
-
-p.topic-title {
- font-weight: bold }
-
-pre.address {
- margin-bottom: 0 ;
- margin-top: 0 ;
- font: inherit }
-
-pre.literal-block, pre.doctest-block, pre.math, pre.code {
- margin-left: 2em ;
- margin-right: 2em }
-
-pre.code .ln { /* line numbers */
- color: grey;
-}
-
-.code {
- background-color: #eeeeee
-}
-
-span.classifier {
- font-family: sans-serif ;
- font-style: oblique }
-
-span.classifier-delimiter {
- font-family: sans-serif ;
- font-weight: bold }
-
-span.interpreted {
- font-family: sans-serif }
-
-span.option {
- white-space: nowrap }
-
-span.pre {
- white-space: pre }
-
-span.problematic {
- color: red }
-
-span.section-subtitle {
- /* font-size relative to parent (h1..h6 element) */
- font-size: 80% }
-
-table.citation {
- border-left: solid 1px gray;
- margin-left: 1px }
-
-table.docinfo {
- margin: 2em 4em }
-
-table.docutils {
- margin-top: 0.5em ;
- margin-bottom: 0.5em }
-
-table.footnote {
- border-left: solid 1px black;
- margin-left: 1px }
-
-table.docutils td, table.docutils th,
-table.docinfo td, table.docinfo th {
- padding-left: 0.5em ;
- padding-right: 0.5em ;
- vertical-align: top }
-
-table.docutils th.field-name, table.docinfo th.docinfo-name {
- font-weight: bold ;
- text-align: left ;
- white-space: nowrap ;
- padding-left: 0 }
-
-h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
-h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
- font-size: 100% }
-
-ul.auto-toc {
- list-style-type: none }
-
-</style>
-</head>
-<body>
-<div class="document" id="readme-ode-integration-with-complex-numbers">
-<h1 class="title">README: ODE integration with complex numbers</h1>
-
-<p>Exam exercise for <em>Numerical Methods</em> by Anders D. Christensen (<a class="reference external" href="mailto:adc@geo.au.dk">mail</a>)</p>
-<div class="section" id="file-description">
-<h1>File description</h1>
-<ul class="simple">
-<li><tt class="docutils literal">Makefile</tt>: Description for GNU Make, handles compilation and execution.</li>
-<li><tt class="docutils literal">README.rst</tt> (this file): Description of numeric implementation and usage.
-Written with reStructuredText syntax.</li>
-<li><tt class="docutils literal">check.cpp</tt>: Function for displaying the state of a condition to stdout.</li>
-<li><tt class="docutils literal">check.h</tt>: Prototype for the check-function.</li>
-<li><tt class="docutils literal">functions.h</tt>: Input functions to be evaluated.</li>
-<li><tt class="docutils literal">mainA.cpp</tt>: Main source code file for part A.</li>
-<li><tt class="docutils literal">ode.cpp</tt>: Constructor and functions for the ODE class, including Runge-Kutta
-stepper and driver.</li>
-<li><tt class="docutils literal">ode.h</tt>: Header file with the ODE class. This file must be included in all
-programs that want to utilize the ODE functionality.</li>
-<li><tt class="docutils literal">plot.gp</tt>: Script for plotting all graphs with Gnuplot.</li>
-<li><tt class="docutils literal">typedefs.h</tt>: Header file containing definitions of two main types,
-<tt class="docutils literal">Inttype</tt>, a whole-number type, and <tt class="docutils literal">Floattype</tt>, a floating point number
-type. The type definitions can be changed to different lengths and precisions.
-The program can be compiled for verbose output by changing the <tt class="docutils literal">verbose</tt>
-variable.</li>
-<li><tt class="docutils literal">vector_arithmetic.h</tt>: Operator overloading functions for the <tt class="docutils literal"><span class="pre">std::vector</span></tt>
-class.</li>
-</ul>
-</div>
-<div class="section" id="problem-descriptions">
-<h1>Problem descriptions</h1>
-<p>The four generated executables each demonstrate the ODE solvers functionality by
-performing the following tasks. The results consist of the console output and
-the corresponding plot with filename <tt class="docutils literal"><span class="pre">plot<Character>.png</span></tt>.
-- <em>A</em>: Construct an ODE solver that can handle functions with complex values.
-Demonstrate that it solves the real component correctly, by stepping along
-a path in the real range.
-- <em>B</em>: Demonstrate that the ODE solver can solve the imaginary component by
-stepping along a path in the imaginary range.
-- <em>C</em>: Demonstrate the solution of a set of complex equations by stepping
-through the complex plane.
-- <em>D</em>: For an integration path in the complex plane, visualize how the
-requirements of absolute- and relative precision are related to the number of
-integration steps, for a given floating point precision.</p>
-</div>
-<div class="section" id="implementation">
-<h1>Implementation</h1>
-<p>This exercise was written in object-oriented C++ for easy reuse. For
-portability, all included classes are from the standard template library.</p>
-<p>The necessary <tt class="docutils literal"><span class="pre">std::vector</span></tt> arithmetic operations where overloaded to support
-element-wise operations, such as vector-scalar multiplication, vector-vector
-addition, etc. This approach was preferred over using <tt class="docutils literal"><span class="pre">std::valarray</span></tt>, since it
-is not dynamically expandable.</p>
-<p>When creating a new ODE object, the user specifies the end-points of the linear
-range, where the specified system of ordinary differential equations with
-complex values will be solved. The range end-points are complex numbers
-themselves, and the user can thus specify whether the integrator steps through a
-range of real values, imaginary values, or both components in the complex plane.</p>
-<p>The solver steps through the specified range by an adaptive step size, which is
-also a complex number. The user specifies the fraction of the range to be used
-as a start value for the step. The default value is 0.01.</p>
-<p>The ODE class contains functions for writing the ODE solution to stdout
-(<tt class="docutils literal"><span class="pre">ODE::print</span></tt>) or to a text file (<tt class="docutils literal"><span class="pre">ODE::write</span></tt>). The output format is the
-following; the first column is the real part of x, second column the imaginary
-part. The subsequent columns do in turn consist of real- and imaginary parts of
-the variables in the ODE.</p>
-<p>The program requires a modern C++ compiler, GNU Make and Gnuplot. It has been
-tested with GCC, Clang and llvm.</p>
-</div>
-<div class="section" id="compiliation-and-execution">
-<h1>Compiliation and execution</h1>
-<p>To make and execute the program, go to the root folder and type <cite>make</cite>. This
-will compile and execute the programs for part A-D, and plot output graphs. If
-desired, individual parts can be compiled and executed using <cite>make <Character></cite>.</p>
-<p>To view the source code in a browser with vim's syntax highlighting, type <cite>make
-html</cite>, and view the files in the <cite>html</cite> folder. The generation of HTML files
-requires a newer vim for the source code files, and Docutils for the readme.</p>
-<p>All output and objects can be removed using <cite>make clean</cite>.</p>
-<p>#vim: set tw=80</p>
-</div>
-</div>
-</body>
-</html>
(DIR) diff --git a/exam/html/check.cpp.html b/exam/html/check.cpp.html
t@@ -3,37 +3,69 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/check.cpp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Special { color: #ff40ff; }
-.Statement { color: #ffff00; }
-.Type { color: #00ff00; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
-.Comment { color: #00ffff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Comment { color: #008080; }
+.Constant { color: #af5f00; }
+.Special { color: #c000c0; }
+.PreProc { color: #c000c0; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="Comment">// Function used for reporting the condition of a </span>
-<span class="lnr"> 2 </span><span class="Comment">// statement to stdout using ANSI colors.</span>
-<span class="lnr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
-<span class="lnr"> 4 </span>
-<span class="lnr"> 5 </span><span class="Type">void</span> check(<span class="Type">const</span> <span class="Type">bool</span> statement)
-<span class="lnr"> 6 </span>{
-<span class="lnr"> 7 </span> <span class="Statement">if</span> (statement == <span class="Constant">true</span>)
-<span class="lnr"> 8 </span> std::cout << <span class="Constant">"</span><span class="Special">\t\033</span><span class="Constant">[0;32mPassed</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr"> 9 </span> <span class="Statement">else</span>
-<span class="lnr">10 </span> std::cout << <span class="Constant">"</span><span class="Special">\t\033</span><span class="Constant">[1;31mFail!!</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">11 </span>}
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="Comment">// Function used for reporting the condition of a </span>
+<span id="L2" class="LineNr"> 2 </span><span class="Comment">// statement to stdout using ANSI colors.</span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
+<span id="L4" class="LineNr"> 4 </span>
+<span id="L5" class="LineNr"> 5 </span><span class="Type">void</span> check(<span class="Type">const</span> <span class="Type">bool</span> statement)
+<span id="L6" class="LineNr"> 6 </span>{
+<span id="L7" class="LineNr"> 7 </span> <span class="Statement">if</span> (statement == <span class="Constant">true</span>)
+<span id="L8" class="LineNr"> 8 </span> std::cout << <span class="Constant">"</span><span class="Special">\t\033</span><span class="Constant">[0;32mPassed</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L9" class="LineNr"> 9 </span> <span class="Statement">else</span>
+<span id="L10" class="LineNr">10 </span> std::cout << <span class="Constant">"</span><span class="Special">\t\033</span><span class="Constant">[1;31mFail!!</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L11" class="LineNr">11 </span>}
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/check.h.html b/exam/html/check.h.html
t@@ -3,30 +3,62 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/check.h.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Type { color: #00ff00; }
-.Comment { color: #00ffff; }
-.PreProc { color: #ff40ff; }
+* { font-size: 1em; }
+.LineNr { color: #804000; }
+.PreProc { color: #c000c0; }
+.Type { color: #008000; }
+.Comment { color: #008080; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr">1 </span><span class="PreProc">#ifndef CHECK_H_</span>
-<span class="lnr">2 </span><span class="PreProc">#define CHECK_H_</span>
-<span class="lnr">3 </span>
-<span class="lnr">4 </span><span class="Comment">// Prototype for checking function</span>
-<span class="lnr">5 </span><span class="Type">void</span> check(<span class="Type">const</span> <span class="Type">bool</span> statement);
-<span class="lnr">6 </span>
-<span class="lnr">7 </span><span class="PreProc">#endif</span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr">1 </span><span class="PreProc">#ifndef CHECK_H_</span>
+<span id="L2" class="LineNr">2 </span><span class="PreProc">#define CHECK_H_</span>
+<span id="L3" class="LineNr">3 </span>
+<span id="L4" class="LineNr">4 </span><span class="Comment">// Prototype for checking function</span>
+<span id="L5" class="LineNr">5 </span><span class="Type">void</span> check(<span class="Type">const</span> <span class="Type">bool</span> statement);
+<span id="L6" class="LineNr">6 </span>
+<span id="L7" class="LineNr">7 </span><span class="PreProc">#endif</span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/functions.h.html b/exam/html/functions.h.html
t@@ -3,50 +3,82 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/functions.h.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Statement { color: #ffff00; }
-.Type { color: #00ff00; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
-.Comment { color: #00ffff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Comment { color: #008080; }
+.Constant { color: #af5f00; }
+.PreProc { color: #c000c0; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="Comment">// Make sure file is only included once per object</span>
-<span class="lnr"> 2 </span><span class="PreProc">#ifndef FUNCTIONS_H_</span>
-<span class="lnr"> 3 </span><span class="PreProc">#define FUNCTIONS_H_</span>
-<span class="lnr"> 4 </span>
-<span class="lnr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
-<span class="lnr"> 6 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
-<span class="lnr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
-<span class="lnr"> 8 </span>
-<span class="lnr"> 9 </span>
-<span class="lnr">10 </span><span class="Comment">//// ODEs with real+complex parts.</span>
-<span class="lnr">11 </span><span class="Comment">//// Return the derivatives at the point x,vec(y)</span>
-<span class="lnr">12 </span>
-<span class="lnr">13 </span>std::vector<std::complex<Floattype> >
-<span class="lnr">14 </span> func1(<span class="Type">const</span> std::complex<Floattype> z,
-<span class="lnr">15 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > &y)
-<span class="lnr">16 </span>{
-<span class="lnr">17 </span> std::vector<std::complex<Floattype> > dydz(<span class="Constant">2</span>);
-<span class="lnr">18 </span> dydz[<span class="Constant">0</span>].real() = y[<span class="Constant">1</span>].real();
-<span class="lnr">19 </span> dydz[<span class="Constant">0</span>].imag() = y[<span class="Constant">1</span>].imag();
-<span class="lnr">20 </span> dydz[<span class="Constant">1</span>].real() = -y[<span class="Constant">0</span>].real();
-<span class="lnr">21 </span> dydz[<span class="Constant">1</span>].imag() = <span class="Constant">0.5f</span>*y[<span class="Constant">0</span>].imag();
-<span class="lnr">22 </span> <span class="Statement">return</span> dydz;
-<span class="lnr">23 </span>}
-<span class="lnr">24 </span>
-<span class="lnr">25 </span><span class="PreProc">#endif</span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="Comment">// Make sure file is only included once per object</span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#ifndef FUNCTIONS_H_</span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#define FUNCTIONS_H_</span>
+<span id="L4" class="LineNr"> 4 </span>
+<span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
+<span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
+<span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
+<span id="L8" class="LineNr"> 8 </span>
+<span id="L9" class="LineNr"> 9 </span>
+<span id="L10" class="LineNr">10 </span><span class="Comment">//// ODEs with real+complex parts.</span>
+<span id="L11" class="LineNr">11 </span><span class="Comment">//// Return the derivatives at the point x,vec(y)</span>
+<span id="L12" class="LineNr">12 </span>
+<span id="L13" class="LineNr">13 </span>std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L14" class="LineNr">14 </span> func1(<span class="Type">const</span> std::<span class="Type">complex</span><Floattype> z,
+<span id="L15" class="LineNr">15 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y)
+<span id="L16" class="LineNr">16 </span>{
+<span id="L17" class="LineNr">17 </span> std::vector<std::<span class="Type">complex</span><Floattype> > dydz(<span class="Constant">2</span>);
+<span id="L18" class="LineNr">18 </span> dydz[<span class="Constant">0</span>].real() = y[<span class="Constant">1</span>].real();
+<span id="L19" class="LineNr">19 </span> dydz[<span class="Constant">0</span>].imag() = y[<span class="Constant">1</span>].imag();
+<span id="L20" class="LineNr">20 </span> dydz[<span class="Constant">1</span>].real() = -y[<span class="Constant">0</span>].real();
+<span id="L21" class="LineNr">21 </span> dydz[<span class="Constant">1</span>].imag() = <span class="Constant">0.5f</span>*y[<span class="Constant">0</span>].imag();
+<span id="L22" class="LineNr">22 </span> <span class="Statement">return</span> dydz;
+<span id="L23" class="LineNr">23 </span>}
+<span id="L24" class="LineNr">24 </span>
+<span id="L25" class="LineNr">25 </span><span class="PreProc">#endif</span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/mainA.cpp.html b/exam/html/mainA.cpp.html
t@@ -3,85 +3,117 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/mainA.cpp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Special { color: #ff40ff; }
-.Statement { color: #ffff00; }
-.Comment { color: #00ffff; }
-.Type { color: #00ff00; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.PreProc { color: #c000c0; }
+.Constant { color: #af5f00; }
+.Special { color: #c000c0; }
+.Comment { color: #008080; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
-<span class="lnr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
-<span class="lnr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
-<span class="lnr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span>
-<span class="lnr"> 5 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
-<span class="lnr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"check.h"</span>
-<span class="lnr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
-<span class="lnr"> 8 </span><span class="PreProc">#include </span><span class="Constant">"functions.h"</span>
-<span class="lnr"> 9 </span>
-<span class="lnr">10 </span>
-<span class="lnr">11 </span><span class="Type">int</span> main()
-<span class="lnr">12 </span>{
-<span class="lnr">13 </span> <span class="Comment">// Namespace declarations</span>
-<span class="lnr">14 </span> <span class="Statement">using</span> std::cout;
-<span class="lnr">15 </span> <span class="Statement">using</span> std::vector;
-<span class="lnr">16 </span> <span class="Statement">using</span> std::complex;
-<span class="lnr">17 </span>
-<span class="lnr">18 </span> <span class="Comment">// Calculate machine precision</span>
-<span class="lnr">19 </span> Floattype eps_machine = <span class="Constant">1.0f</span>;
-<span class="lnr">20 </span> <span class="Statement">while</span> (<span class="Constant">1.0f</span> + eps_machine != <span class="Constant">1.0f</span>)
-<span class="lnr">21 </span> eps_machine /= <span class="Constant">2.0f</span>;
-<span class="lnr">22 </span>
-<span class="lnr">23 </span> <span class="Type">const</span> <span class="Type">int</span> id = <span class="Constant">20062213</span>;
-<span class="lnr">24 </span> <span class="Type">const</span> <span class="Type">char</span> n = <span class="Constant">10</span>;
-<span class="lnr">25 </span> cout << <span class="Constant">"</span><span class="Special">\n</span><span class="Constant">My student id is </span><span class="Special">\033</span><span class="Constant">[1;37m"</span> << id
-<span class="lnr">26 </span> << <span class="Constant">"</span><span class="Special">\033</span><span class="Constant">[0m, resulting in exam exercise: </span><span class="Special">\033</span><span class="Constant">[1;31m"</span>
-<span class="lnr">27 </span> << id%n << <span class="Constant">"</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">28 </span> cout << <span class="Constant">"Examination project:</span><span class="Special">\033</span><span class="Constant">[1;37m ODE integration "</span>
-<span class="lnr">29 </span> << <span class="Constant">"with complex numbers</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n\n</span><span class="Constant">"</span>;
-<span class="lnr">30 </span>
-<span class="lnr">31 </span> cout << <span class="Constant">"</span><span class="Special">\033</span><span class="Constant">[1;33m--- Part A: Solving along a real path ---</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">32 </span> <span class="Type">complex</span><Floattype> a(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Lower limit</span>
-<span class="lnr">33 </span> <span class="Type">complex</span><Floattype> b(<span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Upper limit</span>
-<span class="lnr">34 </span> cout << <span class="Constant">"Integration path: b-a = "</span> << b-a << <span class="Special">'\n'</span>;
-<span class="lnr">35 </span> Inttype n_eqs = <span class="Constant">2</span>; <span class="Comment">// Number of equations in ODE system</span>
-<span class="lnr">36 </span> vector<<span class="Type">complex</span><Floattype> > y_start(n_eqs);
-<span class="lnr">37 </span> <span class="Type">complex</span><Floattype> y0(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>);
-<span class="lnr">38 </span> <span class="Type">complex</span><Floattype> y1(<span class="Constant">1.0f</span>, <span class="Constant">1.0f</span>);
-<span class="lnr">39 </span> y_start[<span class="Constant">0</span>] = y0;
-<span class="lnr">40 </span> y_start[<span class="Constant">1</span>] = y1;
-<span class="lnr">41 </span> Floattype h_start = <span class="Constant">0.01f</span>;
-<span class="lnr">42 </span> ODE realode(func1, <span class="Comment">// ODE system</span>
-<span class="lnr">43 </span> y_start, <span class="Comment">// Initial values</span>
-<span class="lnr">44 </span> a, <span class="Comment">// Lower limit</span>
-<span class="lnr">45 </span> b, <span class="Comment">// Upper limit</span>
-<span class="lnr">46 </span> h_start, <span class="Comment">// Start value of step size</span>
-<span class="lnr">47 </span> <span class="Constant">10000</span>, <span class="Comment">// Max. number of steps</span>
-<span class="lnr">48 </span> eps_machine*<span class="Constant">1e12f</span>, <span class="Comment">// Absolute precision</span>
-<span class="lnr">49 </span> eps_machine*<span class="Constant">1e12f</span>); <span class="Comment">// Relative precision</span>
-<span class="lnr">50 </span> realode.write(<span class="Constant">"funcA.dat"</span>); <span class="Comment">// Write solutions to data file</span>
-<span class="lnr">51 </span>
-<span class="lnr">52 </span> <span class="Comment">// Report to stdout</span>
-<span class="lnr">53 </span> cout << <span class="Constant">"ODE system solved in "</span>
-<span class="lnr">54 </span> << realode.steps() << <span class="Constant">" steps.</span><span class="Special">\n\n</span><span class="Constant">"</span>;
-<span class="lnr">55 </span>
-<span class="lnr">56 </span> <span class="Comment">// Return successfully</span>
-<span class="lnr">57 </span> <span class="Statement">return</span> <span class="Constant">0</span>;
-<span class="lnr">58 </span>}
-<span class="lnr">59 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
+<span id="L4" class="LineNr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span>
+<span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
+<span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"check.h"</span>
+<span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
+<span id="L8" class="LineNr"> 8 </span><span class="PreProc">#include </span><span class="Constant">"functions.h"</span>
+<span id="L9" class="LineNr"> 9 </span>
+<span id="L10" class="LineNr">10 </span>
+<span id="L11" class="LineNr">11 </span><span class="Type">int</span> main()
+<span id="L12" class="LineNr">12 </span>{
+<span id="L13" class="LineNr">13 </span> <span class="Comment">// Namespace declarations</span>
+<span id="L14" class="LineNr">14 </span> <span class="Statement">using</span> std::cout;
+<span id="L15" class="LineNr">15 </span> <span class="Statement">using</span> std::vector;
+<span id="L16" class="LineNr">16 </span> <span class="Statement">using</span> std::<span class="Type">complex</span>;
+<span id="L17" class="LineNr">17 </span>
+<span id="L18" class="LineNr">18 </span> <span class="Comment">// Calculate machine precision</span>
+<span id="L19" class="LineNr">19 </span> Floattype eps_machine = <span class="Constant">1.0f</span>;
+<span id="L20" class="LineNr">20 </span> <span class="Statement">while</span> (<span class="Constant">1.0f</span> + eps_machine != <span class="Constant">1.0f</span>)
+<span id="L21" class="LineNr">21 </span> eps_machine /= <span class="Constant">2.0f</span>;
+<span id="L22" class="LineNr">22 </span>
+<span id="L23" class="LineNr">23 </span> <span class="Type">const</span> <span class="Type">int</span> id = <span class="Constant">20062213</span>;
+<span id="L24" class="LineNr">24 </span> <span class="Type">const</span> <span class="Type">char</span> n = <span class="Constant">10</span>;
+<span id="L25" class="LineNr">25 </span> cout << <span class="Constant">"</span><span class="Special">\n</span><span class="Constant">My student id is </span><span class="Special">\033</span><span class="Constant">[1;37m"</span> << id
+<span id="L26" class="LineNr">26 </span> << <span class="Constant">"</span><span class="Special">\033</span><span class="Constant">[0m, resulting in exam exercise: </span><span class="Special">\033</span><span class="Constant">[1;31m"</span>
+<span id="L27" class="LineNr">27 </span> << id%n << <span class="Constant">"</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L28" class="LineNr">28 </span> cout << <span class="Constant">"Examination project:</span><span class="Special">\033</span><span class="Constant">[1;37m ODE integration "</span>
+<span id="L29" class="LineNr">29 </span> << <span class="Constant">"with complex numbers</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n\n</span><span class="Constant">"</span>;
+<span id="L30" class="LineNr">30 </span>
+<span id="L31" class="LineNr">31 </span> cout << <span class="Constant">"</span><span class="Special">\033</span><span class="Constant">[1;33m--- Part A: Solving along a real path ---</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L32" class="LineNr">32 </span> <span class="Type">complex</span><Floattype> a(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Lower limit</span>
+<span id="L33" class="LineNr">33 </span> <span class="Type">complex</span><Floattype> b(<span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Upper limit</span>
+<span id="L34" class="LineNr">34 </span> cout << <span class="Constant">"Integration path: b-a = "</span> << b-a << <span class="Special">'\n'</span>;
+<span id="L35" class="LineNr">35 </span> Inttype n_eqs = <span class="Constant">2</span>; <span class="Comment">// Number of equations in ODE system</span>
+<span id="L36" class="LineNr">36 </span> vector<<span class="Type">complex</span><Floattype> > y_start(n_eqs);
+<span id="L37" class="LineNr">37 </span> <span class="Type">complex</span><Floattype> y0(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>);
+<span id="L38" class="LineNr">38 </span> <span class="Type">complex</span><Floattype> y1(<span class="Constant">1.0f</span>, <span class="Constant">1.0f</span>);
+<span id="L39" class="LineNr">39 </span> y_start[<span class="Constant">0</span>] = y0;
+<span id="L40" class="LineNr">40 </span> y_start[<span class="Constant">1</span>] = y1;
+<span id="L41" class="LineNr">41 </span> Floattype h_start = <span class="Constant">0.01f</span>;
+<span id="L42" class="LineNr">42 </span> ODE realode(func1, <span class="Comment">// ODE system</span>
+<span id="L43" class="LineNr">43 </span> y_start, <span class="Comment">// Initial values</span>
+<span id="L44" class="LineNr">44 </span> a, <span class="Comment">// Lower limit</span>
+<span id="L45" class="LineNr">45 </span> b, <span class="Comment">// Upper limit</span>
+<span id="L46" class="LineNr">46 </span> h_start, <span class="Comment">// Start value of step size</span>
+<span id="L47" class="LineNr">47 </span> <span class="Constant">10000</span>, <span class="Comment">// Max. number of steps</span>
+<span id="L48" class="LineNr">48 </span> eps_machine*<span class="Constant">1e12f</span>, <span class="Comment">// Absolute precision</span>
+<span id="L49" class="LineNr">49 </span> eps_machine*<span class="Constant">1e12f</span>); <span class="Comment">// Relative precision</span>
+<span id="L50" class="LineNr">50 </span> realode.write(<span class="Constant">"funcA.dat"</span>); <span class="Comment">// Write solutions to data file</span>
+<span id="L51" class="LineNr">51 </span>
+<span id="L52" class="LineNr">52 </span> <span class="Comment">// Report to stdout</span>
+<span id="L53" class="LineNr">53 </span> cout << <span class="Constant">"ODE system solved in "</span>
+<span id="L54" class="LineNr">54 </span> << realode.steps() << <span class="Constant">" steps.</span><span class="Special">\n\n</span><span class="Constant">"</span>;
+<span id="L55" class="LineNr">55 </span>
+<span id="L56" class="LineNr">56 </span> <span class="Comment">// Return successfully</span>
+<span id="L57" class="LineNr">57 </span> <span class="Statement">return</span> <span class="Constant">0</span>;
+<span id="L58" class="LineNr">58 </span>}
+<span id="L59" class="LineNr">59 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/mainB.cpp.html b/exam/html/mainB.cpp.html
t@@ -3,76 +3,108 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/mainB.cpp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Special { color: #ff40ff; }
-.Statement { color: #ffff00; }
-.Comment { color: #00ffff; }
-.Type { color: #00ff00; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.PreProc { color: #c000c0; }
+.Constant { color: #af5f00; }
+.Special { color: #c000c0; }
+.Comment { color: #008080; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
-<span class="lnr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
-<span class="lnr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
-<span class="lnr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span>
-<span class="lnr"> 5 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
-<span class="lnr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"check.h"</span>
-<span class="lnr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
-<span class="lnr"> 8 </span><span class="PreProc">#include </span><span class="Constant">"functions.h"</span>
-<span class="lnr"> 9 </span>
-<span class="lnr">10 </span><span class="Type">int</span> main()
-<span class="lnr">11 </span>{
-<span class="lnr">12 </span> <span class="Comment">// Namespace declarations</span>
-<span class="lnr">13 </span> <span class="Statement">using</span> std::cout;
-<span class="lnr">14 </span> <span class="Statement">using</span> std::vector;
-<span class="lnr">15 </span> <span class="Statement">using</span> std::complex;
-<span class="lnr">16 </span>
-<span class="lnr">17 </span> <span class="Comment">// Calculate machine precision</span>
-<span class="lnr">18 </span> Floattype eps_machine = <span class="Constant">1.0f</span>;
-<span class="lnr">19 </span> <span class="Statement">while</span> (<span class="Constant">1.0f</span> + eps_machine != <span class="Constant">1.0f</span>)
-<span class="lnr">20 </span> eps_machine /= <span class="Constant">2.0f</span>;
-<span class="lnr">21 </span>
-<span class="lnr">22 </span> cout << <span class="Constant">"</span><span class="Special">\n\033</span><span class="Constant">[1;33m--- Part B: Solving along an imaginary path ---</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">23 </span> <span class="Type">complex</span><Floattype> a(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Lower limit</span>
-<span class="lnr">24 </span> <span class="Type">complex</span><Floattype> b(<span class="Constant">0.0f</span>, <span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>); <span class="Comment">// Upper limit</span>
-<span class="lnr">25 </span> cout << <span class="Constant">"Integration path: b-a = "</span> << b-a << <span class="Special">'\n'</span>;
-<span class="lnr">26 </span> Inttype n_eqs = <span class="Constant">2</span>; <span class="Comment">// Number of equations in ODE system</span>
-<span class="lnr">27 </span> vector<<span class="Type">complex</span><Floattype> > y_start(n_eqs);
-<span class="lnr">28 </span> <span class="Type">complex</span><Floattype> y0(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>);
-<span class="lnr">29 </span> <span class="Type">complex</span><Floattype> y1(<span class="Constant">1.0f</span>, <span class="Constant">1.0f</span>);
-<span class="lnr">30 </span> y_start[<span class="Constant">0</span>] = y0;
-<span class="lnr">31 </span> y_start[<span class="Constant">1</span>] = y1;
-<span class="lnr">32 </span> Floattype h_start = <span class="Constant">0.01f</span>;
-<span class="lnr">33 </span> ODE imagode(func1, <span class="Comment">// ODE system</span>
-<span class="lnr">34 </span> y_start, <span class="Comment">// Initial values</span>
-<span class="lnr">35 </span> a, <span class="Comment">// Lower limit</span>
-<span class="lnr">36 </span> b, <span class="Comment">// Upper limit</span>
-<span class="lnr">37 </span> h_start, <span class="Comment">// Start value of step size</span>
-<span class="lnr">38 </span> <span class="Constant">10000</span>, <span class="Comment">// Max. number of steps</span>
-<span class="lnr">39 </span> eps_machine*<span class="Constant">1e12f</span>, <span class="Comment">// Absolute precision</span>
-<span class="lnr">40 </span> eps_machine*<span class="Constant">1e12f</span>); <span class="Comment">// Relative precision</span>
-<span class="lnr">41 </span> imagode.write(<span class="Constant">"funcB.dat"</span>); <span class="Comment">// Write solutions to data file</span>
-<span class="lnr">42 </span>
-<span class="lnr">43 </span> <span class="Comment">// Report to stdout</span>
-<span class="lnr">44 </span> cout << <span class="Constant">"ODE system solved in "</span>
-<span class="lnr">45 </span> << imagode.steps() << <span class="Constant">" steps.</span><span class="Special">\n\n</span><span class="Constant">"</span>;
-<span class="lnr">46 </span>
-<span class="lnr">47 </span> <span class="Comment">// Return successfully</span>
-<span class="lnr">48 </span> <span class="Statement">return</span> <span class="Constant">0</span>;
-<span class="lnr">49 </span>}
-<span class="lnr">50 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
+<span id="L4" class="LineNr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span>
+<span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
+<span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"check.h"</span>
+<span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
+<span id="L8" class="LineNr"> 8 </span><span class="PreProc">#include </span><span class="Constant">"functions.h"</span>
+<span id="L9" class="LineNr"> 9 </span>
+<span id="L10" class="LineNr">10 </span><span class="Type">int</span> main()
+<span id="L11" class="LineNr">11 </span>{
+<span id="L12" class="LineNr">12 </span> <span class="Comment">// Namespace declarations</span>
+<span id="L13" class="LineNr">13 </span> <span class="Statement">using</span> std::cout;
+<span id="L14" class="LineNr">14 </span> <span class="Statement">using</span> std::vector;
+<span id="L15" class="LineNr">15 </span> <span class="Statement">using</span> std::<span class="Type">complex</span>;
+<span id="L16" class="LineNr">16 </span>
+<span id="L17" class="LineNr">17 </span> <span class="Comment">// Calculate machine precision</span>
+<span id="L18" class="LineNr">18 </span> Floattype eps_machine = <span class="Constant">1.0f</span>;
+<span id="L19" class="LineNr">19 </span> <span class="Statement">while</span> (<span class="Constant">1.0f</span> + eps_machine != <span class="Constant">1.0f</span>)
+<span id="L20" class="LineNr">20 </span> eps_machine /= <span class="Constant">2.0f</span>;
+<span id="L21" class="LineNr">21 </span>
+<span id="L22" class="LineNr">22 </span> cout << <span class="Constant">"</span><span class="Special">\n\033</span><span class="Constant">[1;33m--- Part B: Solving along an imaginary path ---</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L23" class="LineNr">23 </span> <span class="Type">complex</span><Floattype> a(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Lower limit</span>
+<span id="L24" class="LineNr">24 </span> <span class="Type">complex</span><Floattype> b(<span class="Constant">0.0f</span>, <span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>); <span class="Comment">// Upper limit</span>
+<span id="L25" class="LineNr">25 </span> cout << <span class="Constant">"Integration path: b-a = "</span> << b-a << <span class="Special">'\n'</span>;
+<span id="L26" class="LineNr">26 </span> Inttype n_eqs = <span class="Constant">2</span>; <span class="Comment">// Number of equations in ODE system</span>
+<span id="L27" class="LineNr">27 </span> vector<<span class="Type">complex</span><Floattype> > y_start(n_eqs);
+<span id="L28" class="LineNr">28 </span> <span class="Type">complex</span><Floattype> y0(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>);
+<span id="L29" class="LineNr">29 </span> <span class="Type">complex</span><Floattype> y1(<span class="Constant">1.0f</span>, <span class="Constant">1.0f</span>);
+<span id="L30" class="LineNr">30 </span> y_start[<span class="Constant">0</span>] = y0;
+<span id="L31" class="LineNr">31 </span> y_start[<span class="Constant">1</span>] = y1;
+<span id="L32" class="LineNr">32 </span> Floattype h_start = <span class="Constant">0.01f</span>;
+<span id="L33" class="LineNr">33 </span> ODE imagode(func1, <span class="Comment">// ODE system</span>
+<span id="L34" class="LineNr">34 </span> y_start, <span class="Comment">// Initial values</span>
+<span id="L35" class="LineNr">35 </span> a, <span class="Comment">// Lower limit</span>
+<span id="L36" class="LineNr">36 </span> b, <span class="Comment">// Upper limit</span>
+<span id="L37" class="LineNr">37 </span> h_start, <span class="Comment">// Start value of step size</span>
+<span id="L38" class="LineNr">38 </span> <span class="Constant">10000</span>, <span class="Comment">// Max. number of steps</span>
+<span id="L39" class="LineNr">39 </span> eps_machine*<span class="Constant">1e12f</span>, <span class="Comment">// Absolute precision</span>
+<span id="L40" class="LineNr">40 </span> eps_machine*<span class="Constant">1e12f</span>); <span class="Comment">// Relative precision</span>
+<span id="L41" class="LineNr">41 </span> imagode.write(<span class="Constant">"funcB.dat"</span>); <span class="Comment">// Write solutions to data file</span>
+<span id="L42" class="LineNr">42 </span>
+<span id="L43" class="LineNr">43 </span> <span class="Comment">// Report to stdout</span>
+<span id="L44" class="LineNr">44 </span> cout << <span class="Constant">"ODE system solved in "</span>
+<span id="L45" class="LineNr">45 </span> << imagode.steps() << <span class="Constant">" steps.</span><span class="Special">\n\n</span><span class="Constant">"</span>;
+<span id="L46" class="LineNr">46 </span>
+<span id="L47" class="LineNr">47 </span> <span class="Comment">// Return successfully</span>
+<span id="L48" class="LineNr">48 </span> <span class="Statement">return</span> <span class="Constant">0</span>;
+<span id="L49" class="LineNr">49 </span>}
+<span id="L50" class="LineNr">50 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/mainC.cpp.html b/exam/html/mainC.cpp.html
t@@ -3,76 +3,108 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/mainC.cpp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Special { color: #ff40ff; }
-.Statement { color: #ffff00; }
-.Comment { color: #00ffff; }
-.Type { color: #00ff00; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.PreProc { color: #c000c0; }
+.Constant { color: #af5f00; }
+.Special { color: #c000c0; }
+.Comment { color: #008080; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
-<span class="lnr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
-<span class="lnr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
-<span class="lnr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span>
-<span class="lnr"> 5 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
-<span class="lnr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"check.h"</span>
-<span class="lnr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
-<span class="lnr"> 8 </span><span class="PreProc">#include </span><span class="Constant">"functions.h"</span>
-<span class="lnr"> 9 </span>
-<span class="lnr">10 </span><span class="Type">int</span> main()
-<span class="lnr">11 </span>{
-<span class="lnr">12 </span> <span class="Comment">// Namespace declarations</span>
-<span class="lnr">13 </span> <span class="Statement">using</span> std::cout;
-<span class="lnr">14 </span> <span class="Statement">using</span> std::vector;
-<span class="lnr">15 </span> <span class="Statement">using</span> std::complex;
-<span class="lnr">16 </span>
-<span class="lnr">17 </span> <span class="Comment">// Calculate machine precision</span>
-<span class="lnr">18 </span> Floattype eps_machine = <span class="Constant">1.0f</span>;
-<span class="lnr">19 </span> <span class="Statement">while</span> (<span class="Constant">1.0f</span> + eps_machine != <span class="Constant">1.0f</span>)
-<span class="lnr">20 </span> eps_machine /= <span class="Constant">2.0f</span>;
-<span class="lnr">21 </span>
-<span class="lnr">22 </span> cout << <span class="Constant">"</span><span class="Special">\n\033</span><span class="Constant">[1;33m--- Part C: Solving along a complex path ---</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">23 </span> <span class="Type">complex</span><Floattype> a(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Lower limit</span>
-<span class="lnr">24 </span> <span class="Type">complex</span><Floattype> b(<span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>, <span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>); <span class="Comment">// Upper limit</span>
-<span class="lnr">25 </span> cout << <span class="Constant">"Integration path: b-a = "</span> << b-a << <span class="Special">'\n'</span>;
-<span class="lnr">26 </span> Inttype n_eqs = <span class="Constant">2</span>; <span class="Comment">// Number of equations in ODE system</span>
-<span class="lnr">27 </span> vector<<span class="Type">complex</span><Floattype> > y_start(n_eqs);
-<span class="lnr">28 </span> <span class="Type">complex</span><Floattype> y0(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>);
-<span class="lnr">29 </span> <span class="Type">complex</span><Floattype> y1(<span class="Constant">1.0f</span>, <span class="Constant">1.0f</span>);
-<span class="lnr">30 </span> y_start[<span class="Constant">0</span>] = y0;
-<span class="lnr">31 </span> y_start[<span class="Constant">1</span>] = y1;
-<span class="lnr">32 </span> Floattype h_start = <span class="Constant">0.01f</span>;
-<span class="lnr">33 </span> ODE ode(func1, <span class="Comment">// ODE system</span>
-<span class="lnr">34 </span> y_start, <span class="Comment">// Initial values</span>
-<span class="lnr">35 </span> a, <span class="Comment">// Lower limit</span>
-<span class="lnr">36 </span> b, <span class="Comment">// Upper limit</span>
-<span class="lnr">37 </span> h_start, <span class="Comment">// Start value of step size</span>
-<span class="lnr">38 </span> <span class="Constant">10000</span>, <span class="Comment">// Max. number of steps</span>
-<span class="lnr">39 </span> eps_machine*<span class="Constant">1e12f</span>, <span class="Comment">// Absolute precision</span>
-<span class="lnr">40 </span> eps_machine*<span class="Constant">1e12f</span>); <span class="Comment">// Relative precision</span>
-<span class="lnr">41 </span> ode.write(<span class="Constant">"funcC.dat"</span>); <span class="Comment">// Write solutions to data file</span>
-<span class="lnr">42 </span>
-<span class="lnr">43 </span> <span class="Comment">// Report to stdout</span>
-<span class="lnr">44 </span> cout << <span class="Constant">"ODE system solved in "</span>
-<span class="lnr">45 </span> << ode.steps() << <span class="Constant">" steps.</span><span class="Special">\n\n</span><span class="Constant">"</span>;
-<span class="lnr">46 </span>
-<span class="lnr">47 </span> <span class="Comment">// Return successfully</span>
-<span class="lnr">48 </span> <span class="Statement">return</span> <span class="Constant">0</span>;
-<span class="lnr">49 </span>}
-<span class="lnr">50 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
+<span id="L4" class="LineNr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span>
+<span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
+<span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"check.h"</span>
+<span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
+<span id="L8" class="LineNr"> 8 </span><span class="PreProc">#include </span><span class="Constant">"functions.h"</span>
+<span id="L9" class="LineNr"> 9 </span>
+<span id="L10" class="LineNr">10 </span><span class="Type">int</span> main()
+<span id="L11" class="LineNr">11 </span>{
+<span id="L12" class="LineNr">12 </span> <span class="Comment">// Namespace declarations</span>
+<span id="L13" class="LineNr">13 </span> <span class="Statement">using</span> std::cout;
+<span id="L14" class="LineNr">14 </span> <span class="Statement">using</span> std::vector;
+<span id="L15" class="LineNr">15 </span> <span class="Statement">using</span> std::<span class="Type">complex</span>;
+<span id="L16" class="LineNr">16 </span>
+<span id="L17" class="LineNr">17 </span> <span class="Comment">// Calculate machine precision</span>
+<span id="L18" class="LineNr">18 </span> Floattype eps_machine = <span class="Constant">1.0f</span>;
+<span id="L19" class="LineNr">19 </span> <span class="Statement">while</span> (<span class="Constant">1.0f</span> + eps_machine != <span class="Constant">1.0f</span>)
+<span id="L20" class="LineNr">20 </span> eps_machine /= <span class="Constant">2.0f</span>;
+<span id="L21" class="LineNr">21 </span>
+<span id="L22" class="LineNr">22 </span> cout << <span class="Constant">"</span><span class="Special">\n\033</span><span class="Constant">[1;33m--- Part C: Solving along a complex path ---</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L23" class="LineNr">23 </span> <span class="Type">complex</span><Floattype> a(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Lower limit</span>
+<span id="L24" class="LineNr">24 </span> <span class="Type">complex</span><Floattype> b(<span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>, <span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>); <span class="Comment">// Upper limit</span>
+<span id="L25" class="LineNr">25 </span> cout << <span class="Constant">"Integration path: b-a = "</span> << b-a << <span class="Special">'\n'</span>;
+<span id="L26" class="LineNr">26 </span> Inttype n_eqs = <span class="Constant">2</span>; <span class="Comment">// Number of equations in ODE system</span>
+<span id="L27" class="LineNr">27 </span> vector<<span class="Type">complex</span><Floattype> > y_start(n_eqs);
+<span id="L28" class="LineNr">28 </span> <span class="Type">complex</span><Floattype> y0(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>);
+<span id="L29" class="LineNr">29 </span> <span class="Type">complex</span><Floattype> y1(<span class="Constant">1.0f</span>, <span class="Constant">1.0f</span>);
+<span id="L30" class="LineNr">30 </span> y_start[<span class="Constant">0</span>] = y0;
+<span id="L31" class="LineNr">31 </span> y_start[<span class="Constant">1</span>] = y1;
+<span id="L32" class="LineNr">32 </span> Floattype h_start = <span class="Constant">0.01f</span>;
+<span id="L33" class="LineNr">33 </span> ODE ode(func1, <span class="Comment">// ODE system</span>
+<span id="L34" class="LineNr">34 </span> y_start, <span class="Comment">// Initial values</span>
+<span id="L35" class="LineNr">35 </span> a, <span class="Comment">// Lower limit</span>
+<span id="L36" class="LineNr">36 </span> b, <span class="Comment">// Upper limit</span>
+<span id="L37" class="LineNr">37 </span> h_start, <span class="Comment">// Start value of step size</span>
+<span id="L38" class="LineNr">38 </span> <span class="Constant">10000</span>, <span class="Comment">// Max. number of steps</span>
+<span id="L39" class="LineNr">39 </span> eps_machine*<span class="Constant">1e12f</span>, <span class="Comment">// Absolute precision</span>
+<span id="L40" class="LineNr">40 </span> eps_machine*<span class="Constant">1e12f</span>); <span class="Comment">// Relative precision</span>
+<span id="L41" class="LineNr">41 </span> ode.write(<span class="Constant">"funcC.dat"</span>); <span class="Comment">// Write solutions to data file</span>
+<span id="L42" class="LineNr">42 </span>
+<span id="L43" class="LineNr">43 </span> <span class="Comment">// Report to stdout</span>
+<span id="L44" class="LineNr">44 </span> cout << <span class="Constant">"ODE system solved in "</span>
+<span id="L45" class="LineNr">45 </span> << ode.steps() << <span class="Constant">" steps.</span><span class="Special">\n\n</span><span class="Constant">"</span>;
+<span id="L46" class="LineNr">46 </span>
+<span id="L47" class="LineNr">47 </span> <span class="Comment">// Return successfully</span>
+<span id="L48" class="LineNr">48 </span> <span class="Statement">return</span> <span class="Constant">0</span>;
+<span id="L49" class="LineNr">49 </span>}
+<span id="L50" class="LineNr">50 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/mainD.cpp.html b/exam/html/mainD.cpp.html
t@@ -3,94 +3,126 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/mainD.cpp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Special { color: #ff40ff; }
-.Statement { color: #ffff00; }
-.Comment { color: #00ffff; }
-.Type { color: #00ff00; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.PreProc { color: #c000c0; }
+.Constant { color: #af5f00; }
+.Special { color: #c000c0; }
+.Comment { color: #008080; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
-<span class="lnr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
-<span class="lnr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
-<span class="lnr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span>
-<span class="lnr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><fstream></span>
-<span class="lnr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
-<span class="lnr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"check.h"</span>
-<span class="lnr"> 8 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
-<span class="lnr"> 9 </span><span class="PreProc">#include </span><span class="Constant">"functions.h"</span>
-<span class="lnr">10 </span>
-<span class="lnr">11 </span>
-<span class="lnr">12 </span><span class="Type">int</span> main()
-<span class="lnr">13 </span>{
-<span class="lnr">14 </span> <span class="Comment">// Namespace declarations</span>
-<span class="lnr">15 </span> <span class="Statement">using</span> std::cout;
-<span class="lnr">16 </span> <span class="Statement">using</span> std::vector;
-<span class="lnr">17 </span> <span class="Statement">using</span> std::complex;
-<span class="lnr">18 </span>
-<span class="lnr">19 </span> <span class="Comment">// Calculate machine precision</span>
-<span class="lnr">20 </span> Floattype eps_machine = <span class="Constant">1.0f</span>;
-<span class="lnr">21 </span> <span class="Statement">while</span> (<span class="Constant">1.0f</span> + eps_machine != <span class="Constant">1.0f</span>)
-<span class="lnr">22 </span> eps_machine /= <span class="Constant">2.0f</span>;
-<span class="lnr">23 </span>
-<span class="lnr">24 </span> cout << <span class="Constant">"</span><span class="Special">\n\033</span><span class="Constant">[1;33m--- Part D: Precision analysis ---</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">25 </span> <span class="Type">complex</span><Floattype> a(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Lower limit</span>
-<span class="lnr">26 </span> <span class="Type">complex</span><Floattype> b(<span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>, <span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>); <span class="Comment">// Upper limit</span>
-<span class="lnr">27 </span> cout << <span class="Constant">"Integration path: b-a = "</span> << b-a << <span class="Special">'\n'</span>;
-<span class="lnr">28 </span> Inttype n_eqs = <span class="Constant">2</span>; <span class="Comment">// Number of equations in ODE system</span>
-<span class="lnr">29 </span> vector<<span class="Type">complex</span><Floattype> > y_start(n_eqs);
-<span class="lnr">30 </span> <span class="Type">complex</span><Floattype> y0(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>);
-<span class="lnr">31 </span> <span class="Type">complex</span><Floattype> y1(<span class="Constant">1.0f</span>, <span class="Constant">1.0f</span>);
-<span class="lnr">32 </span> y_start[<span class="Constant">0</span>] = y0;
-<span class="lnr">33 </span> y_start[<span class="Constant">1</span>] = y1;
-<span class="lnr">34 </span> Floattype h_start = <span class="Constant">0.01f</span>;
-<span class="lnr">35 </span>
-<span class="lnr">36 </span> vector<Floattype> precs; <span class="Comment">// Vector containing precision values</span>
-<span class="lnr">37 </span> vector<Inttype> steps; <span class="Comment">// Vector containing number of steps required</span>
-<span class="lnr">38 </span>
-<span class="lnr">39 </span> <span class="Statement">for</span> (Floattype prec=eps_machine*<span class="Constant">10.0f</span>; prec<<span class="Constant">0.1f</span>; prec *= <span class="Constant">10.0f</span>) {
-<span class="lnr">40 </span> ODE ode(func1, <span class="Comment">// ODE system</span>
-<span class="lnr">41 </span> y_start, <span class="Comment">// Initial values</span>
-<span class="lnr">42 </span> a, <span class="Comment">// Lower limit</span>
-<span class="lnr">43 </span> b, <span class="Comment">// Upper limit</span>
-<span class="lnr">44 </span> h_start, <span class="Comment">// Start value of step size</span>
-<span class="lnr">45 </span> <span class="Constant">100000</span>, <span class="Comment">// Max. number of steps</span>
-<span class="lnr">46 </span> prec, <span class="Comment">// Absolute precision</span>
-<span class="lnr">47 </span> prec); <span class="Comment">// Relative precision</span>
-<span class="lnr">48 </span> precs.push_back(prec); <span class="Comment">// Save precision</span>
-<span class="lnr">49 </span> steps.push_back(ode.steps()); <span class="Comment">// Save number of steps taken</span>
-<span class="lnr">50 </span> }
-<span class="lnr">51 </span>
-<span class="lnr">52 </span> <span class="Comment">// Save results to text file</span>
-<span class="lnr">53 </span> std::ofstream ost; <span class="Comment">// Out stream object</span>
-<span class="lnr">54 </span> ost.open(<span class="Constant">"funcD.dat"</span>); <span class="Comment">// Open outfile for write</span>
-<span class="lnr">55 </span> <span class="Statement">if</span> (!ost) {
-<span class="lnr">56 </span> std::cerr << <span class="Constant">"Error, can't open output file!</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">57 </span> <span class="Statement">return</span> <span class="Constant">1</span>;
-<span class="lnr">58 </span> }
-<span class="lnr">59 </span> <span class="Comment">// Write output values</span>
-<span class="lnr">60 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<precs.size(); ++i)
-<span class="lnr">61 </span> ost << precs[i] << <span class="Special">'\t'</span> << steps[i] << <span class="Special">'\n'</span>;
-<span class="lnr">62 </span>
-<span class="lnr">63 </span> <span class="Comment">// Close file</span>
-<span class="lnr">64 </span> ost.close();
-<span class="lnr">65 </span>
-<span class="lnr">66 </span> <span class="Comment">// Return successfully</span>
-<span class="lnr">67 </span> <span class="Statement">return</span> <span class="Constant">0</span>;
-<span class="lnr">68 </span>}
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
+<span id="L4" class="LineNr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span>
+<span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><fstream></span>
+<span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
+<span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"check.h"</span>
+<span id="L8" class="LineNr"> 8 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
+<span id="L9" class="LineNr"> 9 </span><span class="PreProc">#include </span><span class="Constant">"functions.h"</span>
+<span id="L10" class="LineNr">10 </span>
+<span id="L11" class="LineNr">11 </span>
+<span id="L12" class="LineNr">12 </span><span class="Type">int</span> main()
+<span id="L13" class="LineNr">13 </span>{
+<span id="L14" class="LineNr">14 </span> <span class="Comment">// Namespace declarations</span>
+<span id="L15" class="LineNr">15 </span> <span class="Statement">using</span> std::cout;
+<span id="L16" class="LineNr">16 </span> <span class="Statement">using</span> std::vector;
+<span id="L17" class="LineNr">17 </span> <span class="Statement">using</span> std::<span class="Type">complex</span>;
+<span id="L18" class="LineNr">18 </span>
+<span id="L19" class="LineNr">19 </span> <span class="Comment">// Calculate machine precision</span>
+<span id="L20" class="LineNr">20 </span> Floattype eps_machine = <span class="Constant">1.0f</span>;
+<span id="L21" class="LineNr">21 </span> <span class="Statement">while</span> (<span class="Constant">1.0f</span> + eps_machine != <span class="Constant">1.0f</span>)
+<span id="L22" class="LineNr">22 </span> eps_machine /= <span class="Constant">2.0f</span>;
+<span id="L23" class="LineNr">23 </span>
+<span id="L24" class="LineNr">24 </span> cout << <span class="Constant">"</span><span class="Special">\n\033</span><span class="Constant">[1;33m--- Part D: Precision analysis ---</span><span class="Special">\033</span><span class="Constant">[0m</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L25" class="LineNr">25 </span> <span class="Type">complex</span><Floattype> a(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>); <span class="Comment">// Lower limit</span>
+<span id="L26" class="LineNr">26 </span> <span class="Type">complex</span><Floattype> b(<span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>, <span class="Constant">2.0f</span>*<span class="Constant">M_PI</span>); <span class="Comment">// Upper limit</span>
+<span id="L27" class="LineNr">27 </span> cout << <span class="Constant">"Integration path: b-a = "</span> << b-a << <span class="Special">'\n'</span>;
+<span id="L28" class="LineNr">28 </span> Inttype n_eqs = <span class="Constant">2</span>; <span class="Comment">// Number of equations in ODE system</span>
+<span id="L29" class="LineNr">29 </span> vector<<span class="Type">complex</span><Floattype> > y_start(n_eqs);
+<span id="L30" class="LineNr">30 </span> <span class="Type">complex</span><Floattype> y0(<span class="Constant">0.0f</span>, <span class="Constant">0.0f</span>);
+<span id="L31" class="LineNr">31 </span> <span class="Type">complex</span><Floattype> y1(<span class="Constant">1.0f</span>, <span class="Constant">1.0f</span>);
+<span id="L32" class="LineNr">32 </span> y_start[<span class="Constant">0</span>] = y0;
+<span id="L33" class="LineNr">33 </span> y_start[<span class="Constant">1</span>] = y1;
+<span id="L34" class="LineNr">34 </span> Floattype h_start = <span class="Constant">0.01f</span>;
+<span id="L35" class="LineNr">35 </span>
+<span id="L36" class="LineNr">36 </span> vector<Floattype> precs; <span class="Comment">// Vector containing precision values</span>
+<span id="L37" class="LineNr">37 </span> vector<Inttype> steps; <span class="Comment">// Vector containing number of steps required</span>
+<span id="L38" class="LineNr">38 </span>
+<span id="L39" class="LineNr">39 </span> <span class="Statement">for</span> (Floattype prec=eps_machine*<span class="Constant">10.0f</span>; prec<<span class="Constant">0.1f</span>; prec *= <span class="Constant">10.0f</span>) {
+<span id="L40" class="LineNr">40 </span> ODE ode(func1, <span class="Comment">// ODE system</span>
+<span id="L41" class="LineNr">41 </span> y_start, <span class="Comment">// Initial values</span>
+<span id="L42" class="LineNr">42 </span> a, <span class="Comment">// Lower limit</span>
+<span id="L43" class="LineNr">43 </span> b, <span class="Comment">// Upper limit</span>
+<span id="L44" class="LineNr">44 </span> h_start, <span class="Comment">// Start value of step size</span>
+<span id="L45" class="LineNr">45 </span> <span class="Constant">100000</span>, <span class="Comment">// Max. number of steps</span>
+<span id="L46" class="LineNr">46 </span> prec, <span class="Comment">// Absolute precision</span>
+<span id="L47" class="LineNr">47 </span> prec); <span class="Comment">// Relative precision</span>
+<span id="L48" class="LineNr">48 </span> precs.push_back(prec); <span class="Comment">// Save precision</span>
+<span id="L49" class="LineNr">49 </span> steps.push_back(ode.steps()); <span class="Comment">// Save number of steps taken</span>
+<span id="L50" class="LineNr">50 </span> }
+<span id="L51" class="LineNr">51 </span>
+<span id="L52" class="LineNr">52 </span> <span class="Comment">// Save results to text file</span>
+<span id="L53" class="LineNr">53 </span> std::ofstream ost; <span class="Comment">// Out stream object</span>
+<span id="L54" class="LineNr">54 </span> ost.open(<span class="Constant">"funcD.dat"</span>); <span class="Comment">// Open outfile for write</span>
+<span id="L55" class="LineNr">55 </span> <span class="Statement">if</span> (!ost) {
+<span id="L56" class="LineNr">56 </span> std::cerr << <span class="Constant">"Error, can't open output file!</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L57" class="LineNr">57 </span> <span class="Statement">return</span> <span class="Constant">1</span>;
+<span id="L58" class="LineNr">58 </span> }
+<span id="L59" class="LineNr">59 </span> <span class="Comment">// Write output values</span>
+<span id="L60" class="LineNr">60 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<precs.size(); ++i)
+<span id="L61" class="LineNr">61 </span> ost << precs[i] << <span class="Special">'\t'</span> << steps[i] << <span class="Special">'\n'</span>;
+<span id="L62" class="LineNr">62 </span>
+<span id="L63" class="LineNr">63 </span> <span class="Comment">// Close file</span>
+<span id="L64" class="LineNr">64 </span> ost.close();
+<span id="L65" class="LineNr">65 </span>
+<span id="L66" class="LineNr">66 </span> <span class="Comment">// Return successfully</span>
+<span id="L67" class="LineNr">67 </span> <span class="Statement">return</span> <span class="Constant">0</span>;
+<span id="L68" class="LineNr">68 </span>}
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/ode.cpp.html b/exam/html/ode.cpp.html
t@@ -3,189 +3,221 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/ode.cpp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Special { color: #ff40ff; }
-.Statement { color: #ffff00; }
-.Type { color: #00ff00; }
-.Comment { color: #00ffff; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.PreProc { color: #c000c0; }
+.Constant { color: #af5f00; }
+.Special { color: #c000c0; }
+.Comment { color: #008080; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
-<span class="lnr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
-<span class="lnr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span> <span class="Comment">// for sqrt and pow</span>
-<span class="lnr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><fstream></span>
-<span class="lnr"> 5 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
-<span class="lnr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
-<span class="lnr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"vector_arithmetic.h"</span>
-<span class="lnr"> 8 </span>
-<span class="lnr"> 9 </span><span class="Comment">// Constructor</span>
-<span class="lnr"> 10 </span>ODE::ODE(std::vector<std::complex<Floattype> >
-<span class="lnr"> 11 </span> (*f_in)(<span class="Type">const</span> std::complex<Floattype> x,
-<span class="lnr"> 12 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > &y),
-<span class="lnr"> 13 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > y_start,
-<span class="lnr"> 14 </span> <span class="Type">const</span> std::complex<Floattype> a_in,
-<span class="lnr"> 15 </span> <span class="Type">const</span> std::complex<Floattype> b_in,
-<span class="lnr"> 16 </span> <span class="Type">const</span> Floattype h_start,
-<span class="lnr"> 17 </span> <span class="Type">const</span> Inttype max_steps,
-<span class="lnr"> 18 </span> <span class="Type">const</span> Floattype delta_in,
-<span class="lnr"> 19 </span> <span class="Type">const</span> Floattype epsilon_in,
-<span class="lnr"> 20 </span> <span class="Type">const</span> Floattype power_in,
-<span class="lnr"> 21 </span> <span class="Type">const</span> Floattype safety_in)
-<span class="lnr"> 22 </span> : f(f_in),
-<span class="lnr"> 23 </span> a(a_in), b(b_in),
-<span class="lnr"> 24 </span> h((b_in-a_in)*h_start),
-<span class="lnr"> 25 </span> n_max(max_steps),
-<span class="lnr"> 26 </span> delta(delta_in), epsilon(epsilon_in),
-<span class="lnr"> 27 </span> power(power_in), safety(safety_in)
-<span class="lnr"> 28 </span>{
-<span class="lnr"> 29 </span> x_list.push_back(a);
-<span class="lnr"> 30 </span> y_list.push_back(y_start);
-<span class="lnr"> 31 </span>
-<span class="lnr"> 32 </span> <span class="Comment">// Perform integration</span>
-<span class="lnr"> 33 </span> rkdriver();
-<span class="lnr"> 34 </span>}
-<span class="lnr"> 35 </span>
-<span class="lnr"> 36 </span>
-<span class="lnr"> 37 </span><span class="Comment">// Estimate tolerance</span>
-<span class="lnr"> 38 </span>Floattype ODE::tau(<span class="Type">const</span> std::vector<std::complex<Floattype> > &y,
-<span class="lnr"> 39 </span> <span class="Type">const</span> std::complex<Floattype> h_i)
-<span class="lnr"> 40 </span>{
-<span class="lnr"> 41 </span> <span class="Statement">return</span> abs((epsilon * cnorm(y) + delta) * sqrt(h_i/(b-a)));
-<span class="lnr"> 42 </span>}
-<span class="lnr"> 43 </span>
-<span class="lnr"> 44 </span><span class="Comment">// Runge-Kutta mid-point stepper</span>
-<span class="lnr"> 45 </span><span class="Type">void</span> ODE::rkstep12(<span class="Type">const</span> std::complex<Floattype> x0,
-<span class="lnr"> 46 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > &y0,
-<span class="lnr"> 47 </span> std::vector<std::complex<Floattype> > &y1,
-<span class="lnr"> 48 </span> std::vector<std::complex<Floattype> > &dy)
-<span class="lnr"> 49 </span>{
-<span class="lnr"> 50 </span> <span class="Comment">// Denominator 2 used in arithmetic operations</span>
-<span class="lnr"> 51 </span> <span class="Type">const</span> std::complex<Floattype> den2 (<span class="Constant">2.0f</span>,<span class="Constant">2.0f</span>);
-<span class="lnr"> 52 </span>
-<span class="lnr"> 53 </span> <span class="Comment">// Evaluate function at two points</span>
-<span class="lnr"> 54 </span> (<span class="Type">void</span>)f(x0,y0);
-<span class="lnr"> 55 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > k0 = f(x0,y0);
-<span class="lnr"> 56 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > k12 = f(x0 + h/den2, y0 + k0*h/den2);
-<span class="lnr"> 57 </span>
-<span class="lnr"> 58 </span> <span class="Comment">// Write results to output vectors</span>
-<span class="lnr"> 59 </span> y1 = y0 + k12*h;
-<span class="lnr"> 60 </span> dy = (k0 - k12) * h/den2;
-<span class="lnr"> 61 </span>}
-<span class="lnr"> 62 </span>
-<span class="lnr"> 63 </span>
-<span class="lnr"> 64 </span><span class="Comment">// ODE driver with adaptive step size control</span>
-<span class="lnr"> 65 </span><span class="Type">void</span> ODE::rkdriver()
-<span class="lnr"> 66 </span>{
-<span class="lnr"> 67 </span> std::vector<std::complex<Floattype> > dy(n_max);
-<span class="lnr"> 68 </span> std::vector<std::complex<Floattype> > y1(n_max);
-<span class="lnr"> 69 </span>
-<span class="lnr"> 70 </span> std::complex<Floattype> x;
-<span class="lnr"> 71 </span> Floattype err, tol;
-<span class="lnr"> 72 </span> std::vector<std::complex<Floattype> > y;
-<span class="lnr"> 73 </span>
-<span class="lnr"> 74 </span> <span class="Statement">while</span> (x_list.back().real() < b.real()
-<span class="lnr"> 75 </span> || x_list.back().imag() < b.imag())
-<span class="lnr"> 76 </span> {
-<span class="lnr"> 77 </span> <span class="Comment">// Get values for this step</span>
-<span class="lnr"> 78 </span> x = x_list.back();
-<span class="lnr"> 79 </span> y = y_list.back();
-<span class="lnr"> 80 </span>
-<span class="lnr"> 81 </span> <span class="Comment">// Make sure we don't step past the upper boundary</span>
-<span class="lnr"> 82 </span> <span class="Statement">if</span> ((x + h).real() > b.real()
-<span class="lnr"> 83 </span> || (x + h).imag() > b.imag())
-<span class="lnr"> 84 </span> h = b - x;
-<span class="lnr"> 85 </span>
-<span class="lnr"> 86 </span> <span class="Comment">// Run Runge-Kutta mid-point stepper</span>
-<span class="lnr"> 87 </span> rkstep12(x, y, y1, dy);
-<span class="lnr"> 88 </span>
-<span class="lnr"> 89 </span> <span class="Comment">// Determine whether the step should be accepted</span>
-<span class="lnr"> 90 </span> err = cnorm(dy); <span class="Comment">// Error estimate</span>
-<span class="lnr"> 91 </span> tol = tau(y, h); <span class="Comment">// Tolerance</span>
-<span class="lnr"> 92 </span> <span class="Statement">if</span> (err < tol) { <span class="Comment">// Step accepted</span>
-<span class="lnr"> 93 </span> x_list.push_back(x+h);
-<span class="lnr"> 94 </span> y_list.push_back(y1);
-<span class="lnr"> 95 </span> }
-<span class="lnr"> 96 </span>
-<span class="lnr"> 97 </span> <span class="Comment">// Check that we havn't hit the max. number of steps</span>
-<span class="lnr"> 98 </span> <span class="Statement">if</span> (x_list.size() == n_max) {
-<span class="lnr"> 99 </span> std::cerr << <span class="Constant">"Error, the max. number of steps "</span>
-<span class="lnr">100 </span> << <span class="Constant">"was insufficient</span><span class="Special">\n</span><span class="Constant">"</span>
-<span class="lnr">101 </span> << <span class="Constant">"Try either increasing the max. number "</span>
-<span class="lnr">102 </span> << <span class="Constant">"of steps, or decreasing the precision "</span>
-<span class="lnr">103 </span> << <span class="Constant">"requirements</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">104 </span> <span class="Statement">return</span>;
-<span class="lnr">105 </span> }
-<span class="lnr">106 </span>
-<span class="lnr">107 </span> <span class="Comment">// Determine new step size</span>
-<span class="lnr">108 </span> std::complex<Floattype> multiplicator (<span class="Constant">2.0f</span>, <span class="Constant">2.0f</span>);
-<span class="lnr">109 </span> <span class="Statement">if</span> (err > <span class="Constant">0.0f</span>)
-<span class="lnr">110 </span> h = h*pow(tol/err, power) * safety;
-<span class="lnr">111 </span> <span class="Statement">else</span>
-<span class="lnr">112 </span> h = multiplicator*h;
-<span class="lnr">113 </span> }
-<span class="lnr">114 </span>}
-<span class="lnr">115 </span>
-<span class="lnr">116 </span>
-<span class="lnr">117 </span><span class="Comment">// Return the number of steps taken</span>
-<span class="lnr">118 </span>Inttype ODE::steps()
-<span class="lnr">119 </span>{
-<span class="lnr">120 </span> <span class="Statement">return</span> x_list.size();
-<span class="lnr">121 </span>}
-<span class="lnr">122 </span>
-<span class="lnr">123 </span><span class="Type">void</span> ODE::print()
-<span class="lnr">124 </span>{
-<span class="lnr">125 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<x_list.size(); ++i) {
-<span class="lnr">126 </span> std::cout << x_list[i] << <span class="Special">'\t'</span>;
-<span class="lnr">127 </span> <span class="Statement">for</span> (Inttype j=<span class="Constant">0</span>; j<y_list[<span class="Constant">0</span>].size(); ++j)
-<span class="lnr">128 </span> std::cout << y_list[i][j] << <span class="Special">'\t'</span>;
-<span class="lnr">129 </span> std::cout << <span class="Special">'\n'</span>;
-<span class="lnr">130 </span> }
-<span class="lnr">131 </span>}
-<span class="lnr">132 </span>
-<span class="lnr">133 </span><span class="Comment">// Write the x- and y-values to file</span>
-<span class="lnr">134 </span><span class="Type">void</span> ODE::write(<span class="Type">const</span> <span class="Type">char</span>* filename)
-<span class="lnr">135 </span>{
-<span class="lnr">136 </span> std::ofstream outstream;
-<span class="lnr">137 </span>
-<span class="lnr">138 </span> <span class="Comment">// Open outfile for write</span>
-<span class="lnr">139 </span> outstream.open(filename);
-<span class="lnr">140 </span> <span class="Statement">if</span> (!outstream) {
-<span class="lnr">141 </span> std::cerr << <span class="Constant">"Error, can't open output file '"</span>
-<span class="lnr">142 </span> << filename << <span class="Constant">"'.</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">143 </span> <span class="Statement">return</span>;
-<span class="lnr">144 </span> }
-<span class="lnr">145 </span>
-<span class="lnr">146 </span> <span class="Comment">// Write output values</span>
-<span class="lnr">147 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<x_list.size(); ++i) {
-<span class="lnr">148 </span> outstream << x_list[i].real() << <span class="Special">'\t'</span>;
-<span class="lnr">149 </span> outstream << x_list[i].imag() << <span class="Special">'\t'</span>;
-<span class="lnr">150 </span> <span class="Statement">for</span> (Inttype j=<span class="Constant">0</span>; j<y_list[<span class="Constant">0</span>].size(); ++j) {
-<span class="lnr">151 </span> outstream << y_list[i][j].real() << <span class="Special">'\t'</span>;
-<span class="lnr">152 </span> outstream << y_list[i][j].imag() << <span class="Special">'\t'</span>;
-<span class="lnr">153 </span> }
-<span class="lnr">154 </span> outstream << <span class="Special">'\n'</span>;
-<span class="lnr">155 </span> }
-<span class="lnr">156 </span>
-<span class="lnr">157 </span> <span class="Comment">// Close file</span>
-<span class="lnr">158 </span> outstream.close();
-<span class="lnr">159 </span>
-<span class="lnr">160 </span> <span class="Statement">if</span> (verbose == <span class="Constant">true</span>)
-<span class="lnr">161 </span> std::cout << <span class="Constant">"Output written in '"</span> << filename << <span class="Constant">"'.</span><span class="Special">\n</span><span class="Constant">"</span>;
-<span class="lnr">162 </span>}
-<span class="lnr">163 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span> <span class="Comment">// for sqrt and pow</span>
+<span id="L4" class="LineNr"> 4 </span><span class="PreProc">#include </span><span class="Constant"><fstream></span>
+<span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
+<span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant">"ode.h"</span>
+<span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"vector_arithmetic.h"</span>
+<span id="L8" class="LineNr"> 8 </span>
+<span id="L9" class="LineNr"> 9 </span><span class="Comment">// Constructor</span>
+<span id="L10" class="LineNr"> 10 </span>ODE::ODE(std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L11" class="LineNr"> 11 </span> (*f_in)(<span class="Type">const</span> std::<span class="Type">complex</span><Floattype> x,
+<span id="L12" class="LineNr"> 12 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y),
+<span id="L13" class="LineNr"> 13 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > y_start,
+<span id="L14" class="LineNr"> 14 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> a_in,
+<span id="L15" class="LineNr"> 15 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> b_in,
+<span id="L16" class="LineNr"> 16 </span> <span class="Type">const</span> Floattype h_start,
+<span id="L17" class="LineNr"> 17 </span> <span class="Type">const</span> Inttype max_steps,
+<span id="L18" class="LineNr"> 18 </span> <span class="Type">const</span> Floattype delta_in,
+<span id="L19" class="LineNr"> 19 </span> <span class="Type">const</span> Floattype epsilon_in,
+<span id="L20" class="LineNr"> 20 </span> <span class="Type">const</span> Floattype power_in,
+<span id="L21" class="LineNr"> 21 </span> <span class="Type">const</span> Floattype safety_in)
+<span id="L22" class="LineNr"> 22 </span> : f(f_in),
+<span id="L23" class="LineNr"> 23 </span> a(a_in), b(b_in),
+<span id="L24" class="LineNr"> 24 </span> h((b_in-a_in)*h_start),
+<span id="L25" class="LineNr"> 25 </span> n_max(max_steps),
+<span id="L26" class="LineNr"> 26 </span> delta(delta_in), epsilon(epsilon_in),
+<span id="L27" class="LineNr"> 27 </span> power(power_in), safety(safety_in)
+<span id="L28" class="LineNr"> 28 </span>{
+<span id="L29" class="LineNr"> 29 </span> x_list.push_back(a);
+<span id="L30" class="LineNr"> 30 </span> y_list.push_back(y_start);
+<span id="L31" class="LineNr"> 31 </span>
+<span id="L32" class="LineNr"> 32 </span> <span class="Comment">// Perform integration</span>
+<span id="L33" class="LineNr"> 33 </span> rkdriver();
+<span id="L34" class="LineNr"> 34 </span>}
+<span id="L35" class="LineNr"> 35 </span>
+<span id="L36" class="LineNr"> 36 </span>
+<span id="L37" class="LineNr"> 37 </span><span class="Comment">// Estimate tolerance</span>
+<span id="L38" class="LineNr"> 38 </span>Floattype ODE::tau(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y,
+<span id="L39" class="LineNr"> 39 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> h_i)
+<span id="L40" class="LineNr"> 40 </span>{
+<span id="L41" class="LineNr"> 41 </span> <span class="Statement">return</span> abs((epsilon * cnorm(y) + delta) * sqrt(h_i/(b-a)));
+<span id="L42" class="LineNr"> 42 </span>}
+<span id="L43" class="LineNr"> 43 </span>
+<span id="L44" class="LineNr"> 44 </span><span class="Comment">// Runge-Kutta mid-point stepper</span>
+<span id="L45" class="LineNr"> 45 </span><span class="Type">void</span> ODE::rkstep12(<span class="Type">const</span> std::<span class="Type">complex</span><Floattype> x0,
+<span id="L46" class="LineNr"> 46 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y0,
+<span id="L47" class="LineNr"> 47 </span> std::vector<std::<span class="Type">complex</span><Floattype> > &y1,
+<span id="L48" class="LineNr"> 48 </span> std::vector<std::<span class="Type">complex</span><Floattype> > &dy)
+<span id="L49" class="LineNr"> 49 </span>{
+<span id="L50" class="LineNr"> 50 </span> <span class="Comment">// Denominator 2 used in arithmetic operations</span>
+<span id="L51" class="LineNr"> 51 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> den2 (<span class="Constant">2.0f</span>,<span class="Constant">2.0f</span>);
+<span id="L52" class="LineNr"> 52 </span>
+<span id="L53" class="LineNr"> 53 </span> <span class="Comment">// Evaluate function at two points</span>
+<span id="L54" class="LineNr"> 54 </span> (<span class="Type">void</span>)f(x0,y0);
+<span id="L55" class="LineNr"> 55 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > k0 = f(x0,y0);
+<span id="L56" class="LineNr"> 56 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > k12 = f(x0 + h/den2, y0 + k0*h/den2);
+<span id="L57" class="LineNr"> 57 </span>
+<span id="L58" class="LineNr"> 58 </span> <span class="Comment">// Write results to output vectors</span>
+<span id="L59" class="LineNr"> 59 </span> y1 = y0 + k12*h;
+<span id="L60" class="LineNr"> 60 </span> dy = (k0 - k12) * h/den2;
+<span id="L61" class="LineNr"> 61 </span>}
+<span id="L62" class="LineNr"> 62 </span>
+<span id="L63" class="LineNr"> 63 </span>
+<span id="L64" class="LineNr"> 64 </span><span class="Comment">// ODE driver with adaptive step size control</span>
+<span id="L65" class="LineNr"> 65 </span><span class="Type">void</span> ODE::rkdriver()
+<span id="L66" class="LineNr"> 66 </span>{
+<span id="L67" class="LineNr"> 67 </span> std::vector<std::<span class="Type">complex</span><Floattype> > dy(n_max);
+<span id="L68" class="LineNr"> 68 </span> std::vector<std::<span class="Type">complex</span><Floattype> > y1(n_max);
+<span id="L69" class="LineNr"> 69 </span>
+<span id="L70" class="LineNr"> 70 </span> std::<span class="Type">complex</span><Floattype> x;
+<span id="L71" class="LineNr"> 71 </span> Floattype err, tol;
+<span id="L72" class="LineNr"> 72 </span> std::vector<std::<span class="Type">complex</span><Floattype> > y;
+<span id="L73" class="LineNr"> 73 </span>
+<span id="L74" class="LineNr"> 74 </span> <span class="Statement">while</span> (x_list.back().real() < b.real()
+<span id="L75" class="LineNr"> 75 </span> || x_list.back().imag() < b.imag())
+<span id="L76" class="LineNr"> 76 </span> {
+<span id="L77" class="LineNr"> 77 </span> <span class="Comment">// Get values for this step</span>
+<span id="L78" class="LineNr"> 78 </span> x = x_list.back();
+<span id="L79" class="LineNr"> 79 </span> y = y_list.back();
+<span id="L80" class="LineNr"> 80 </span>
+<span id="L81" class="LineNr"> 81 </span> <span class="Comment">// Make sure we don't step past the upper boundary</span>
+<span id="L82" class="LineNr"> 82 </span> <span class="Statement">if</span> ((x + h).real() > b.real()
+<span id="L83" class="LineNr"> 83 </span> || (x + h).imag() > b.imag())
+<span id="L84" class="LineNr"> 84 </span> h = b - x;
+<span id="L85" class="LineNr"> 85 </span>
+<span id="L86" class="LineNr"> 86 </span> <span class="Comment">// Run Runge-Kutta mid-point stepper</span>
+<span id="L87" class="LineNr"> 87 </span> rkstep12(x, y, y1, dy);
+<span id="L88" class="LineNr"> 88 </span>
+<span id="L89" class="LineNr"> 89 </span> <span class="Comment">// Determine whether the step should be accepted</span>
+<span id="L90" class="LineNr"> 90 </span> err = cnorm(dy); <span class="Comment">// Error estimate</span>
+<span id="L91" class="LineNr"> 91 </span> tol = tau(y, h); <span class="Comment">// Tolerance</span>
+<span id="L92" class="LineNr"> 92 </span> <span class="Statement">if</span> (err < tol) { <span class="Comment">// Step accepted</span>
+<span id="L93" class="LineNr"> 93 </span> x_list.push_back(x+h);
+<span id="L94" class="LineNr"> 94 </span> y_list.push_back(y1);
+<span id="L95" class="LineNr"> 95 </span> }
+<span id="L96" class="LineNr"> 96 </span>
+<span id="L97" class="LineNr"> 97 </span> <span class="Comment">// Check that we havn't hit the max. number of steps</span>
+<span id="L98" class="LineNr"> 98 </span> <span class="Statement">if</span> (x_list.size() == n_max) {
+<span id="L99" class="LineNr"> 99 </span> std::cerr << <span class="Constant">"Error, the max. number of steps "</span>
+<span id="L100" class="LineNr">100 </span> << <span class="Constant">"was insufficient</span><span class="Special">\n</span><span class="Constant">"</span>
+<span id="L101" class="LineNr">101 </span> << <span class="Constant">"Try either increasing the max. number "</span>
+<span id="L102" class="LineNr">102 </span> << <span class="Constant">"of steps, or decreasing the precision "</span>
+<span id="L103" class="LineNr">103 </span> << <span class="Constant">"requirements</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L104" class="LineNr">104 </span> <span class="Statement">return</span>;
+<span id="L105" class="LineNr">105 </span> }
+<span id="L106" class="LineNr">106 </span>
+<span id="L107" class="LineNr">107 </span> <span class="Comment">// Determine new step size</span>
+<span id="L108" class="LineNr">108 </span> std::<span class="Type">complex</span><Floattype> multiplicator (<span class="Constant">2.0f</span>, <span class="Constant">2.0f</span>);
+<span id="L109" class="LineNr">109 </span> <span class="Statement">if</span> (err > <span class="Constant">0.0f</span>)
+<span id="L110" class="LineNr">110 </span> h = h*pow(tol/err, power) * safety;
+<span id="L111" class="LineNr">111 </span> <span class="Statement">else</span>
+<span id="L112" class="LineNr">112 </span> h = multiplicator*h;
+<span id="L113" class="LineNr">113 </span> }
+<span id="L114" class="LineNr">114 </span>}
+<span id="L115" class="LineNr">115 </span>
+<span id="L116" class="LineNr">116 </span>
+<span id="L117" class="LineNr">117 </span><span class="Comment">// Return the number of steps taken</span>
+<span id="L118" class="LineNr">118 </span>Inttype ODE::steps()
+<span id="L119" class="LineNr">119 </span>{
+<span id="L120" class="LineNr">120 </span> <span class="Statement">return</span> x_list.size();
+<span id="L121" class="LineNr">121 </span>}
+<span id="L122" class="LineNr">122 </span>
+<span id="L123" class="LineNr">123 </span><span class="Type">void</span> ODE::print()
+<span id="L124" class="LineNr">124 </span>{
+<span id="L125" class="LineNr">125 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<x_list.size(); ++i) {
+<span id="L126" class="LineNr">126 </span> std::cout << x_list[i] << <span class="Special">'\t'</span>;
+<span id="L127" class="LineNr">127 </span> <span class="Statement">for</span> (Inttype j=<span class="Constant">0</span>; j<y_list[<span class="Constant">0</span>].size(); ++j)
+<span id="L128" class="LineNr">128 </span> std::cout << y_list[i][j] << <span class="Special">'\t'</span>;
+<span id="L129" class="LineNr">129 </span> std::cout << <span class="Special">'\n'</span>;
+<span id="L130" class="LineNr">130 </span> }
+<span id="L131" class="LineNr">131 </span>}
+<span id="L132" class="LineNr">132 </span>
+<span id="L133" class="LineNr">133 </span><span class="Comment">// Write the x- and y-values to file</span>
+<span id="L134" class="LineNr">134 </span><span class="Type">void</span> ODE::write(<span class="Type">const</span> <span class="Type">char</span>* filename)
+<span id="L135" class="LineNr">135 </span>{
+<span id="L136" class="LineNr">136 </span> std::ofstream outstream;
+<span id="L137" class="LineNr">137 </span>
+<span id="L138" class="LineNr">138 </span> <span class="Comment">// Open outfile for write</span>
+<span id="L139" class="LineNr">139 </span> outstream.open(filename);
+<span id="L140" class="LineNr">140 </span> <span class="Statement">if</span> (!outstream) {
+<span id="L141" class="LineNr">141 </span> std::cerr << <span class="Constant">"Error, can't open output file '"</span>
+<span id="L142" class="LineNr">142 </span> << filename << <span class="Constant">"'.</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L143" class="LineNr">143 </span> <span class="Statement">return</span>;
+<span id="L144" class="LineNr">144 </span> }
+<span id="L145" class="LineNr">145 </span>
+<span id="L146" class="LineNr">146 </span> <span class="Comment">// Write output values</span>
+<span id="L147" class="LineNr">147 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<x_list.size(); ++i) {
+<span id="L148" class="LineNr">148 </span> outstream << x_list[i].real() << <span class="Special">'\t'</span>;
+<span id="L149" class="LineNr">149 </span> outstream << x_list[i].imag() << <span class="Special">'\t'</span>;
+<span id="L150" class="LineNr">150 </span> <span class="Statement">for</span> (Inttype j=<span class="Constant">0</span>; j<y_list[<span class="Constant">0</span>].size(); ++j) {
+<span id="L151" class="LineNr">151 </span> outstream << y_list[i][j].real() << <span class="Special">'\t'</span>;
+<span id="L152" class="LineNr">152 </span> outstream << y_list[i][j].imag() << <span class="Special">'\t'</span>;
+<span id="L153" class="LineNr">153 </span> }
+<span id="L154" class="LineNr">154 </span> outstream << <span class="Special">'\n'</span>;
+<span id="L155" class="LineNr">155 </span> }
+<span id="L156" class="LineNr">156 </span>
+<span id="L157" class="LineNr">157 </span> <span class="Comment">// Close file</span>
+<span id="L158" class="LineNr">158 </span> outstream.close();
+<span id="L159" class="LineNr">159 </span>
+<span id="L160" class="LineNr">160 </span> <span class="Statement">if</span> (verbose == <span class="Constant">true</span>)
+<span id="L161" class="LineNr">161 </span> std::cout << <span class="Constant">"Output written in '"</span> << filename << <span class="Constant">"'.</span><span class="Special">\n</span><span class="Constant">"</span>;
+<span id="L162" class="LineNr">162 </span>}
+<span id="L163" class="LineNr">163 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/ode.h.html b/exam/html/ode.h.html
t@@ -3,112 +3,144 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/ode.h.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Statement { color: #ffff00; }
-.Type { color: #00ff00; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
-.Comment { color: #00ffff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Comment { color: #008080; }
+.Constant { color: #af5f00; }
+.PreProc { color: #c000c0; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="Comment">// Make sure header is only included once</span>
-<span class="lnr"> 2 </span><span class="PreProc">#ifndef ODE_H_</span>
-<span class="lnr"> 3 </span><span class="PreProc">#define ODE_H_</span>
-<span class="lnr"> 4 </span>
-<span class="lnr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
-<span class="lnr"> 6 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
-<span class="lnr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
-<span class="lnr"> 8 </span>
-<span class="lnr"> 9 </span><span class="Comment">// ODE class</span>
-<span class="lnr">10 </span><span class="Type">class</span> ODE {
-<span class="lnr">11 </span>
-<span class="lnr">12 </span> <span class="Comment">// Values and functions only accessible from the class internally</span>
-<span class="lnr">13 </span> <span class="Statement">private</span>:
-<span class="lnr">14 </span>
-<span class="lnr">15 </span> <span class="Comment">// System of ordinary differential equations to solve</span>
-<span class="lnr">16 </span> std::vector<std::complex<Floattype> >
-<span class="lnr">17 </span> (*f)(<span class="Type">const</span> std::complex<Floattype> x,
-<span class="lnr">18 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > &y);
-<span class="lnr">19 </span>
-<span class="lnr">20 </span> <span class="Comment">// Points to be evaluated</span>
-<span class="lnr">21 </span> std::vector<std::complex<Floattype> > x_list;
-<span class="lnr">22 </span>
-<span class="lnr">23 </span> <span class="Comment">// Limits of range to evaluate</span>
-<span class="lnr">24 </span> <span class="Type">const</span> std::complex<Floattype> a; <span class="Comment">// Lower</span>
-<span class="lnr">25 </span> <span class="Type">const</span> std::complex<Floattype> b; <span class="Comment">// Upper</span>
-<span class="lnr">26 </span>
-<span class="lnr">27 </span> <span class="Comment">// Step size</span>
-<span class="lnr">28 </span> std::complex<Floattype> h;
-<span class="lnr">29 </span>
-<span class="lnr">30 </span> <span class="Comment">// Results stored in 2D: vector of vectors</span>
-<span class="lnr">31 </span> std::vector<std::vector<std::complex<Floattype> > > y_list;
-<span class="lnr">32 </span>
-<span class="lnr">33 </span> <span class="Comment">// Maximum number of steps to evaluate, defined by y size</span>
-<span class="lnr">34 </span> <span class="Type">const</span> Inttype n_max;
-<span class="lnr">35 </span>
-<span class="lnr">36 </span> <span class="Comment">// Accuracy requirement values</span>
-<span class="lnr">37 </span> <span class="Type">const</span> Floattype delta; <span class="Comment">// Absolute</span>
-<span class="lnr">38 </span> <span class="Type">const</span> Floattype epsilon; <span class="Comment">// Relative</span>
-<span class="lnr">39 </span>
-<span class="lnr">40 </span> <span class="Comment">// Tolerance estimator</span>
-<span class="lnr">41 </span> Floattype tau(<span class="Type">const</span> std::vector<std::complex<Floattype> > &y,
-<span class="lnr">42 </span> <span class="Type">const</span> std::complex<Floattype> h);
-<span class="lnr">43 </span>
-<span class="lnr">44 </span> <span class="Comment">// Runge-Kutta mid-point stepper prototype</span>
-<span class="lnr">45 </span> <span class="Type">void</span> rkstep12(<span class="Type">const</span> std::complex<Floattype> x0,
-<span class="lnr">46 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > &y0,
-<span class="lnr">47 </span> std::vector<std::complex<Floattype> > &y1,
-<span class="lnr">48 </span> std::vector<std::complex<Floattype> > &dy);
-<span class="lnr">49 </span>
-<span class="lnr">50 </span> <span class="Comment">// Runge-Kutta driver function parameters</span>
-<span class="lnr">51 </span> <span class="Type">const</span> Floattype power;
-<span class="lnr">52 </span> <span class="Type">const</span> Floattype safety;
-<span class="lnr">53 </span>
-<span class="lnr">54 </span> <span class="Comment">// Runge-Kutta driver prototype</span>
-<span class="lnr">55 </span> <span class="Type">void</span> rkdriver();
-<span class="lnr">56 </span>
-<span class="lnr">57 </span>
-<span class="lnr">58 </span> <span class="Comment">// Values and functions accessible from the outside</span>
-<span class="lnr">59 </span> <span class="Statement">public</span>:
-<span class="lnr">60 </span>
-<span class="lnr">61 </span> <span class="Comment">// Constructor, some parameters with default values</span>
-<span class="lnr">62 </span> ODE(std::vector<std::complex<Floattype> >
-<span class="lnr">63 </span> (*f_in)(<span class="Type">const</span> std::complex<Floattype> x,
-<span class="lnr">64 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > &y),
-<span class="lnr">65 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > y_start,
-<span class="lnr">66 </span> <span class="Type">const</span> std::complex<Floattype> a_in,
-<span class="lnr">67 </span> <span class="Type">const</span> std::complex<Floattype> b_in,
-<span class="lnr">68 </span> <span class="Type">const</span> Floattype h_start = <span class="Constant">0.01f</span>,
-<span class="lnr">69 </span> <span class="Type">const</span> Inttype max_steps = <span class="Constant">1e4</span>,
-<span class="lnr">70 </span> <span class="Type">const</span> Floattype delta_in = <span class="Constant">1e-3f</span>,
-<span class="lnr">71 </span> <span class="Type">const</span> Floattype epsilon_in = <span class="Constant">1e-3f</span>,
-<span class="lnr">72 </span> <span class="Type">const</span> Floattype power_in = <span class="Constant">0.25f</span>,
-<span class="lnr">73 </span> <span class="Type">const</span> Floattype safety_in = <span class="Constant">0.95f</span>
-<span class="lnr">74 </span> );
-<span class="lnr">75 </span>
-<span class="lnr">76 </span> <span class="Comment">// Return the number of steps taken</span>
-<span class="lnr">77 </span> Inttype steps();
-<span class="lnr">78 </span>
-<span class="lnr">79 </span> <span class="Comment">// Print the x- and y-values to stdout</span>
-<span class="lnr">80 </span> <span class="Type">void</span> print();
-<span class="lnr">81 </span>
-<span class="lnr">82 </span> <span class="Comment">// Write the x- and y-values to file</span>
-<span class="lnr">83 </span> <span class="Type">void</span> write(<span class="Type">const</span> <span class="Type">char</span>* filename);
-<span class="lnr">84 </span>
-<span class="lnr">85 </span>};
-<span class="lnr">86 </span>
-<span class="lnr">87 </span><span class="PreProc">#endif</span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="Comment">// Make sure header is only included once</span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#ifndef ODE_H_</span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#define ODE_H_</span>
+<span id="L4" class="LineNr"> 4 </span>
+<span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
+<span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
+<span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
+<span id="L8" class="LineNr"> 8 </span>
+<span id="L9" class="LineNr"> 9 </span><span class="Comment">// ODE class</span>
+<span id="L10" class="LineNr">10 </span><span class="Type">class</span> ODE {
+<span id="L11" class="LineNr">11 </span>
+<span id="L12" class="LineNr">12 </span> <span class="Comment">// Values and functions only accessible from the class internally</span>
+<span id="L13" class="LineNr">13 </span> <span class="Statement">private</span>:
+<span id="L14" class="LineNr">14 </span>
+<span id="L15" class="LineNr">15 </span> <span class="Comment">// System of ordinary differential equations to solve</span>
+<span id="L16" class="LineNr">16 </span> std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L17" class="LineNr">17 </span> (*f)(<span class="Type">const</span> std::<span class="Type">complex</span><Floattype> x,
+<span id="L18" class="LineNr">18 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y);
+<span id="L19" class="LineNr">19 </span>
+<span id="L20" class="LineNr">20 </span> <span class="Comment">// Points to be evaluated</span>
+<span id="L21" class="LineNr">21 </span> std::vector<std::<span class="Type">complex</span><Floattype> > x_list;
+<span id="L22" class="LineNr">22 </span>
+<span id="L23" class="LineNr">23 </span> <span class="Comment">// Limits of range to evaluate</span>
+<span id="L24" class="LineNr">24 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> a; <span class="Comment">// Lower</span>
+<span id="L25" class="LineNr">25 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> b; <span class="Comment">// Upper</span>
+<span id="L26" class="LineNr">26 </span>
+<span id="L27" class="LineNr">27 </span> <span class="Comment">// Step size</span>
+<span id="L28" class="LineNr">28 </span> std::<span class="Type">complex</span><Floattype> h;
+<span id="L29" class="LineNr">29 </span>
+<span id="L30" class="LineNr">30 </span> <span class="Comment">// Results stored in 2D: vector of vectors</span>
+<span id="L31" class="LineNr">31 </span> std::vector<std::vector<std::<span class="Type">complex</span><Floattype> > > y_list;
+<span id="L32" class="LineNr">32 </span>
+<span id="L33" class="LineNr">33 </span> <span class="Comment">// Maximum number of steps to evaluate, defined by y size</span>
+<span id="L34" class="LineNr">34 </span> <span class="Type">const</span> Inttype n_max;
+<span id="L35" class="LineNr">35 </span>
+<span id="L36" class="LineNr">36 </span> <span class="Comment">// Accuracy requirement values</span>
+<span id="L37" class="LineNr">37 </span> <span class="Type">const</span> Floattype delta; <span class="Comment">// Absolute</span>
+<span id="L38" class="LineNr">38 </span> <span class="Type">const</span> Floattype epsilon; <span class="Comment">// Relative</span>
+<span id="L39" class="LineNr">39 </span>
+<span id="L40" class="LineNr">40 </span> <span class="Comment">// Tolerance estimator</span>
+<span id="L41" class="LineNr">41 </span> Floattype tau(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y,
+<span id="L42" class="LineNr">42 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> h);
+<span id="L43" class="LineNr">43 </span>
+<span id="L44" class="LineNr">44 </span> <span class="Comment">// Runge-Kutta mid-point stepper prototype</span>
+<span id="L45" class="LineNr">45 </span> <span class="Type">void</span> rkstep12(<span class="Type">const</span> std::<span class="Type">complex</span><Floattype> x0,
+<span id="L46" class="LineNr">46 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y0,
+<span id="L47" class="LineNr">47 </span> std::vector<std::<span class="Type">complex</span><Floattype> > &y1,
+<span id="L48" class="LineNr">48 </span> std::vector<std::<span class="Type">complex</span><Floattype> > &dy);
+<span id="L49" class="LineNr">49 </span>
+<span id="L50" class="LineNr">50 </span> <span class="Comment">// Runge-Kutta driver function parameters</span>
+<span id="L51" class="LineNr">51 </span> <span class="Type">const</span> Floattype power;
+<span id="L52" class="LineNr">52 </span> <span class="Type">const</span> Floattype safety;
+<span id="L53" class="LineNr">53 </span>
+<span id="L54" class="LineNr">54 </span> <span class="Comment">// Runge-Kutta driver prototype</span>
+<span id="L55" class="LineNr">55 </span> <span class="Type">void</span> rkdriver();
+<span id="L56" class="LineNr">56 </span>
+<span id="L57" class="LineNr">57 </span>
+<span id="L58" class="LineNr">58 </span> <span class="Comment">// Values and functions accessible from the outside</span>
+<span id="L59" class="LineNr">59 </span> <span class="Statement">public</span>:
+<span id="L60" class="LineNr">60 </span>
+<span id="L61" class="LineNr">61 </span> <span class="Comment">// Constructor, some parameters with default values</span>
+<span id="L62" class="LineNr">62 </span> ODE(std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L63" class="LineNr">63 </span> (*f_in)(<span class="Type">const</span> std::<span class="Type">complex</span><Floattype> x,
+<span id="L64" class="LineNr">64 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y),
+<span id="L65" class="LineNr">65 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > y_start,
+<span id="L66" class="LineNr">66 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> a_in,
+<span id="L67" class="LineNr">67 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> b_in,
+<span id="L68" class="LineNr">68 </span> <span class="Type">const</span> Floattype h_start = <span class="Constant">0.01f</span>,
+<span id="L69" class="LineNr">69 </span> <span class="Type">const</span> Inttype max_steps = <span class="Constant">1e4</span>,
+<span id="L70" class="LineNr">70 </span> <span class="Type">const</span> Floattype delta_in = <span class="Constant">1e-3f</span>,
+<span id="L71" class="LineNr">71 </span> <span class="Type">const</span> Floattype epsilon_in = <span class="Constant">1e-3f</span>,
+<span id="L72" class="LineNr">72 </span> <span class="Type">const</span> Floattype power_in = <span class="Constant">0.25f</span>,
+<span id="L73" class="LineNr">73 </span> <span class="Type">const</span> Floattype safety_in = <span class="Constant">0.95f</span>
+<span id="L74" class="LineNr">74 </span> );
+<span id="L75" class="LineNr">75 </span>
+<span id="L76" class="LineNr">76 </span> <span class="Comment">// Return the number of steps taken</span>
+<span id="L77" class="LineNr">77 </span> Inttype steps();
+<span id="L78" class="LineNr">78 </span>
+<span id="L79" class="LineNr">79 </span> <span class="Comment">// Print the x- and y-values to stdout</span>
+<span id="L80" class="LineNr">80 </span> <span class="Type">void</span> print();
+<span id="L81" class="LineNr">81 </span>
+<span id="L82" class="LineNr">82 </span> <span class="Comment">// Write the x- and y-values to file</span>
+<span id="L83" class="LineNr">83 </span> <span class="Type">void</span> write(<span class="Type">const</span> <span class="Type">char</span>* filename);
+<span id="L84" class="LineNr">84 </span>
+<span id="L85" class="LineNr">85 </span>};
+<span id="L86" class="LineNr">86 </span>
+<span id="L87" class="LineNr">87 </span><span class="PreProc">#endif</span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/plotA.gp.html b/exam/html/plotA.gp.html
t@@ -3,30 +3,62 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/plotA.gp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="gp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Constant { color: #ffff00; }
-.Statement { color: #ffff00; }
+* { font-size: 1em; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Constant { color: #af5f00; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr">1 </span>set terminal png
-<span class="lnr">2 </span>set <span class="Statement">output</span> <span class="Constant">"plotA.png"</span>
-<span class="lnr">3 </span>set xlabel <span class="Constant">"x.real"</span>
-<span class="lnr">4 </span>set ylabel <span class="Constant">"y.real"</span>
-<span class="lnr">5 </span>set title <span class="Constant">"Integration along a real path"</span>
-<span class="lnr">6 </span>set grid
-<span class="lnr">7 </span>plot <span class="Constant">"funcA.dat"</span> u 1:3 t <span class="Constant">"rk12"</span> w lp
-<span class="lnr">8 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr">1 </span>set terminal png
+<span id="L2" class="LineNr">2 </span>set <span class="Statement">output</span> <span class="Constant">"plotA.png"</span>
+<span id="L3" class="LineNr">3 </span>set xlabel <span class="Constant">"x.real"</span>
+<span id="L4" class="LineNr">4 </span>set ylabel <span class="Constant">"y.real"</span>
+<span id="L5" class="LineNr">5 </span>set title <span class="Constant">"Integration along a real path"</span>
+<span id="L6" class="LineNr">6 </span>set grid
+<span id="L7" class="LineNr">7 </span>plot <span class="Constant">"funcA.dat"</span> u 1:3 t <span class="Constant">"rk12"</span> w lp
+<span id="L8" class="LineNr">8 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/plotB.gp.html b/exam/html/plotB.gp.html
t@@ -3,30 +3,62 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/plotB.gp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="gp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Constant { color: #ffff00; }
-.Statement { color: #ffff00; }
+* { font-size: 1em; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Constant { color: #af5f00; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr">1 </span>set terminal png
-<span class="lnr">2 </span>set <span class="Statement">output</span> <span class="Constant">"plotB.png"</span>
-<span class="lnr">3 </span>set xlabel <span class="Constant">"x.imag"</span>
-<span class="lnr">4 </span>set ylabel <span class="Constant">"y.imag"</span>
-<span class="lnr">5 </span>set title <span class="Constant">"Integration along an imaginary path"</span>
-<span class="lnr">6 </span>set grid
-<span class="lnr">7 </span>plot <span class="Constant">"funcB.dat"</span> u 2:4 t <span class="Constant">"rk12"</span> w lp
-<span class="lnr">8 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr">1 </span>set terminal png
+<span id="L2" class="LineNr">2 </span>set <span class="Statement">output</span> <span class="Constant">"plotB.png"</span>
+<span id="L3" class="LineNr">3 </span>set xlabel <span class="Constant">"x.imag"</span>
+<span id="L4" class="LineNr">4 </span>set ylabel <span class="Constant">"y.imag"</span>
+<span id="L5" class="LineNr">5 </span>set title <span class="Constant">"Integration along an imaginary path"</span>
+<span id="L6" class="LineNr">6 </span>set grid
+<span id="L7" class="LineNr">7 </span>plot <span class="Constant">"funcB.dat"</span> u 2:4 t <span class="Constant">"rk12"</span> w lp
+<span id="L8" class="LineNr">8 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/plotC.gp.html b/exam/html/plotC.gp.html
t@@ -3,31 +3,63 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/plotC.gp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="gp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Constant { color: #ffff00; }
-.Statement { color: #ffff00; }
+* { font-size: 1em; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Constant { color: #af5f00; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr">1 </span>set terminal png
-<span class="lnr">2 </span>set <span class="Statement">output</span> <span class="Constant">"plotC.png"</span>
-<span class="lnr">3 </span>set xlabel <span class="Constant">"x.r"</span>
-<span class="lnr">4 </span>set ylabel <span class="Constant">"x.i"</span>
-<span class="lnr">5 </span>set zlabel <span class="Constant">"y"</span>
-<span class="lnr">6 </span>set title <span class="Constant">"Integration along a complex path"</span>
-<span class="lnr">7 </span>set grid
-<span class="lnr">8 </span>splot <span class="Constant">"funcC.dat"</span> u 1:2:3 t <span class="Constant">"y.real"</span> w lp, <span class="Constant">""</span> u 1:2:4 t <span class="Constant">"y.imag"</span> w lp
-<span class="lnr">9 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr">1 </span>set terminal png
+<span id="L2" class="LineNr">2 </span>set <span class="Statement">output</span> <span class="Constant">"plotC.png"</span>
+<span id="L3" class="LineNr">3 </span>set xlabel <span class="Constant">"x.r"</span>
+<span id="L4" class="LineNr">4 </span>set ylabel <span class="Constant">"x.i"</span>
+<span id="L5" class="LineNr">5 </span>set zlabel <span class="Constant">"y"</span>
+<span id="L6" class="LineNr">6 </span>set title <span class="Constant">"Integration along a complex path"</span>
+<span id="L7" class="LineNr">7 </span>set grid
+<span id="L8" class="LineNr">8 </span>splot <span class="Constant">"funcC.dat"</span> u 1:2:3 t <span class="Constant">"y.real"</span> w lp, <span class="Constant">""</span> u 1:2:4 t <span class="Constant">"y.imag"</span> w lp
+<span id="L9" class="LineNr">9 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/plotD.gp.html b/exam/html/plotD.gp.html
t@@ -3,31 +3,63 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/plotD.gp.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="gp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Constant { color: #ffff00; }
-.Statement { color: #ffff00; }
+* { font-size: 1em; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Constant { color: #af5f00; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr">1 </span>set terminal png
-<span class="lnr">2 </span>set <span class="Statement">output</span> <span class="Constant">"plotD.png"</span>
-<span class="lnr">3 </span>set xlabel <span class="Constant">"Precision"</span>
-<span class="lnr">4 </span>set ylabel <span class="Constant">"No. of steps"</span>
-<span class="lnr">5 </span>set title <span class="Constant">"Number of steps required for a given absolute and relative precision"</span>
-<span class="lnr">6 </span>set grid
-<span class="lnr">7 </span>set <span class="Statement">log</span> xy
-<span class="lnr">8 </span>plot <span class="Constant">"funcD.dat"</span> u 1:2 t <span class="Constant">"rk12"</span> w lp
-<span class="lnr">9 </span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr">1 </span>set terminal png
+<span id="L2" class="LineNr">2 </span>set <span class="Statement">output</span> <span class="Constant">"plotD.png"</span>
+<span id="L3" class="LineNr">3 </span>set xlabel <span class="Constant">"Precision"</span>
+<span id="L4" class="LineNr">4 </span>set ylabel <span class="Constant">"No. of steps"</span>
+<span id="L5" class="LineNr">5 </span>set title <span class="Constant">"Number of steps required for a given absolute and relative precision"</span>
+<span id="L6" class="LineNr">6 </span>set grid
+<span id="L7" class="LineNr">7 </span>set <span class="Statement">log</span> xy
+<span id="L8" class="LineNr">8 </span>plot <span class="Constant">"funcD.dat"</span> u 1:2 t <span class="Constant">"rk12"</span> w lp
+<span id="L9" class="LineNr">9 </span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/typedefs.h.html b/exam/html/typedefs.h.html
t@@ -3,39 +3,71 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/typedefs.h.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Constant { color: #ffff00; }
-.Type { color: #00ff00; }
-.PreProc { color: #ff40ff; }
-.Comment { color: #00ffff; }
+* { font-size: 1em; }
+.Constant { color: #af5f00; }
+.LineNr { color: #804000; }
+.Comment { color: #008080; }
+.Type { color: #008000; }
+.PreProc { color: #c000c0; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="Comment">// Make sure header is only included once</span>
-<span class="lnr"> 2 </span><span class="PreProc">#ifndef TYPEDEFS_H_</span>
-<span class="lnr"> 3 </span><span class="PreProc">#define TYPEDEFS_H_</span>
-<span class="lnr"> 4 </span>
-<span class="lnr"> 5 </span><span class="Comment">// Define whether the program should output values of matrices</span>
-<span class="lnr"> 6 </span><span class="Comment">//const bool verbose = false;</span>
-<span class="lnr"> 7 </span><span class="Type">const</span> <span class="Type">bool</span> verbose = <span class="Constant">true</span>;
-<span class="lnr"> 8 </span>
-<span class="lnr"> 9 </span><span class="Comment">// Choose length variable type</span>
-<span class="lnr">10 </span><span class="Type">typedef</span> <span class="Type">unsigned</span> <span class="Type">int</span> Inttype;
-<span class="lnr">11 </span>
-<span class="lnr">12 </span><span class="Comment">// Choose floating-point precision</span>
-<span class="lnr">13 </span><span class="Type">typedef</span> <span class="Type">double</span> Floattype;
-<span class="lnr">14 </span>
-<span class="lnr">15 </span><span class="PreProc">#endif</span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="Comment">// Make sure header is only included once</span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#ifndef TYPEDEFS_H_</span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#define TYPEDEFS_H_</span>
+<span id="L4" class="LineNr"> 4 </span>
+<span id="L5" class="LineNr"> 5 </span><span class="Comment">// Define whether the program should output values of matrices</span>
+<span id="L6" class="LineNr"> 6 </span><span class="Comment">//const bool verbose = false;</span>
+<span id="L7" class="LineNr"> 7 </span><span class="Type">const</span> <span class="Type">bool</span> verbose = <span class="Constant">true</span>;
+<span id="L8" class="LineNr"> 8 </span>
+<span id="L9" class="LineNr"> 9 </span><span class="Comment">// Choose length variable type</span>
+<span id="L10" class="LineNr">10 </span><span class="Type">typedef</span> <span class="Type">unsigned</span> <span class="Type">int</span> Inttype;
+<span id="L11" class="LineNr">11 </span>
+<span id="L12" class="LineNr">12 </span><span class="Comment">// Choose floating-point precision</span>
+<span id="L13" class="LineNr">13 </span><span class="Type">typedef</span> <span class="Type">double</span> Floattype;
+<span id="L14" class="LineNr">14 </span>
+<span id="L15" class="LineNr">15 </span><span class="PreProc">#endif</span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/exam/html/vector_arithmetic.h.html b/exam/html/vector_arithmetic.h.html
t@@ -3,114 +3,146 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/numeric/exam/vector_arithmetic.h.html</title>
-<meta name="Generator" content="Vim/7.3">
-<meta name="plugin-version" content="vim7.3_v10">
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
-<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
+<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
+<meta name="colorscheme" content="desert">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
-.lnr { color: #ffff00; }
-.Type { color: #00ff00; }
-.Statement { color: #ffff00; }
-.Constant { color: #ffff00; }
-.PreProc { color: #ff40ff; }
-.Comment { color: #00ffff; }
+* { font-size: 1em; }
+.Type { color: #008000; }
+.Statement { color: #804000; }
+.LineNr { color: #804000; }
+.Comment { color: #008080; }
+.Constant { color: #af5f00; }
+.PreProc { color: #c000c0; }
-->
</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+ var lineNum;
+ lineNum = window.location.hash;
+ lineNum = lineNum.substr(1); /* strip off '#' */
+
+ if (lineNum.indexOf('L') == -1) {
+ lineNum = 'L'+lineNum;
+ }
+ lineElem = document.getElementById(lineNum);
+ /* Always jump to new location even if the line was hidden inside a fold, or
+ * we corrected the raw number to a line ID.
+ */
+ if (lineElem) {
+ lineElem.scrollIntoView(true);
+ }
+ return true;
+}
+if ('onhashchange' in window) {
+ window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
</head>
-<body>
-<pre>
-<span class="lnr"> 1 </span><span class="Comment">// Make sure header is only included once</span>
-<span class="lnr"> 2 </span><span class="PreProc">#ifndef VECTOR_ARITHMETIC_H_</span>
-<span class="lnr"> 3 </span><span class="PreProc">#define VECTOR_ARITHMETIC_H_</span>
-<span class="lnr"> 4 </span>
-<span class="lnr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
-<span class="lnr"> 6 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span> <span class="Comment">// for sqrt</span>
-<span class="lnr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
-<span class="lnr"> 8 </span>
-<span class="lnr"> 9 </span><span class="Comment">//// Overload vector methods to allow scalar-</span>
-<span class="lnr">10 </span><span class="Comment">//// and element-wise arithmetic operations</span>
-<span class="lnr">11 </span>
-<span class="lnr">12 </span><span class="Comment">// Scalar multiplication (same scalar for real and imaginary parts)</span>
-<span class="lnr">13 </span>std::vector<std::complex<Floattype> >
-<span class="lnr">14 </span> <span class="Statement">operator</span>*(<span class="Type">const</span> std::vector<std::complex<Floattype> > vec,
-<span class="lnr">15 </span> <span class="Type">const</span> Floattype scalar)
-<span class="lnr">16 </span>{
-<span class="lnr">17 </span> std::vector<std::complex<Floattype> > result(vec.size());
-<span class="lnr">18 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<vec.size(); ++i) {
-<span class="lnr">19 </span> result[i].real() = real(vec[i])*scalar;
-<span class="lnr">20 </span> result[i].imag() = imag(vec[i])*scalar;
-<span class="lnr">21 </span> }
-<span class="lnr">22 </span> <span class="Statement">return</span> result;
-<span class="lnr">23 </span>}
-<span class="lnr">24 </span>
-<span class="lnr">25 </span><span class="Comment">// Scalar multiplication</span>
-<span class="lnr">26 </span>std::vector<std::complex<Floattype> >
-<span class="lnr">27 </span> <span class="Statement">operator</span>*(<span class="Type">const</span> std::vector<std::complex<Floattype> > vec,
-<span class="lnr">28 </span> <span class="Type">const</span> std::complex<Floattype> scalar)
-<span class="lnr">29 </span>{
-<span class="lnr">30 </span> std::vector<std::complex<Floattype> > result(vec.size());
-<span class="lnr">31 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec.size(); ++i)
-<span class="lnr">32 </span> result[i] = vec[i]*scalar;
-<span class="lnr">33 </span> <span class="Statement">return</span> result;
-<span class="lnr">34 </span>}
-<span class="lnr">35 </span>
-<span class="lnr">36 </span><span class="Comment">// Scalar division </span>
-<span class="lnr">37 </span>std::vector<std::complex<Floattype> >
-<span class="lnr">38 </span> <span class="Statement">operator</span>/(<span class="Type">const</span> std::vector<std::complex<Floattype> > vec,
-<span class="lnr">39 </span> <span class="Type">const</span> std::complex<Floattype> scalar)
-<span class="lnr">40 </span>{
-<span class="lnr">41 </span> std::vector<std::complex<Floattype> > result(vec.size());
-<span class="lnr">42 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec.size(); ++i)
-<span class="lnr">43 </span> result[i] = vec[i]/scalar;
-<span class="lnr">44 </span> <span class="Statement">return</span> result;
-<span class="lnr">45 </span>}
-<span class="lnr">46 </span>
-<span class="lnr">47 </span><span class="Comment">// Element-wise addition</span>
-<span class="lnr">48 </span>std::vector<std::complex<Floattype> >
-<span class="lnr">49 </span> <span class="Statement">operator</span>+(<span class="Type">const</span> std::vector<std::complex<Floattype> > vec1,
-<span class="lnr">50 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > vec2)
-<span class="lnr">51 </span>{
-<span class="lnr">52 </span> std::vector<std::complex<Floattype> > result(vec1.size());
-<span class="lnr">53 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec1.size(); ++i)
-<span class="lnr">54 </span> result[i] = vec1[i] + vec2[i];
-<span class="lnr">55 </span> <span class="Statement">return</span> result;
-<span class="lnr">56 </span>}
-<span class="lnr">57 </span>
-<span class="lnr">58 </span><span class="Comment">// Element-wise subtraction</span>
-<span class="lnr">59 </span>std::vector<std::complex<Floattype> >
-<span class="lnr">60 </span> <span class="Statement">operator</span>-(<span class="Type">const</span> std::vector<std::complex<Floattype> > vec1,
-<span class="lnr">61 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > vec2)
-<span class="lnr">62 </span>{
-<span class="lnr">63 </span> std::vector<std::complex<Floattype> > result(vec1.size());
-<span class="lnr">64 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec1.size(); ++i)
-<span class="lnr">65 </span> result[i] = vec1[i] - vec2[i];
-<span class="lnr">66 </span> <span class="Statement">return</span> result;
-<span class="lnr">67 </span>}
-<span class="lnr">68 </span>
-<span class="lnr">69 </span><span class="Comment">// Element-wise multiplication</span>
-<span class="lnr">70 </span>std::vector<std::complex<Floattype> >
-<span class="lnr">71 </span> <span class="Statement">operator</span>*(<span class="Type">const</span> std::vector<std::complex<Floattype> > vec1,
-<span class="lnr">72 </span> <span class="Type">const</span> std::vector<std::complex<Floattype> > vec2)
-<span class="lnr">73 </span>{
-<span class="lnr">74 </span> std::vector<std::complex<Floattype> > result(vec1.size());
-<span class="lnr">75 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec1.size(); ++i)
-<span class="lnr">76 </span> result[i] = vec1[i] * vec2[i];
-<span class="lnr">77 </span> <span class="Statement">return</span> result;
-<span class="lnr">78 </span>}
-<span class="lnr">79 </span>
-<span class="lnr">80 </span><span class="Comment">// Normalize vector</span>
-<span class="lnr">81 </span>Floattype cnorm(<span class="Type">const</span> std::vector<std::complex<Floattype> > vec)
-<span class="lnr">82 </span>{
-<span class="lnr">83 </span> Floattype res = <span class="Constant">0.0f</span>;
-<span class="lnr">84 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec.size(); ++i)
-<span class="lnr">85 </span> res += norm(vec[i])*norm(vec[i]);
-<span class="lnr">86 </span> <span class="Statement">return</span> sqrt(res);
-<span class="lnr">87 </span>}
-<span class="lnr">88 </span>
-<span class="lnr">89 </span><span class="PreProc">#endif</span>
+<body onload='JumpToLine();'>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="Comment">// Make sure header is only included once</span>
+<span id="L2" class="LineNr"> 2 </span><span class="PreProc">#ifndef VECTOR_ARITHMETIC_H_</span>
+<span id="L3" class="LineNr"> 3 </span><span class="PreProc">#define VECTOR_ARITHMETIC_H_</span>
+<span id="L4" class="LineNr"> 4 </span>
+<span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
+<span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant"><cmath></span> <span class="Comment">// for sqrt</span>
+<span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
+<span id="L8" class="LineNr"> 8 </span>
+<span id="L9" class="LineNr"> 9 </span><span class="Comment">//// Overload vector methods to allow scalar-</span>
+<span id="L10" class="LineNr">10 </span><span class="Comment">//// and element-wise arithmetic operations</span>
+<span id="L11" class="LineNr">11 </span>
+<span id="L12" class="LineNr">12 </span><span class="Comment">// Scalar multiplication (same scalar for real and imaginary parts)</span>
+<span id="L13" class="LineNr">13 </span>std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L14" class="LineNr">14 </span> <span class="Statement">operator</span>*(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec,
+<span id="L15" class="LineNr">15 </span> <span class="Type">const</span> Floattype scalar)
+<span id="L16" class="LineNr">16 </span>{
+<span id="L17" class="LineNr">17 </span> std::vector<std::<span class="Type">complex</span><Floattype> > result(vec.size());
+<span id="L18" class="LineNr">18 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<vec.size(); ++i) {
+<span id="L19" class="LineNr">19 </span> result[i].real() = real(vec[i])*scalar;
+<span id="L20" class="LineNr">20 </span> result[i].imag() = imag(vec[i])*scalar;
+<span id="L21" class="LineNr">21 </span> }
+<span id="L22" class="LineNr">22 </span> <span class="Statement">return</span> result;
+<span id="L23" class="LineNr">23 </span>}
+<span id="L24" class="LineNr">24 </span>
+<span id="L25" class="LineNr">25 </span><span class="Comment">// Scalar multiplication</span>
+<span id="L26" class="LineNr">26 </span>std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L27" class="LineNr">27 </span> <span class="Statement">operator</span>*(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec,
+<span id="L28" class="LineNr">28 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> scalar)
+<span id="L29" class="LineNr">29 </span>{
+<span id="L30" class="LineNr">30 </span> std::vector<std::<span class="Type">complex</span><Floattype> > result(vec.size());
+<span id="L31" class="LineNr">31 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec.size(); ++i)
+<span id="L32" class="LineNr">32 </span> result[i] = vec[i]*scalar;
+<span id="L33" class="LineNr">33 </span> <span class="Statement">return</span> result;
+<span id="L34" class="LineNr">34 </span>}
+<span id="L35" class="LineNr">35 </span>
+<span id="L36" class="LineNr">36 </span><span class="Comment">// Scalar division </span>
+<span id="L37" class="LineNr">37 </span>std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L38" class="LineNr">38 </span> <span class="Statement">operator</span>/(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec,
+<span id="L39" class="LineNr">39 </span> <span class="Type">const</span> std::<span class="Type">complex</span><Floattype> scalar)
+<span id="L40" class="LineNr">40 </span>{
+<span id="L41" class="LineNr">41 </span> std::vector<std::<span class="Type">complex</span><Floattype> > result(vec.size());
+<span id="L42" class="LineNr">42 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec.size(); ++i)
+<span id="L43" class="LineNr">43 </span> result[i] = vec[i]/scalar;
+<span id="L44" class="LineNr">44 </span> <span class="Statement">return</span> result;
+<span id="L45" class="LineNr">45 </span>}
+<span id="L46" class="LineNr">46 </span>
+<span id="L47" class="LineNr">47 </span><span class="Comment">// Element-wise addition</span>
+<span id="L48" class="LineNr">48 </span>std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L49" class="LineNr">49 </span> <span class="Statement">operator</span>+(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec1,
+<span id="L50" class="LineNr">50 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec2)
+<span id="L51" class="LineNr">51 </span>{
+<span id="L52" class="LineNr">52 </span> std::vector<std::<span class="Type">complex</span><Floattype> > result(vec1.size());
+<span id="L53" class="LineNr">53 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec1.size(); ++i)
+<span id="L54" class="LineNr">54 </span> result[i] = vec1[i] + vec2[i];
+<span id="L55" class="LineNr">55 </span> <span class="Statement">return</span> result;
+<span id="L56" class="LineNr">56 </span>}
+<span id="L57" class="LineNr">57 </span>
+<span id="L58" class="LineNr">58 </span><span class="Comment">// Element-wise subtraction</span>
+<span id="L59" class="LineNr">59 </span>std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L60" class="LineNr">60 </span> <span class="Statement">operator</span>-(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec1,
+<span id="L61" class="LineNr">61 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec2)
+<span id="L62" class="LineNr">62 </span>{
+<span id="L63" class="LineNr">63 </span> std::vector<std::<span class="Type">complex</span><Floattype> > result(vec1.size());
+<span id="L64" class="LineNr">64 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec1.size(); ++i)
+<span id="L65" class="LineNr">65 </span> result[i] = vec1[i] - vec2[i];
+<span id="L66" class="LineNr">66 </span> <span class="Statement">return</span> result;
+<span id="L67" class="LineNr">67 </span>}
+<span id="L68" class="LineNr">68 </span>
+<span id="L69" class="LineNr">69 </span><span class="Comment">// Element-wise multiplication</span>
+<span id="L70" class="LineNr">70 </span>std::vector<std::<span class="Type">complex</span><Floattype> >
+<span id="L71" class="LineNr">71 </span> <span class="Statement">operator</span>*(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec1,
+<span id="L72" class="LineNr">72 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec2)
+<span id="L73" class="LineNr">73 </span>{
+<span id="L74" class="LineNr">74 </span> std::vector<std::<span class="Type">complex</span><Floattype> > result(vec1.size());
+<span id="L75" class="LineNr">75 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec1.size(); ++i)
+<span id="L76" class="LineNr">76 </span> result[i] = vec1[i] * vec2[i];
+<span id="L77" class="LineNr">77 </span> <span class="Statement">return</span> result;
+<span id="L78" class="LineNr">78 </span>}
+<span id="L79" class="LineNr">79 </span>
+<span id="L80" class="LineNr">80 </span><span class="Comment">// Normalize vector</span>
+<span id="L81" class="LineNr">81 </span>Floattype cnorm(<span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > vec)
+<span id="L82" class="LineNr">82 </span>{
+<span id="L83" class="LineNr">83 </span> Floattype res = <span class="Constant">0.0f</span>;
+<span id="L84" class="LineNr">84 </span> <span class="Statement">for</span> (Inttype i=<span class="Constant">0</span>; i<(Inttype)vec.size(); ++i)
+<span id="L85" class="LineNr">85 </span> res += norm(vec[i])*norm(vec[i]);
+<span id="L86" class="LineNr">86 </span> <span class="Statement">return</span> sqrt(res);
+<span id="L87" class="LineNr">87 </span>}
+<span id="L88" class="LineNr">88 </span>
+<span id="L89" class="LineNr">89 </span><span class="PreProc">#endif</span>
</pre>
</body>
</html>
+<!-- vim: set foldmethod=manual : -->
(DIR) diff --git a/matrixmul/Makefile b/matrixmul/Makefile
t@@ -15,10 +15,10 @@ PREFIXCMD = time -ao # For Linux
CC=gcc
CXX=g++
-CFLAGS=-Wall -O3 -march=native
-CXXFLAGS=-Wall -O3 -march=native
+CFLAGS=-Wall -O2 -march=native -ffast-math
+CXXFLAGS=-Wall -O2 -march=native -ffast-math
-performance.png: plot.gp lua-arrofarrs.dat lua-linarr.dat luajit-arrofarrs.dat luajit-linarr.dat c-arrofarrs.dat c-linarr.dat c-omp-arrofarrs.dat c-omp-linarr.dat c-gsl-cblas.dat julia.dat cpp-vectorofvectors.dat cpp-linvectors.dat cpp-armadillo.dat cpp-eigen.dat python-numpy.dat octave.dat cputhreads.sh cpumodel.sh
+performance.png: plot.gp lua-arrofarrs.dat lua-linarr.dat luajit-arrofarrs.dat luajit-linarr.dat c-arrofarrs.dat c-linarr.dat c-omp-arrofarrs.dat c-omp-linarr.dat c-gsl-cblas.dat julia.dat cpp-vectorofvectors.dat cpp-linvectors.dat cpp-armadillo.dat cpp-eigen.dat python-numpy.dat octave.dat cuda-cublas.dat cputhreads.sh cpumodel.sh
gnuplot -e "platform='$(shell uname -norm)'; threads='$(shell ./cputhreads.sh)'; cpumodel='$(shell ./cpumodel.sh)'" plot.gp
# Lua: Matrices as arrays of arrays
t@@ -177,6 +177,17 @@ octave.dat: octave.m
echo $$dims; \
done
+# CUDA using CUBLAS
+cuda-cublas.dat: cuda-cublas
+ @rm -f $@
+ @for dims in $(MATRIXDIMS_FAST); do \
+ $(PREFIXCMD) $@ -f "$$dims %e" ./$< $$dims; \
+ echo $$dims; \
+ done
+
+cuda-cublas: cuda-cublas.cu
+ nvcc -lcublas -lcudart -m64 -gencode arch=compute_20,code=sm_20 $< -o $@
+
# Fortran 90
fortran90.dat: fortran90
# fortran90.f
(DIR) diff --git a/matrixmul/c-gsl-cblas.c b/matrixmul/c-gsl-cblas.c
t@@ -12,7 +12,7 @@ int main(int argc, char* argv[])
if (argc == 2) {
N = atoi(argv[1]);
} else {
- printf("Sorry, I need matrix width as command line argument\n");
+ fprintf(stderr, "Sorry, I need matrix width as command line argument\n");
return 1;
}
t@@ -32,6 +32,5 @@ int main(int argc, char* argv[])
free(B);
free(C);
- /* Exit with success */
return 0;
}
(DIR) diff --git a/matrixmul/c-linarr.c b/matrixmul/c-linarr.c
t@@ -31,9 +31,9 @@ int main(int argc, char* argv[])
return 1;
}
- A = (double*) malloc(N * N * sizeof(double*));
- B = (double*) malloc(N * N * sizeof(double*));
- C = (double*) malloc(N * N * sizeof(double*));
+ A = (double*) malloc(N * N * sizeof(double));
+ B = (double*) malloc(N * N * sizeof(double));
+ C = (double*) malloc(N * N * sizeof(double));
for (i = 0; i < N*N; i++) {
A[i] = 2.0;
(DIR) diff --git a/matrixmul/cpp-eigen.cpp b/matrixmul/cpp-eigen.cpp
t@@ -1,6 +1,6 @@
#include <iostream>
#include <cstdlib>
-#include <Eigen/Dense>
+#include <eigen3/Eigen/Dense>
int main(int argc, char* argv[])
{
(DIR) diff --git a/matrixmul/julia.jl b/matrixmul/julia.jl
t@@ -1,11 +1,11 @@
#!/usr/bin/env julia
if (length(ARGS) == 1)
- const N = int(ARGS[1])
+ const N = parse(Int, ARGS[1])
else
println("Sorry, I need the matrix width as a command line argument\n")
end
const A = ones(N, N)*2.0
const B = reshape(0.0:N*N-1, N, N)
-C = A*B
+@profile C = A*B