Esempio n. 1
0
	// compute integral of e^(ikx) between x1 and x2
	complex_t integral_e(real_t x1, real_t x2, complex_t k) {
		if(boost::math::fpclassify(k.real()) == FP_ZERO &&
				boost::math::fpclassify(k.imag()) == FP_ZERO) {
			return complex_t(x2 - x1, 0);
		} else {
			complex_t ik = complex_t(0.0, 1.0) * k;
			return (((real_t) 1.0 / ik) * (exp(ik * x2) - exp(ik * x1)));
		} // if-else
	} // integral_e
Esempio n. 2
0
complex_t EC2D2T3::Constant(      real_t        omega,
                            const Vect<real_t>& u,
                                  complex_t&    I)
{
   real_t ur = _a3*(u(1)+u(3)+u(5));
   real_t ui = _a3*(u(2)+u(4)+u(6));
   real_t c1 = _rho*(I.real() - omega*ui/_rho)/_area;
   real_t c2 = _rho*(I.imag() + omega*ur/_rho)/_area;
   return std::complex<real_t> (c1,c2);
}
Esempio n. 3
0
	// compute integral of (ax + b) e^(ikx) between x1 and x2
	complex_t integral_xe(real_t x1, real_t x2, real_t a, real_t b, complex_t k) {
		if(boost::math::fpclassify(k.real()) == FP_ZERO &&
				boost::math::fpclassify(k.imag()) == FP_ZERO) {
			return complex_t(a * (x2 * x2 - x1 * x1) / 2 + b * (x2 - x1), 0.0);
		} else {
			complex_t ik = complex_t(0.0, 1.0) * k;
			return (((real_t) 1.0 / ik) * ((a * x2 + b - a / ik) * exp(ik * x2) -
											(a * x1 + b - a / ik) * exp(ik * x1)));
		} // if-else
	} // integral_xe()
Esempio n. 4
0
void BiquadBase::setTwoPole (complex_t pole1, complex_t zero1,
                             complex_t pole2, complex_t zero2)
{
#if 0
  pole1 = adjust_imag (pole1);
  pole2 = adjust_imag (pole2);
  zero1 = adjust_imag (zero1);
  zero2 = adjust_imag (zero2);
#endif

  const double a0 = 1;
  double a1;
  double a2;

  if (pole1.imag() != 0)
  {
    assert (pole2 == std::conj (pole1));

    a1 = -2 * pole1.real();
    a2 = std::norm (pole1);
  }
  else
  {
    assert (pole2.imag() == 0);

    a1 = -(pole1.real() + pole2.real());
    a2 =   pole1.real() * pole2.real();
  }

  const double b0 = 1;
  double b1;
  double b2;

  if (zero1.imag() != 0)
  {
    assert (zero2 == std::conj (zero1));

    b1 = -2 * zero1.real();
    b2 = std::norm (zero1);
  }
  else
  {
    assert (zero2.imag() == 0);

    b1 = -(zero1.real() + zero2.real());
    b2 =   zero1.real() * zero2.real();
  }

  setCoefficients (a0, a1, a2, b0, b1, b2);
}
Esempio n. 5
0
void BiquadBase::setOnePole (complex_t pole, complex_t zero)
{
#if 0
  pole = adjust_imag (pole);
  zero = adjust_imag (zero);
#else
  assert (pole.imag() == 0); 
  assert (zero.imag() == 0);
#endif
  
  const double a0 = 1;
  const double a1 = -pole.real();
  const double a2 = 0;
  const double b0 = -zero.real();
  const double b1 = 1;
  const double b2 = 0;

  setCoefficients (a0, a1, a2, b0, b1, b2);
}
Esempio n. 6
0
complex<real_t> EC2D2T3::_ablog(size_t    det,
                                complex_t a,
                                complex_t b,
                                real_t    t)
/*-----------------------------------------------------------------------
      ablog = a*b*(log(a)-t)
  -----------------------------------------------------------------------*/
{
   if (a==complex_t(0))
      return complex_t(0);
   real_t dd = 0.;
   if (det==3 && a.imag()<0)
      dd = 2*OFELI_PI;
   if (det==4 && a.imag()>=0. && a.real()<0)
      dd = -2*OFELI_PI;
   if (det==2 && a.imag()<0 && a.real()<0)
      dd = 2*OFELI_PI;
   return a*b*(Log(a)+complex_t(0,dd)-complex_t(t,0));
}
Esempio n. 7
0
 /**
  * Computational kernel function.
  */
 inline complex_t NumericFormFactorC::compute_fq(real_t s, complex_t qt, complex_t qn) {
   complex_t v1 = qn * complex_t(cos(qt.real()), sin(qt.real()));
   real_t v2 = s * exp(qt.imag());
   return v1 * v2;
 } // NumericFormFactorC::compute_fq()
Esempio n. 8
0
	complex_t operator*(real_t s, complex_t c) {
		return complex_t(c.real() * s, c.imag() * s);
	} // operator*()
Esempio n. 9
0
	complex_t operator*(complex_t c, complex_t s) {
		return complex_t(c.real() * s.real() - c.imag() * s.imag(),
						 c.real() * s.imag() + c.imag() * s.real());
	} // operator*()
Esempio n. 10
0
 complex_t AnalyticFormFactor::sinc(complex_t value) {
   complex_t temp;
   if(fabs(value.real()) <= 1e-14 && fabs(value.imag()) <= 1e-14) temp = complex_t(1.0, 0.0);
   else temp = sin(value) / value;
   return temp;
 } // AnalyticFormFactor::sinc()