13template<
class T,
size_t d>
16 for(
size_t i=0;i<d;i++)
27 return (abs(a) < 1e-7) ? complex<double>(1.0 + a.real(), a.imag()) : exp(a/2.0)*sinh(a/2.0)/(a/2.0);
36 if(abs(a.imag()) < 1e-7){
37 return complex<double>(1.0+a.imag(),a.imag());
39 return complex<double>(sin(a.imag())/a.imag(),2*pow(sin(a.imag()/2.0),2)/a.imag());
49 if(abs(a.imag()) < 1e-7){
50 return complex<double>(0.5+a.imag(),a.imag());
52 return complex<double>(2*pow(sin(a.imag()/2.0),2)/pow(a.imag(),2),(a.imag()-sin(a.imag()))/pow(a.imag(),2));
59void* gpu_malloc(
size_t size);
68 std::istringstream iss(s);
69 for(
size_t i=0;i<d;i++) {
71 cout <<
"ERROR: not enough dof provided to parse" << endl;
78 cout <<
"ERROR: to many dof provided to parse" << endl;
89 return std::numeric_limits<T>::infinity();
91 return max(err, diff);
94template <
class InputIt,
class OutputIt>
97 std::copy(first, first + idx, d_first);
98 std::copy(first + idx + 1, last, d_first + idx);
Provides shared types, platform headers, and basic definitions.
Core namespace for Ensign's numerical algorithms and data structures.
array< Index, d > parse(string s)
Parser for command line arguments separated by whitespaces.
void remove_element(InputIt first, InputIt last, OutputIt d_first, const Index idx)
T phi1_im(T a)
Computes (exp(i a)-1)/(i a)
double max_err(T err, T diff)
Maximum function which treats NaNs correctly.
T phi1(T a)
Computes (exp(z)-1)/z.
T phi2_im(T a)
Computes (exp(i a)-1-i a)/((i a)^2)