dcomplex pl_base1_triT<tiny_cpx<T> >::atan(value_type x) { #if _MSC_VER>1600 return std::atan(k(x)); #else dcomplex _tmp =pl_log::g(dcomplex(1.0+x.imag(),-x.real()))-pl_log::g(dcomplex(1.0-x.imag(),x.real())); return dcomplex(-0.5*_tmp.imag(),0.5*_tmp.real()); #endif }
dcomplex pl_base1_triT<tiny_cpx<T> >::asin(value_type x) { #if _MSC_VER>1600 return std::asin(k(x)); #else dcomplex _tmp=pl_log::g(dcomplex(-x.imag(),x.real())+pl_sqrt::g(-pl_pow::g(x,2)+1.0)); return dcomplex(_tmp.imag(),-_tmp.real()); #endif }
void generate(state &, ostream & stream) { // FIXME: // Generate complex literals? stream << complex_type_name<T>(); stream << '('; print_literal(stream, value.real()); stream << ','; print_literal(stream, value.imag()); stream << ')'; }
static void put(ptr_type ptr, index_type i, value_type v) { switch (ptr.format()) { case array: *ptr.template as<array>() = v; break; case interleaved_complex: *reinterpret_cast<value_type*>(ptr.template as<interleaved_complex>()) = v; break; case split_complex: { std::pair<T const*,T const*> p = ptr.template as<split_complex>(); p.first = v.real(); p.second = v.imag(); break; } default: assert(0); } }
static void put(ptr_type ptr, index_type i, value_type v) { ptr.first[i] = v.real(), ptr.second[i] = v.imag();}
static void put(ptr_type ptr, index_type i, value_type v) { ptr[2*i] = v.real(), ptr[2*i+1] = v.imag();}
value_type real(const value_type &a){ return a.real(); }