本文整理汇总了C++中IMAGPART函数的典型用法代码示例。如果您正苦于以下问题:C++ IMAGPART函数的具体用法?C++ IMAGPART怎么用?C++ IMAGPART使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IMAGPART函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: elem_equal
int
elem_equal(elem_srcptr op1, elem_srcptr op2, const ring_t ring)
{
switch (ring->type)
{
case TYPE_FMPZ:
return fmpz_equal(op1, op2);
case TYPE_LIMB:
return *((mp_srcptr) op1) == *((mp_srcptr) op2);
case TYPE_POLY:
return elem_poly_equal(op1, op2, ring);
case TYPE_MOD:
return elem_equal(op1, op2, ring->parent);
case TYPE_FRAC:
return elem_equal(NUMER(op1, ring), NUMER(op2, ring), RING_NUMER(ring)) &&
elem_equal(DENOM(op1, ring), DENOM(op2, ring), RING_DENOM(ring));
case TYPE_COMPLEX:
return elem_equal(REALPART(op1, ring), REALPART(op2, ring), RING_PARENT(ring)) &&
elem_equal(IMAGPART(op1, ring), IMAGPART(op2, ring), RING_PARENT(ring));
default:
NOT_IMPLEMENTED("equal", ring);
}
}
示例2: mult_c128
static inline __complex128 mult_c128 (__complex128 x, __complex128 y)
{
__float128 r1 = REALPART(x), i1 = IMAGPART(x);
__float128 r2 = REALPART(y), i2 = IMAGPART(y);
__complex128 res;
COMPLEX_ASSIGN(res, r1*r2 - i1*i2, i2*r1 + i1*r2);
return res;
}
示例3: div_c128
// Careful: the algorithm for the division sucks. A lot.
static inline __complex128 div_c128 (__complex128 x, __complex128 y)
{
__float128 n = hypotq (REALPART (y), IMAGPART (y));
__float128 r1 = REALPART(x), i1 = IMAGPART(x);
__float128 r2 = REALPART(y), i2 = IMAGPART(y);
__complex128 res;
COMPLEX_ASSIGN(res, r1*r2 + i1*i2, i1*r2 - i2*r1);
return res / n;
}
示例4: elem_sub
void
elem_sub(elem_ptr res, elem_srcptr op1, elem_srcptr op2, const ring_t ring)
{
switch (ring->type)
{
case TYPE_FMPZ:
fmpz_sub(res, op1, op2);
break;
case TYPE_LIMB:
*((mp_ptr) res) = *((mp_srcptr) op1) - *((mp_srcptr) op2);
break;
case TYPE_POLY:
elem_poly_sub(res, op1, op2, ring);
break;
case TYPE_MOD:
{
switch (RING_PARENT(ring)->type)
{
case TYPE_LIMB:
*((mp_ptr) res) = n_submod(*((mp_srcptr) op1), *((mp_srcptr) op2), ring->nmod.n);
break;
case TYPE_FMPZ:
fmpz_sub(res, op1, op2);
if (fmpz_sgn(res) < 0)
fmpz_add(res, res, RING_MODULUS(ring));
break;
default:
NOT_IMPLEMENTED("sub (mod)", ring);
}
}
break;
case TYPE_FRAC:
elem_frac_sub(res, op1, op2, ring);
break;
case TYPE_COMPLEX:
elem_sub(REALPART(res, ring), REALPART(op1, ring), REALPART(op2, ring), ring->parent);
elem_sub(IMAGPART(res, ring), IMAGPART(op1, ring), IMAGPART(op2, ring), ring->parent);
break;
default:
NOT_IMPLEMENTED("sub", ring);
}
}
示例5: cimag
double
cimag(double complex z)
{
const double_complex z1 = { .f = z };
return (IMAGPART(z1));
}
示例6: cimagf
float
cimagf(float complex z)
{
const float_complex z1 = { .f = z };
return (IMAGPART(z1));
}
示例7: cargf
/* Complex argument. The angle made with the +ve real axis.
Range -pi-pi. */
GFC_REAL_4
cargf (GFC_COMPLEX_4 z)
{
GFC_REAL_4 arg;
return atan2f (IMAGPART (z), REALPART (z));
}
示例8: cimagl
long double
cimagl(long double complex z)
{
const long_double_complex z1 = { .f = z };
return (IMAGPART(z1));
}
示例9: ccoshq
__complex128
ccoshq (__complex128 a)
{
__float128 r = REALPART (a), i = IMAGPART (a);
__complex128 v;
COMPLEX_ASSIGN (v, coshq (r) * cosq (i), sinhq (r) * sinq (i));
return v;
}
示例10: ctanhq
__complex128
ctanhq (__complex128 a)
{
__float128 rt = tanhq (REALPART (a)), it = tanq (IMAGPART (a));
__complex128 n, d;
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d, 1, rt * it);
return C128_DIV(n,d);
}
示例11: cexpl
long double complex
cexpl (long double complex z)
{
long double a, b;
long double complex v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cosl (b), sinl (b));
return expl (a) * v;
}
示例12: cexp
double complex
cexp (double complex z)
{
double a, b;
double complex v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cos (b), sin (b));
return exp (a) * v;
}
示例13: cexpf
float complex
cexpf (float complex z)
{
float a, b;
float complex v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cosf (b), sinf (b));
return expf (a) * v;
}
示例14: ccoshf
float complex
ccoshf (float complex a)
{
float r, i;
float complex v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, coshf (r) * cosf (i), - (sinhf (r) * sinf (i)));
return v;
}
示例15: cexpq
__complex128
cexpq (__complex128 z)
{
__float128 a, b;
__complex128 v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cosq (b), sinq (b));
return expq (a) * v;
}