tfunctions.h - numeric - C++ library with numerical algorithms | |
git clone git://src.adamsgaard.dk/numeric | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
tfunctions.h (584B) | |
--- | |
1 // Make sure file is only included once per object | |
2 #ifndef FUNCTIONS_H_ | |
3 #define FUNCTIONS_H_ | |
4 | |
5 #include <vector> | |
6 #include <complex> | |
7 #include "typedefs.h" | |
8 | |
9 | |
10 //// ODEs with real+complex parts. | |
11 //// Return the derivatives at the point x,vec(y) | |
12 | |
13 std::vector<std::complex<Floattype> > | |
14 func1(const std::complex<Floattype> z, | |
15 const std::vector<std::complex<Floattype> > &y) | |
16 { | |
17 std::vector<std::complex<Floattype> > dydz(2); | |
18 dydz[0].real() = y[1].real(); | |
19 dydz[0].imag() = y[1].imag(); | |
20 dydz[1].real() = -y[0].real(); | |
21 dydz[1].imag() = 0.5f*y[0].imag(); | |
22 return dydz; | |
23 } | |
24 | |
25 #endif |