tfunctions.h.html - numeric - C++ library with numerical algorithms
(HTM) git clone git://src.adamsgaard.dk/numeric
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
tfunctions.h.html (4188B)
---
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
5 <title>~/code/numeric/exam/functions.h.html</title>
6 <meta name="Generator" content="Vim/7.4">
7 <meta name="plugin-version" content="vim7.4_v1">
8 <meta name="syntax" content="cpp">
9 <meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
10 <meta name="colorscheme" content="desert">
11 <style type="text/css">
12 <!--
13 pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
14 body { font-family: monospace; color: #ffffff; background-color: #000000; }
15 * { font-size: 1em; }
16 .Type { color: #008000; }
17 .Statement { color: #804000; }
18 .LineNr { color: #804000; }
19 .Comment { color: #008080; }
20 .Constant { color: #af5f00; }
21 .PreProc { color: #c000c0; }
22 -->
23 </style>
24
25 <script type='text/javascript'>
26 <!--
27
28 /* function to open any folds containing a jumped-to line before jumping to it */
29 function JumpToLine()
30 {
31 var lineNum;
32 lineNum = window.location.hash;
33 lineNum = lineNum.substr(1); /* strip off '#' */
34
35 if (lineNum.indexOf('L') == -1) {
36 lineNum = 'L'+lineNum;
37 }
38 lineElem = document.getElementById(lineNum);
39 /* Always jump to new location even if the line was hidden inside a fold, or
40 * we corrected the raw number to a line ID.
41 */
42 if (lineElem) {
43 lineElem.scrollIntoView(true);
44 }
45 return true;
46 }
47 if ('onhashchange' in window) {
48 window.onhashchange = JumpToLine;
49 }
50
51 -->
52 </script>
53 </head>
54 <body onload='JumpToLine();'>
55 <pre id='vimCodeElement'>
56 <span id="L1" class="LineNr"> 1 </span><span class="Comment">// Make sure file is only included once per object</span>
57 <span id="L2" class="LineNr"> 2 </span><span class="PreProc">#ifndef FUNCTIONS_H_</span>
58 <span id="L3" class="LineNr"> 3 </span><span class="PreProc">#define FUNCTIONS_H_</span>
59 <span id="L4" class="LineNr"> 4 </span>
60 <span id="L5" class="LineNr"> 5 </span><span class="PreProc">#include </span><span class="Constant"><vector></span>
61 <span id="L6" class="LineNr"> 6 </span><span class="PreProc">#include </span><span class="Constant"><complex></span>
62 <span id="L7" class="LineNr"> 7 </span><span class="PreProc">#include </span><span class="Constant">"typedefs.h"</span>
63 <span id="L8" class="LineNr"> 8 </span>
64 <span id="L9" class="LineNr"> 9 </span>
65 <span id="L10" class="LineNr">10 </span><span class="Comment">//// ODEs with real+complex parts.</span>
66 <span id="L11" class="LineNr">11 </span><span class="Comment">//// Return the derivatives at the point x,vec(y)</span>
67 <span id="L12" class="LineNr">12 </span>
68 <span id="L13" class="LineNr">13 </span>std::vector<std::<span class="Type">complex</span><Floattype> >
69 <span id="L14" class="LineNr">14 </span> func1(<span class="Type">const</span> std::<span class="Type">complex</span><Floattype> z,
70 <span id="L15" class="LineNr">15 </span> <span class="Type">const</span> std::vector<std::<span class="Type">complex</span><Floattype> > &y)
71 <span id="L16" class="LineNr">16 </span>{
72 <span id="L17" class="LineNr">17 </span> std::vector<std::<span class="Type">complex</span><Floattype> > dydz(<span class="Constant">2</span>);
73 <span id="L18" class="LineNr">18 </span> dydz[<span class="Constant">0</span>].real() = y[<span class="Constant">1</span>].real();
74 <span id="L19" class="LineNr">19 </span> dydz[<span class="Constant">0</span>].imag() = y[<span class="Constant">1</span>].imag();
75 <span id="L20" class="LineNr">20 </span> dydz[<span class="Constant">1</span>].real() = -y[<span class="Constant">0</span>].real();
76 <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();
77 <span id="L22" class="LineNr">22 </span> <span class="Statement">return</span> dydz;
78 <span id="L23" class="LineNr">23 </span>}
79 <span id="L24" class="LineNr">24 </span>
80 <span id="L25" class="LineNr">25 </span><span class="PreProc">#endif</span>
81 </pre>
82 </body>
83 </html>
84 <!-- vim: set foldmethod=manual : -->