本文整理汇总了C++中NT2_HORNER_COEFF_T函数的典型用法代码示例。如果您正苦于以下问题:C++ NT2_HORNER_COEFF_T函数的具体用法?C++ NT2_HORNER_COEFF_T怎么用?C++ NT2_HORNER_COEFF_T使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NT2_HORNER_COEFF_T函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dawson2
// computes dawson(a0)/a0 for double or double vectors
// xx is sqr(a0) and 3.25 <= abs(a0) <= 6.25
static BOOST_FORCEINLINE A0 dawson2(const A0& ox2, const A0 & x)
{
/* interval 3.25 to 6.25 */
A0 num = horner<NT2_HORNER_COEFF_T(sA0, 11,
(0x3f024ae3,
0xbe7aa0e7,
0x3dc0d25d,
0xbcb32b13,
0x3b6fff71,
0xb9dde22a,
0x3816d831,
0xb6100aef,
0x33c36c5f,
0xb1251d8a,
0x2e1dfe15
)
)> (ox2);
A0 denom = horner<NT2_HORNER_COEFF_T(sA0, 11,
(0x3f800000,
0xbf21c042,
0x3e726344,
0xbd59d3f0,
0x3c0af173,
0xba7882fc,
0x38a3cafe,
0xb698f761,
0x344b0b83,
0xb1a8d160,
0x2e9dfe10
)
)> (ox2);
return nt2::rec(x)+ox2*num/(denom*x);
}
开发者ID:JanVogelgesang,项目名称:nt2,代码行数:35,代码来源:dawson_kernel.hpp
示例2: kernel_atan
static inline A0_n kernel_atan(const A0_n a0_n)
{
typedef typename meta::scalar_of<A0>::type sA0;
const A0 tan3pio8 = double_constant<A0, 0x4003504f333f9de6ll>();
const A0 tanpio8 = double_constant<A0, 0x3fda827999fcef31ll>();
const A0 a0 = {a0_n};
const A0 x = nt2::abs(a0);
const bA0 flag1 = lt(x, tan3pio8);
const bA0 flag2 = logical_and(ge(x, tanpio8), flag1);
A0 yy = if_zero_else(flag1, Pio_2<A0>());
yy = select(flag2, Pio_4<A0>(), yy);
A0 xx = select(flag1, x, -rec(x));
xx = select(flag2, minusone(x)/oneplus(x),xx);
A0 z = sqr(xx);
z = z*horner< NT2_HORNER_COEFF_T(sA0, 5,
(0xbfec007fa1f72594ll,
0xc03028545b6b807all,
0xc052c08c36880273ll,
0xc05eb8bf2d05ba25ll,
0xc0503669fd28ec8ell)
)>(z)/
horner< NT2_HORNER_COEFF_T(sA0, 6,
(0x3ff0000000000000ll,
0x4038dbc45b14603cll,
0x4064a0dd43b8fa25ll,
0x407b0e18d2e2be3bll,
0x407e563f13b049eall,
0x4068519efbbd62ecll)
)>(z);
z = fma(xx, z, xx);
const A0 morebits = double_constant<A0, 0x3c91a62633145c07ll>();
z = seladd(flag2, z, mul(Half<A0>(), morebits));
z = z+if_zero_else(flag1, morebits);
return yy + z;
}
开发者ID:faldah,项目名称:nt2,代码行数:35,代码来源:d_invtrig.hpp
示例3: branch2
template < class AA0 > static inline AA0 branch2(const AA0 & x)
{
typedef typename meta::scalar_of<AA0>::type stype;
AA0 q = rec(x);
AA0 w = sqrt(q);
AA0 p3 = w *
horner< NT2_HORNER_COEFF_T(stype, 8,
(0x3d8d98f9,
0xbe69f6b3,
0x3ea0ad85,
0xbe574699,
0x3bb21b25,
0x3e18ec50,
0x36a6f7c5,
0x3f4c4229
) ) > (q);
w = sqr(q);
AA0 xn = q*
horner< NT2_HORNER_COEFF_T(stype, 8,
(0xc233e16d,
0x424af04a,
0xc1c6dca7,
0x40e72299,
0xbfc5bd69,
0x3eb364d9,
0xbe27bad7,
0x3ebfffdd
) ) > (w)-single_constant<AA0,0x4016cbe4 > ();
return if_zero_else(eq(x, Inf<AA0>()), p3*cos(xn+x));
}
开发者ID:pcaruan,项目名称:nt2,代码行数:30,代码来源:j1.hpp
示例4: kernel_log
static inline void kernel_log(const A0& a0,
A0& dk,
A0& hfsq,
A0& s,
A0& R,
A0& f)
{
typedef typename meta::as_integer<A0, signed>::type int_type;
typedef typename meta::scalar_of<A0>::type sA0;
A0 x;
int_type k;
nt2::fast_frexp(a0, x, k);
const int_type x_lt_sqrthf = nt2::is_greater(nt2::Sqrt_2o_2<A0>(), x)?nt2::Mone<int_type>():nt2::Zero<int_type>();
k += x_lt_sqrthf;
f = nt2::minusone(x+nt2::b_and(x, nt2::genmask(x_lt_sqrthf)));
dk = nt2::tofloat(k);
s = f/nt2::add(nt2::Two<A0>(),f);
A0 z = nt2::sqr(s);
A0 w = nt2::sqr(z);
A0 t1= w*nt2::horner<NT2_HORNER_COEFF_T(sA0, 3,
(0x3fc39a09d078c69fll,
0x3fcc71c51d8e78afll,
0x3fd999999997fa04ll)
)> (w);
A0 t2= z*horner<NT2_HORNER_COEFF_T(sA0, 4,
(0x3fc2f112df3e5244ll,
0x3fc7466496cb03dell,
0x3fd2492494229359ll,
0x3fe5555555555593ll)
)> (w);
R = t2+t1;
hfsq = nt2::mul(Half<A0>(), nt2::sqr(f));
}
开发者ID:sschaetz,项目名称:nt2,代码行数:33,代码来源:d_log.hpp
示例5: kernel_log
static inline void kernel_log(const A0& a0,
A0& dk,
A0& hfsq,
A0& s,
A0& R,
A0& f)
{
A0 x;
int_type k(fast_frexp(a0, x));
const int_type x_lt_sqrthf = -isgt(Sqrt_2o_2<A0>(), x);
k += x_lt_sqrthf;
f = minusone(x+b_and(x, genmask<A0>(x_lt_sqrthf)));
dk = tofloat(k);
s = f/add(Two<A0>(),f);
A0 z = sqr(s);
A0 w = sqr(z);
A0 t1= w*horner<NT2_HORNER_COEFF_T(A0, 3,
(0x3fc39a09d078c69fll,
0x3fcc71c51d8e78afll,
0x3fd999999997fa04ll)
)> (w);
A0 t2= z*horner<NT2_HORNER_COEFF_T(A0, 4,
(0x3fc2f112df3e5244ll,
0x3fc7466496cb03dell,
0x3fd2492494229359ll,
0x3fe5555555555593ll)
)> (w);
R = t2+t1;
hfsq = mul(Half<A0>(), sqr(f));
}
开发者ID:KWMalik,项目名称:nt2,代码行数:30,代码来源:d_log_approximation.hpp
示例6: branch2
template < class AA0 > static inline AA0 branch2(const AA0 & a0)
{
typedef typename meta::scalar_of<AA0>::type sAA0;
AA0 q = rec(a0);
AA0 w = sqrt(q);
AA0 p3 = w *
horner< NT2_HORNER_COEFF_T(sAA0, 8,
(0xbd8c100e,
0x3e3ef887,
0xbe5ba616,
0x3df54214,
0xbb69539e,
0xbd4b8bc1,
0xb6612dc2,
0x3f4c422a
) ) > (q);
w = sqr(q);
AA0 xn = q*
horner< NT2_HORNER_COEFF_T(sAA0, 8,
(0x4201aee0,
0xc2113945,
0x418c7f6a,
0xc09f3306,
0x3f8040aa,
0xbe46a57f,
0x3d84ed6e,
0xbdffff97
) ) > (w)-Pio_4<AA0>();
return if_zero_else(eq(a0, Inf<AA0>()), p3*nt2::sin(xn+a0));
}
开发者ID:Quanteek,项目名称:nt2,代码行数:30,代码来源:y0.hpp
示例7: asin
static inline A0_n asin(const A0_n a0_n)
{
const A0 a0 = { a0_n };
typedef typename meta::scalar_of<A0>::type sA0;
A0 x = nt2::abs(a0);
const A0 pio4 = Pio_4<A0>();
const bA0 small= lt(x, Sqrteps<A0>());
const A0 morebits = double_constant<A0, 0xbc91a62633145c07ll>();
const A0 ct1 = double_constant<A0, 0x3fe4000000000000ll>();
A0 zz1 = oneminus(x);
const A0 vp = zz1*horner< NT2_HORNER_COEFF_T(sA0, 5,
(0x3f684fc3988e9f08ll,
0xbfe2079259f9290fll,
0x401bdff5baf33e6all,
0xc03991aaac01ab68ll,
0x403c896240f3081dll)
)>(zz1)/
horner< NT2_HORNER_COEFF_T(sA0, 5,
(0x3ff0000000000000ll,
0xc035f2a2b6bf5d8cll,
0x40626219af6a7f42ll,
0xc077fe08959063eell,
0x40756709b0b644bell)
)>(zz1);
zz1 = sqrt(zz1+zz1);
A0 z = pio4-zz1;
zz1 = fma(zz1, vp, morebits);
z = z-zz1;
zz1 = z+pio4;
A0 zz2 = sqr(a0);
z = zz2*horner< NT2_HORNER_COEFF_T(sA0, 6,
(0x3f716b9b0bd48ad3ll,
0xbfe34341333e5c16ll,
0x4015c74b178a2dd9ll,
0xc0304331de27907bll,
0x40339007da779259ll,
0xc020656c06ceafd5ll)
)>(zz2)/
horner< NT2_HORNER_COEFF_T(sA0, 6,
(0x3ff0000000000000ll,
0xc02d7b590b5e0eabll,
0x40519fc025fe9054ll,
0xc06265bb6d3576d7ll,
0x4061705684ffbf9dll,
0xc04898220a3607acll)
)>(zz2);
zz2 = x*z+x;
return if_nan_else( gt(x, One<A0>())
, b_xor ( select( small
, x
, select( gt(x, ct1)
, zz1
, zz2
)
)
, bitofsign(a0)
)
);
}
开发者ID:faldah,项目名称:nt2,代码行数:59,代码来源:d_invtrig.hpp
示例8: asin
static inline A0 asin(const A0& a0)
{
A0 x = nt2::abs(a0);
if ((x > One<A0>())) return Nan<A0>();
if ((x < Sqrteps<A0>())) return a0;
A0 zz;
if((x > double_constant<double,0x3fe4000000000000ll> ())) //0.625;
{
zz = oneminus(x);
const A0 vp = zz*horner< NT2_HORNER_COEFF_T(stype, 5,
(0x3f684fc3988e9f08ll,
0xbfe2079259f9290fll,
0x401bdff5baf33e6all,
0xc03991aaac01ab68ll,
0x403c896240f3081dll)
)>(zz)/
horner< NT2_HORNER_COEFF_T(stype, 5,
(0x3ff0000000000000ll,
0xc035f2a2b6bf5d8cll,
0x40626219af6a7f42ll,
0xc077fe08959063eell,
0x40756709b0b644bell)
)>(zz);
zz = sqrt(zz+zz);
A0 z = Pio_4<A0>()-zz;
zz = madd(zz, vp, double_constant<double,0xbc91a62633145c07ll>());
z = z-zz;
zz = z+Pio_4<A0>();
}
else
{
zz = sqr(x);
A0 z = zz*horner< NT2_HORNER_COEFF_T(stype, 6,
(0x3f716b9b0bd48ad3ll,
0xbfe34341333e5c16ll,
0x4015c74b178a2dd9ll,
0xc0304331de27907bll,
0x40339007da779259ll,
0xc020656c06ceafd5ll)
)>(zz)/
horner< NT2_HORNER_COEFF_T(stype, 6,
(0x3ff0000000000000ll,
0xc02d7b590b5e0eabll,
0x40519fc025fe9054ll,
0xc06265bb6d3576d7ll,
0x4061705684ffbf9dll,
0xc04898220a3607acll)
)>(zz);
zz = x*z+x;
}
return b_xor(bitofsign(a0), zz);
}
开发者ID:msuchard,项目名称:nt2,代码行数:52,代码来源:d_invtrig.hpp
示例9: base_tan_eval
static inline A0 base_tan_eval(const A0& x)
{
const A0 zz = sqr(x);
const A0 num = horner< NT2_HORNER_COEFF_T(stype, 3, (0xc0c992d8d24f3f38ll,
0x413199eca5fc9dddll,
0xc1711fead3299176ll))>(zz);
const A0 den = horner< NT2_HORNER_COEFF_T(stype, 5, (0x3ff0000000000000ll,
0x40cab8a5eeb36572ll,
0xc13427bc582abc96ll,
0x4177d98fc2ead8efll,
0xc189afe03cbe5a31ll))>(zz);
return x+ x*(zz*(num/den));
}
开发者ID:fpelliccioni,项目名称:nt2,代码行数:13,代码来源:d_trig_evaluation.hpp
示例10: asin
static inline A0_n asin(const A0_n a0_n)
{
const A0 a0 = a0_n;
A0 sign, x;
x = nt2::abs(a0);
sign = nt2::bitofsign(a0);
const bA0 x_larger_05 = gt(x, nt2::Half<A0>());
A0 z = if_else(x_larger_05, nt2::Half<A0>()*nt2::oneminus(x), nt2::sqr(x));
x = if_else(x_larger_05, sqrt(z), x);
// remez polynomial of degree 4 for (asin(rx)-rx)/(rx*rx*rx) in [0, 0.25]
// 2120752146 values (99.53%) within 0.0 ULPs
// 9954286 values (0.47%) within 0.5 ULPs
// 4.0 cycles/element SSE4.2 g++-4.8
A0 z1 = horner<NT2_HORNER_COEFF_T(sA0, 5,
( 0x3d2cb352,
0x3cc617e3,
0x3d3a3ec7,
0x3d9980f6,
0x3e2aaae4
)
)> (z);
z1 = nt2::fma(z1, z*x, x);
z = if_else(x_larger_05, nt2::Pio_2<A0>()-(z1+z1), z1);
return nt2::b_xor(z, sign);
}
开发者ID:JanVogelgesang,项目名称:nt2,代码行数:25,代码来源:f_invtrig.hpp
示例11: kernel_atan
static inline A0_n kernel_atan(const A0_n a0_n)
{
//4278190076 values computed in range: [-3.40282e+38, 3.40282e+38]
//4257598358 values (99.52%) within 0.0 ULPs
// 20591718 values (0.48%) within 0.5 ULPs
const A0 a0 = a0_n;
const A0 x = nt2::abs(a0);
//here x is positive
const bA0 flag1 = nt2::lt(x, Tan_3pio_8<A0>());
const bA0 flag2 = nt2::logical_and(nt2::ge(x,single_constant<A0, 0x3ed413cd>()), flag1);
A0 yy = nt2::if_zero_else(flag1, Pio_2<A0>());
yy = nt2::if_else(flag2, Pio_4<A0>(), yy);
A0 xx = nt2::if_else(flag1, x, -rec(x));
xx = nt2::if_else(flag2, (nt2::minusone(x)/nt2::oneplus(x)),xx);
const A0 z = nt2::sqr(xx);
A0 z1 = horner<NT2_HORNER_COEFF_T(sA0, 4,
( 0x3da4f0d1ul // 8.5460119e-02
, 0xbe0e1b85ul // -1.4031009e-01
, 0x3e4c925ful // 1.9991724e-01
, 0xbeaaaa2aul // -3.3333293e-01
)
)> (z);
z1 = nt2::fma(xx, nt2::mul( z1, z), xx);
z1 = ifadd(flag2, z1, Pio_4lo<A0>());
z1 = ifnotadd(flag1, z1, Pio_2lo<A0>());
return yy+z1;
}
开发者ID:JanVogelgesang,项目名称:nt2,代码行数:28,代码来源:f_invtrig.hpp
示例12: atan
static inline A0 atan(const A0& a0)
{
// static const A0 tanpio8 = double_constant<double, 0x3fda827999fcef31ll>();
if (is_eqz(a0)) return a0;
if (is_inf(a0)) return Pio_2<A0>()*sign(a0);
A0 x = nt2::abs(a0);
A0 y;
A0 flag = (x > double_constant<double,0x4003504f333f9de6ll>());
if (flag)
{
y = Pio_2<A0>();
x = -rec(x);
}
else if ((x <= double_constant<double,0x3fe51eb851eb851fll>()))
{
y = Zero<A0>();
}
else
{
y = Pio_4<A0>();
flag = Half<A0>();
x = minusone(x)/oneplus(x);
}
A0 z = sqr(x);
z = z*horner< NT2_HORNER_COEFF_T(stype, 5,
(0xbfec007fa1f72594ll,
0xc03028545b6b807all,
0xc052c08c36880273ll,
0xc05eb8bf2d05ba25ll,
0xc0503669fd28ec8ell)
)>(z)/
horner< NT2_HORNER_COEFF_T(stype, 6,
(0x3ff0000000000000ll,
0x4038dbc45b14603cll,
0x4064a0dd43b8fa25ll,
0x407b0e18d2e2be3bll,
0x407e563f13b049eall,
0x4068519efbbd62ecll)
)>(z);
z = madd(x, z, x);
static const A0 morebits = double_constant<double,0x3c91a62633145c07ll>();
z += flag * morebits;
y = y + z;
if( is_ltz(a0) ) y = -y;
return(y);
}
开发者ID:msuchard,项目名称:nt2,代码行数:46,代码来源:d_invtrig.hpp
示例13: compute
// computes sinh for abs(a0) < 1 and x2 = sqr(a0) for doubles
static BOOST_FORCEINLINE A0 compute(const A0& a0, const A0& x2)
{
typedef typename meta::scalar_of<A0>::type sA0;
return fma(a0, x2*horner<NT2_HORNER_COEFF_T(sA0, 4,
( 0xbfe9435fe8bb3cd6ull, // -7.89474443963537015605E-1,
0xc064773a398ff4feull, // -1.63725857525983828727E2,
0xc0c694b8c71d6182ull, // -1.15614435765005216044E4,
0xc115782bdbf6ab05ull // -3.51754964808151394800E5
)
)> (x2)/
horner<NT2_HORNER_COEFF_T(sA0, 4,
( 0x3ff0000000000000ull, // 1.00000000000000000000E0,
0xc0715b6096e96484ull, // -2.77711081420602794433E2,
0x40e1a7ba7ed72245ull, // 3.61578279834431989373E4,
0xc1401a20e4f90044ull // -2.11052978884890840399E6
)
)> (x2), a0);
}
开发者ID:JanVogelgesang,项目名称:nt2,代码行数:19,代码来源:sinh_kernel.hpp
示例14: approx
static inline A0 approx(const A0& x)
{
typedef typename meta::scalar_of<A0>::type sA0;
const A0 t = nt2::sqr(x);
return x
- t*nt2::horner<NT2_HORNER_COEFF_T( sA0, 3,
(0x3888d272, 0xbb360954, 0x3e2aaaaa)
)> (t);
}
开发者ID:joker-eph,项目名称:nt2,代码行数:9,代码来源:f_expo_reduction.hpp
示例15: approx
static inline A0 approx(const A0& x)
{
typedef typename meta::scalar_of<A0>::type sA0;
A0 xx = sqr(x);
A0 px = x*horner<NT2_HORNER_COEFF_T(sA0, 4,
(0x3fa4fd75f3062dd4ll,
0x40277d9474c55934ll,
0x40796b7a050349e4ll,
0x40a2b4798e134a01ll)
)> (xx);
A0 x2 = px/( horner<NT2_HORNER_COEFF_T(sA0, 4,
(0x3ff0000000000000ll,
0x405545fdce51ca08ll,
0x4093e05eefd67782ll,
0x40a03f37650df6e2ll)
)> (xx)-px);
return oneplus(x2+x2);
}
开发者ID:faldah,项目名称:nt2,代码行数:18,代码来源:d_expo_reduction.hpp
示例16: sin_eval
static inline A0 sin_eval(const A0& z, const A0& x)
{
const A0 y1 = horner< NT2_HORNER_COEFF_T(stype, 6, (0x3de5d8fd1fcf0ec1ll,
0xbe5ae5e5a9291691ll,
0x3ec71de3567d4896ll,
0xbf2a01a019bfdf03ll,
0x3f8111111110f7d0ll,
0xbfc5555555555548ll) ) > (z);
return madd(mul(y1,z),x,x);
}
开发者ID:fpelliccioni,项目名称:nt2,代码行数:10,代码来源:d_trig_evaluation.hpp
示例17: base_tancot_eval
static inline A0 base_tancot_eval(const A0& z)
{
const A0 zz = sqr(z);
return horner< NT2_HORNER_COEFF_T(stype, 6, (0x3c19c53b,
0x3b4c779c,
0x3cc821b5,
0x3d5ac5c9,
0x3e0896dd,
0x3eaaaa6f))>(zz)*zz*z+z;
}
开发者ID:francescog,项目名称:nt2,代码行数:10,代码来源:f_trig_evaluation.hpp
示例18: cos_eval
static inline A0 cos_eval(const A0& z)
{
const A0 y = horner< NT2_HORNER_COEFF_T(stype, 7, (0x3da8ff831ad9b219ll,
0xbe21eea7c1e514d4ll,
0x3e927e4f8e06d9a5ll,
0xbefa01a019ddbcd9ll,
0x3f56c16c16c15d47ll,
0xbfa5555555555551ll,
0x3fe0000000000000ll) ) > (z);
return oneminus(y*z);
}
开发者ID:fpelliccioni,项目名称:nt2,代码行数:11,代码来源:d_trig_evaluation.hpp
示例19: sin_eval
static inline A0_n sin_eval(const A0_n z_n, const A0& x)
{
const A0 z = z_n;
const A0 y1 = nt2::horner< NT2_HORNER_COEFF_T(stype, 6, (0x3de5d8fd1fcf0ec1ll,
0xbe5ae5e5a9291691ll,
0x3ec71de3567d4896ll,
0xbf2a01a019bfdf03ll,
0x3f8111111110f7d0ll,
0xbfc5555555555548ll) ) > (z);
return nt2::fma(y1*z,x,x);
}
开发者ID:recampbell,项目名称:nt2,代码行数:11,代码来源:d_trig_evaluation.hpp
示例20: base_tan_eval
static inline A0 base_tan_eval(const A0& z)
{
const A0 zz = nt2::sqr(z);
A0 y = nt2::horner< NT2_HORNER_COEFF_T(A0, 6, (0x3c19c53b,
0x3b4c779c,
0x3cc821b5,
0x3d5ac5c9,
0x3e0896dd,
0x3eaaaa6f))>(zz)*zz*z+z;
return y;
}
开发者ID:recampbell,项目名称:nt2,代码行数:11,代码来源:f_trig_evaluation.hpp
注:本文中的NT2_HORNER_COEFF_T函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论