当前位置: 首页>>代码示例>>C++>>正文


C++ IMAGPART函数代码示例

本文整理汇总了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);
    }
}
开发者ID:fredrik-johansson,项目名称:bland,代码行数:29,代码来源:equal.c

示例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;
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:8,代码来源:complex.c

示例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;
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:10,代码来源:complex.c

示例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);
    }
}
开发者ID:fredrik-johansson,项目名称:bland,代码行数:50,代码来源:sub.c

示例5: cimag

double
cimag(double complex z)
{
	const double_complex z1 = { .f = z };

	return (IMAGPART(z1));
}
开发者ID:GRDSP,项目名称:grdsp,代码行数:7,代码来源:s_cimag.c

示例6: cimagf

float
cimagf(float complex z)
{
	const float_complex z1 = { .f = z };

	return (IMAGPART(z1));
}
开发者ID:Mic92,项目名称:Determinator,代码行数:7,代码来源:s_cimagf.c

示例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));
}
开发者ID:BackupTheBerlios,项目名称:iphone-binutils-svn,代码行数:9,代码来源:exp_c4.c

示例8: cimagl

long double
cimagl(long double complex z)
{
	const long_double_complex z1 = { .f = z };

	return (IMAGPART(z1));
}
开发者ID:alexandermerritt,项目名称:dragonfly,代码行数:7,代码来源:s_cimagl.c

示例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;
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:8,代码来源:complex.c

示例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);
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:9,代码来源:complex.c

示例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;
}
开发者ID:5432935,项目名称:crossbridge,代码行数:11,代码来源:c99_functions.c

示例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;
}
开发者ID:5432935,项目名称:crossbridge,代码行数:11,代码来源:c99_functions.c

示例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;
}
开发者ID:5432935,项目名称:crossbridge,代码行数:11,代码来源:c99_functions.c

示例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;
}
开发者ID:5432935,项目名称:crossbridge,代码行数:11,代码来源:c99_functions.c

示例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;
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:11,代码来源:complex.c


注:本文中的IMAGPART函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。