Module: Numo::GSL

Defined in:
ext/numo/gsl/interp/gsl_interp.c,
ext/numo/gsl/stats/gsl_stats.c,
ext/numo/gsl/const/gsl_const.c,
ext/numo/gsl/rstat/gsl_rstat.c,
ext/numo/gsl/sf/gsl_sf.c,
ext/numo/gsl/poly/gsl_poly.c,
ext/numo/gsl/histogram/gsl_histogram.c,
ext/numo/gsl/pdf/gsl_pdf.c,
ext/numo/gsl/multifit/gsl_multifit.c,
ext/numo/gsl/fit/gsl_fit.c,
ext/numo/gsl/sys/gsl_sys.c,
ext/numo/gsl/rng/gsl_rng.c,
ext/numo/gsl/err/err.c,
ext/numo/gsl/ran/gsl_ran.c,
ext/numo/gsl/cdf/gsl_cdf.c,
ext/numo/gsl/wavelet/gsl_wavelet.c,
ext/numo/gsl/spmatrix/gsl_spmatrix.c

Defined Under Namespace

Modules: Cdf, Const, Fit, Multifit, Pdf, Poly, Ran, Sf, SpBlas, SpLinalg, Stats Classes: GslError, Histogram, Histogram2D, Histogram2DPdf, HistogramPdf, InterpAccel, Rng, Rstat, SpMatrix, Spline, Spline2D, Wavelet, Wavelet2D, WaveletWorkspace

Constant Summary

MODE_DEFAULT =
DBL2NUM(GSL_MODE_DEFAULT)
PREC_APPROX =
DBL2NUM(GSL_PREC_APPROX)
PREC_DOUBLE =
DBL2NUM(GSL_PREC_DOUBLE)
PREC_SINGLE =
DBL2NUM(GSL_PREC_SINGLE)
M_1_PI =

The reciprocal of pi, 1/\pi

DBL2NUM(M_1_PI)
M_2_PI =

Twice the reciprocal of pi, 2/\pi

DBL2NUM(M_2_PI)
M_2_SQRTPI =

Two divided by the square root of pi, 2/\sqrt\pi

DBL2NUM(M_2_SQRTPI)
M_E =

The base of exponentials, e

DBL2NUM(M_E)
M_EULER =

Euler’s constant, \gamma

DBL2NUM(M_EULER)
M_LN10 =

The natural logarithm of ten, \ln(10)

DBL2NUM(M_LN10)
M_LN2 =

The natural logarithm of two, \ln(2)

DBL2NUM(M_LN2)
M_LNPI =

The natural logarithm of pi, \ln(\pi)

DBL2NUM(M_LNPI)
M_LOG10E =

The base-10 logarithm of e, $\log_10(e)$ \log_10 (e)

DBL2NUM(M_LOG10E)
M_LOG2E =

The base-2 logarithm of e, \log_2 (e)

DBL2NUM(M_LOG2E)
M_PI =

The constant pi, \pi

DBL2NUM(M_PI)
M_PI_2 =

Pi divided by two, \pi/2

DBL2NUM(M_PI_2)
M_PI_4 =

Pi divided by four, \pi/4

DBL2NUM(M_PI_4)
M_SQRT1_2 =

The square root of one-half, $\sqrt1/2$ \sqrt[1/2]

DBL2NUM(M_SQRT1_2)
M_SQRT2 =

The square root of two, \sqrt 2

DBL2NUM(M_SQRT2)
M_SQRT3 =

The square root of three, \sqrt 3

DBL2NUM(M_SQRT3)
M_SQRTPI =

The square root of pi, \sqrt\pi

DBL2NUM(M_SQRTPI)
EIGEN_SORT_VAL_ASC =
INT2FIX(0)
EIGEN_SORT_VAL_DESC =
INT2FIX(1)
EIGEN_SORT_ABS_ASC =
INT2FIX(2)
EIGEN_SORT_ABS_DESC =
INT2FIX(3)
SUCCESS =
INT2FIX(0)
FAILURE =
INT2FIX(-1)
CONTINUE =

iteration has not converged

INT2FIX(-2)
EDOM =

input domain error, e.g sqrt(-1)

INT2FIX(1)
ERANGE =

output range error, e.g. exp(1e100)

