Esempio n. 1
0
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
}
Esempio n. 2
0
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
}
Esempio n. 3
0
 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 << ')';
 }
Esempio n. 4
0
  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);
    }
  }
Esempio n. 5
0
 static void put(ptr_type ptr, index_type i, value_type v)
 { ptr.first[i] = v.real(), ptr.second[i] = v.imag();}
Esempio n. 6
0
 static void put(ptr_type ptr, index_type i, value_type v)
 { ptr[2*i] = v.real(), ptr[2*i+1] = v.imag();}
Esempio n. 7
0
	value_type real(const value_type &a){ return a.real(); }