INT2FIX(2)
EFAULT =

invalid pointer

INT2FIX(3)
EINVAL =

invalid argument supplied by user

INT2FIX(4)
EFAILED =

generic failure

INT2FIX(5)
EFACTOR =

factorization failed

INT2FIX(6)
ESANITY =

sanity check failed - shouldn’t happen

INT2FIX(7)
ENOMEM =

malloc failed

INT2FIX(8)
EBADFUNC =

problem with user-supplied function

INT2FIX(9)
ERUNAWAY =

iterative process is out of control

INT2FIX(10)
EMAXITER =

exceeded max number of iterations

INT2FIX(11)
EZERODIV =

tried to divide by zero

INT2FIX(12)
EBADTOL =

user specified an invalid tolerance

INT2FIX(13)
ETOL =

failed to reach the specified tolerance

INT2FIX(14)
EUNDRFLW =

underflow

INT2FIX(15)
EOVRFLW =

overflow

INT2FIX(16)
ELOSS =

loss of accuracy

INT2FIX(17)
EROUND =

failed because of roundoff error

INT2FIX(18)
EBADLEN =

matrix, vector lengths are not conformant

INT2FIX(19)
ENOTSQR =

matrix not square

INT2FIX(20)
ESING =

apparent singularity detected

INT2FIX(21)
EDIVERGE =

integral or series is divergent

INT2FIX(22)
EUNSUP =

requested feature is not supported by the hardware

INT2FIX(23)
EUNIMPL =

requested feature not (yet) implemented

INT2FIX(24)
ECACHE =

cache limit exceeded

INT2FIX(25)
ETABLE =

table limit exceeded

INT2FIX(26)
ENOPROG =

iteration is not making progress towards solution

INT2FIX(27)
ENOPROGJ =

jacobian evaluations are not improving the solution

INT2FIX(28)
ETOLF =

cannot reach the specified tolerance in F

INT2FIX(29)
ETOLX =

cannot reach the specified tolerance in X

INT2FIX(30)
ETOLG =

cannot reach the specified tolerance in gradient

INT2FIX(31)
EOF =

end of file

INT2FIX(32)
MESSAGE_MASK_A =
INT2FIX(1)
MESSAGE_MASK_B =
INT2FIX(2)
MESSAGE_MASK_C =
INT2FIX(4)
MESSAGE_MASK_D =
INT2FIX(8)
MESSAGE_MASK_E =
INT2FIX(16)
MESSAGE_MASK_F =
INT2FIX(32)
MESSAGE_MASK_G =
INT2FIX(64)
MESSAGE_MASK_H =
INT2FIX(128)
IEEE_TYPE_NAN =
INT2FIX(1)
IEEE_TYPE_INF =
INT2FIX(2)
IEEE_TYPE_NORMAL =
INT2FIX(3)
IEEE_TYPE_DENORMAL =
INT2FIX(4)
IEEE_TYPE_ZERO =
INT2FIX(5)
IEEE_SINGLE_PRECISION =
INT2FIX(1)
IEEE_DOUBLE_PRECISION =
INT2FIX(2)
IEEE_EXTENDED_PRECISION =
INT2FIX(3)
IEEE_ROUND_TO_NEAREST =
INT2FIX(1)
IEEE_ROUND_DOWN =
INT2FIX(2)
IEEE_ROUND_UP =
INT2FIX(3)
IEEE_ROUND_TO_ZERO =
INT2FIX(4)
IEEE_MASK_INVALID =
INT2FIX(1)
IEEE_MASK_DENORMALIZED =
INT2FIX(2)
IEEE_MASK_DIVISION_BY_ZERO =
INT2FIX(4)
IEEE_MASK_OVERFLOW =
INT2FIX(8)
IEEE_MASK_UNDERFLOW =
INT2FIX(16)
IEEE_MASK_ALL =
INT2FIX(31)
IEEE_TRAP_INEXACT =
INT2FIX(32)
INTEG_GAUSS15 =

15 point Gauss-Kronrod rule

INT2FIX(1)
INTEG_GAUSS21 =

21 point Gauss-Kronrod rule

INT2FIX(2)
INTEG_GAUSS31 =

31 point Gauss-Kronrod rule

INT2FIX(3)
INTEG_GAUSS41 =

41 point Gauss-Kronrod rule

INT2FIX(4)
INTEG_GAUSS51 =

51 point Gauss-Kronrod rule

INT2FIX(5)
INTEG_GAUSS61 =

61 point Gauss-Kronrod rule

INT2FIX(6)
VEGAS_MODE_IMPORTANCE =
INT2FIX(1)
VEGAS_MODE_IMPORTANCE_ONLY =
INT2FIX(0)
VEGAS_MODE_STRATIFIED =
INT2FIX(-1)

Class Method Summary collapse

Class Method Details

.acosh(x) ⇒ DFloat

This function computes the value of \arccosh(x). It provides an alternative to the standard math function acosh(x).

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



356
357
358
359
360
361
362
363
364
# File 'ext/numo/gsl/sys/gsl_sys.c', line 356

static VALUE
sys_s_acosh(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_acosh, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.asinh(x) ⇒ DFloat

This function computes the value of \arcsinh(x). It provides an alternative to the standard math function asinh(x).

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



395
396
397
398
399
400
401
402
403
# File 'ext/numo/gsl/sys/gsl_sys.c', line 395

static VALUE
sys_s_asinh(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_asinh, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.atanh(x) ⇒ DFloat

This function computes the value of \arctanh(x). It provides an alternative to the standard math function atanh(x).

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



434
435
436
437
438
439
440
441
442
# File 'ext/numo/gsl/sys/gsl_sys.c', line 434

static VALUE
sys_s_atanh(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_atanh, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.expm1(x) ⇒ DFloat

This function computes the value of \exp(x)-1 in a way that is accurate for small x. It provides an alternative to the BSD math function expm1(x).

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



227
228
229
230
231
232
233
234
235
# File 'ext/numo/gsl/sys/gsl_sys.c', line 227

static VALUE
sys_s_expm1(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_expm1, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.fcmp(x, y, epsilon) ⇒ Int

This function determines whether x and y are approximately equal to a relative accuracy epsilon.

The relative accuracy is measured using an interval of size 2 \delta, where \delta = 2^k \epsilon and k is the maximum base-2 exponent of x and y as computed by the function frexp.

If x and y lie within this interval, they are considered approximately equal and the function returns 0. Otherwise if x < y, the function returns -1, or if x > y, the function returns +1.

Note that x and y are compared to relative accuracy, so this function is not suitable for testing whether a value is approximately zero.

The implementation is based on the package fcmp by T.C. Belding.

Parameters:

  • x (DFloat)
  • y (DFloat)
  • epsilon (DFloat)

Returns:

  • (Int)

    result



1014
1015
1016
1017
1018
1019
1020
1021
1022
# File 'ext/numo/gsl/sys/gsl_sys.c', line 1014

static VALUE
sys_s_fcmp(VALUE mod, VALUE v0, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[3] = {{cDF,0},{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cI,0}};
    ndfunc_t ndf = {iter_sys_s_fcmp, STRIDE_LOOP|NDF_EXTRACT, 3,1, ain,aout};

    return na_ndloop(&ndf, 3, v0, v1, v2);
}

.finite(x) ⇒ Int

This function returns 1 if x is a real number, and 0 if it is infinite or not-a-number.

Parameters:

  • x (DFloat)

Returns:

  • (Int)

    result



147
148
149
150
151
152
153
154
155
# File 'ext/numo/gsl/sys/gsl_sys.c', line 147

static VALUE
sys_s_finite(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cI,0}};
    ndfunc_t ndf = {iter_sys_s_finite, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.frexp(x) ⇒ DFloat

This function splits the number x into its normalized fraction f and exponent e, such that x = f * 2^e and $0.5 \le f < 1$ 0.5 <= f < 1. The function returns f and stores the exponent in e. If x is zero, both f and e are set to zero. This function provides an alternative to the standard math function frexp(x, e).

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    array of [result, e]



524
525
526
527
528
529
530
531
532
# File 'ext/numo/gsl/sys/gsl_sys.c', line 524

static VALUE
sys_s_frexp(VALUE mod, VALUE v0, VALUE v1)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[2] = {{cDF,0},{cInt,0}};
    ndfunc_t ndf = {iter_sys_s_frexp, STRIDE_LOOP|NDF_EXTRACT, 1,2, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.hypot(x, y) ⇒ DFloat

This function computes the value of $\sqrt+ y^2$ \sqrt[x^2 + y^2] in a way that avoids overflow. It provides an alternative to the BSD math function hypot(x,y).

Parameters:

  • x (DFloat)
  • y (DFloat)

Returns:

  • (DFloat)

    result



271
272
273
274
275
276
277
278
279
# File 'ext/numo/gsl/sys/gsl_sys.c', line 271

static VALUE
sys_s_hypot(VALUE mod, VALUE v0, VALUE v1)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_hypot, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};

    return na_ndloop(&ndf, 2, v0, v1);
}

.hypot3(x, y, z) ⇒ DFloat

This function computes the value of $\sqrt+ y^2 + z^2$ \sqrt[x^2 + y^2 + z^2] in a way that avoids overflow.

Parameters:

  • x (DFloat)
  • y (DFloat)
  • z (DFloat)

Returns:

  • (DFloat)

    result



317
318
319
320
321
322
323
324
325
# File 'ext/numo/gsl/sys/gsl_sys.c', line 317

static VALUE
sys_s_hypot3(VALUE mod, VALUE v0, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[3] = {{cDF,0},{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_hypot3, STRIDE_LOOP|NDF_EXTRACT, 3,1, ain,aout};

    return na_ndloop(&ndf, 3, v0, v1, v2);
}

.isinf(x) ⇒ Int

This function returns +1 if x is positive infinity, -1 if x is negative infinity and 0 otherwise.Note that the C99 standard only requires the system isinf function to return a non-zero value, without the sign of the infinity. The implementation in some earlier versions of GSL used the system isinf function and may have this behavior on some platforms. Therefore, it is advisable to test the sign of x separately, if needed, rather than relying the sign of the return value from gsl_isinf().

Parameters:

  • x (DFloat)

Returns:

  • (Int)

    result



107
108
109
110
111
112
113
114
115
# File 'ext/numo/gsl/sys/gsl_sys.c', line 107

static VALUE
sys_s_isinf(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cI,0}};
    ndfunc_t ndf = {iter_sys_s_isinf, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.isnan(x) ⇒ Int

This function returns 1 if x is not-a-number.

Parameters:

  • x (DFloat)

Returns:

  • (Int)

    result



60
61
62
63
64
65
66
67
68
# File 'ext/numo/gsl/sys/gsl_sys.c', line 60

static VALUE
sys_s_isnan(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cI,0}};
    ndfunc_t ndf = {iter_sys_s_isnan, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.ldexp(x, e) ⇒ DFloat

This function computes the value of x * 2^e. It provides an alternative to the standard math function ldexp(x,e).

Parameters:

  • x (DFloat)
  • e (DFloat)

Returns:

  • (DFloat)

    result



477
478
479
480
481
482
483
484
485
# File 'ext/numo/gsl/sys/gsl_sys.c', line 477

static VALUE
sys_s_ldexp(VALUE mod, VALUE v0, VALUE v1)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cInt,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_ldexp, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};

    return na_ndloop(&ndf, 2, v0, v1);
}

.log1p(x) ⇒ DFloat

This function computes the value of \log(1+x) in a way that is accurate for small x. It provides an alternative to the BSD math function log1p(x).

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



187
188
189
190
191
192
193
194
195
# File 'ext/numo/gsl/sys/gsl_sys.c', line 187

static VALUE
sys_s_log1p(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_log1p, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_2(x) ⇒ DFloat

These functions can be used to compute small integer powers x^2, x^3, etc. efficiently. The functions will be inlined when HAVE_INLINE is defined, so that use of these functions should be as efficient as explicitly writing the corresponding product expression.

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



658
659
660
661
662
663
664
665
666
# File 'ext/numo/gsl/sys/gsl_sys.c', line 658

static VALUE
sys_s_pow_2(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_2, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_3(x) ⇒ DFloat

These functions can be used to compute small integer powers x^2, x^3, etc. efficiently. The functions will be inlined when HAVE_INLINE is defined, so that use of these functions should be as efficient as explicitly writing the corresponding product expression.

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



700
701
702
703
704
705
706
707
708
# File 'ext/numo/gsl/sys/gsl_sys.c', line 700

static VALUE
sys_s_pow_3(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_3, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_4(x) ⇒ DFloat

These functions can be used to compute small integer powers x^2, x^3, etc. efficiently. The functions will be inlined when HAVE_INLINE is defined, so that use of these functions should be as efficient as explicitly writing the corresponding product expression.

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



742
743
744
745
746
747
748
749
750
# File 'ext/numo/gsl/sys/gsl_sys.c', line 742

static VALUE
sys_s_pow_4(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_4, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_5(x) ⇒ DFloat

These functions can be used to compute small integer powers x^2, x^3, etc. efficiently. The functions will be inlined when HAVE_INLINE is defined, so that use of these functions should be as efficient as explicitly writing the corresponding product expression.

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



784
785
786
787
788
789
790
791
792
# File 'ext/numo/gsl/sys/gsl_sys.c', line 784

static VALUE
sys_s_pow_5(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_5, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_6(x) ⇒ DFloat

These functions can be used to compute small integer powers x^2, x^3, etc. efficiently. The functions will be inlined when HAVE_INLINE is defined, so that use of these functions should be as efficient as explicitly writing the corresponding product expression.

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



826
827
828
829
830
831
832
833
834
# File 'ext/numo/gsl/sys/gsl_sys.c', line 826

static VALUE
sys_s_pow_6(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_6, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_7(x) ⇒ DFloat

These functions can be used to compute small integer powers x^2, x^3, etc. efficiently. The functions will be inlined when HAVE_INLINE is defined, so that use of these functions should be as efficient as explicitly writing the corresponding product expression.

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



868
869
870
871
872
873
874
875
876
# File 'ext/numo/gsl/sys/gsl_sys.c', line 868

static VALUE
sys_s_pow_7(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_7, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_8(x) ⇒ DFloat

These functions can be used to compute small integer powers x^2, x^3, etc. efficiently. The functions will be inlined when HAVE_INLINE is defined, so that use of these functions should be as efficient as explicitly writing the corresponding product expression.

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



910
911
912
913
914
915
916
917
918
# File 'ext/numo/gsl/sys/gsl_sys.c', line 910

static VALUE
sys_s_pow_8(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_8, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_9(x) ⇒ DFloat

These functions can be used to compute small integer powers x^2, x^3, etc. efficiently. The functions will be inlined when HAVE_INLINE is defined, so that use of these functions should be as efficient as explicitly writing the corresponding product expression.

Parameters:

  • x (DFloat)

Returns:

  • (DFloat)

    result



952
953
954
955
956
957
958
959
960
# File 'ext/numo/gsl/sys/gsl_sys.c', line 952

static VALUE
sys_s_pow_9(VALUE mod, VALUE v0)
{
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_9, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};

    return na_ndloop(&ndf, 1, v0);
}

.pow_int(x, n) ⇒ DFloat

These routines computes the power x^n for integer n. The power is computed efficiently—for example, x^8 is computed as ((x^2)^2)^2, requiring only 3 multiplications. A version of this function which also computes the numerical error in the result is available as gsl_sf_pow_int_e.

Parameters:

  • x (DFloat)
  • n (DFloat)

Returns:

  • (DFloat)

    result



570
571
572
573
574
575
576
577
578
# File 'ext/numo/gsl/sys/gsl_sys.c', line 570

static VALUE
sys_s_pow_int(VALUE mod, VALUE v0, VALUE v1)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cInt,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_int, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};

    return na_ndloop(&ndf, 2, v0, v1);
}

.pow_uint(x, n) ⇒ DFloat

These routines computes the power x^n for integer n. The power is computed efficiently—for example, x^8 is computed as ((x^2)^2)^2, requiring only 3 multiplications. A version of this function which also computes the numerical error in the result is available as gsl_sf_pow_int_e.

Parameters:

  • x (DFloat)
  • n (DFloat)

Returns:

  • (DFloat)

    result



616
617
618
619
620
621
622
623
624
# File 'ext/numo/gsl/sys/gsl_sys.c', line 616

static VALUE
sys_s_pow_uint(VALUE mod, VALUE v0, VALUE v1)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cUInt,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_sys_s_pow_uint, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};

    return na_ndloop(&ndf, 2, v0, v1);
}