module NMath

Initialization of NMath module

Constants

E
PI

Public Class Methods

acos(arg) → narray click to toggle source
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
acosh(arg) → narray click to toggle source
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
acot(x) click to toggle source
# File narray_ext.rb, line 326
def acot x
  atan(1/x.to_f)
end
acoth(x) click to toggle source
# File narray_ext.rb, line 329
def acoth x
  atanh(1/x.to_f)
end
acsc(x) click to toggle source
# File narray_ext.rb, line 300
def acsc x
  asin(1/x.to_f)
end
acsch(x) click to toggle source
# File narray_ext.rb, line 303
def acsch x
  asinh(1/x.to_f)
end
asec(x) click to toggle source
# File narray_ext.rb, line 313
def asec x
  acos(1/x.to_f)
end
asech(x) click to toggle source
# File narray_ext.rb, line 316
def asech x
  acosh(1/x.to_f)
end
asin(arg) → narray click to toggle source
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
asinh(arg) → narray click to toggle source
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
atan(arg) → narray click to toggle source
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
atanh(arg) → narray click to toggle source
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
cos(arg) → narray click to toggle source
static VALUE na_math_cos(VALUE obj, VALUE x)
{ return na_math_func(x,cosFuncs); }

/*
 *  call-seq:
 *     NMath.tan(arg)  -> narray
 */
static VALUE na_math_tan(VALUE obj, VALUE x)
{ return na_math_func(x,tanFuncs); }

/*
 *  call-seq:
 *     NMath.sinh(arg)  -> narray
 */
static VALUE na_math_sinh(VALUE obj, VALUE x)
{ return na_math_func(x,sinhFuncs); }

/*
 *  call-seq:
 *     NMath.cosh(arg)  -> narray
 */
static VALUE na_math_cosh(VALUE obj, VALUE x)
{ return na_math_func(x,coshFuncs); }

/*
 *  call-seq:
 *     NMath.tanh(arg)  -> narray
 */
static VALUE na_math_tanh(VALUE obj, VALUE x)
{ return na_math_func(x,tanhFuncs); }

/*
 *  call-seq:
 *     NMath.exp(arg)  -> narray
 */
static VALUE na_math_exp(VALUE obj, VALUE x)
{ return na_math_func(x,expFuncs); }

/*
 *  call-seq:
 *     NMath.log(arg)  -> narray
 */
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
cosh(arg) → narray click to toggle source
static VALUE na_math_cosh(VALUE obj, VALUE x)
{ return na_math_func(x,coshFuncs); }

/*
 *  call-seq:
 *     NMath.tanh(arg)  -> narray
 */
static VALUE na_math_tanh(VALUE obj, VALUE x)
{ return na_math_func(x,tanhFuncs); }

/*
 *  call-seq:
 *     NMath.exp(arg)  -> narray
 */
static VALUE na_math_exp(VALUE obj, VALUE x)
{ return na_math_func(x,expFuncs); }

/*
 *  call-seq:
 *     NMath.log(arg)  -> narray
 */
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
cot(x) click to toggle source
# File narray_ext.rb, line 320
def cot x
  1/tan(x)
end
coth(x) click to toggle source
# File narray_ext.rb, line 323
def coth x
  1/tanh(x)
end
covariance(x,y,*ranks) click to toggle source

Statistics

# File narray_ext.rb, line 334
def covariance(x,y,*ranks)
  x = NArray.to_na(x) unless x.kind_of?(NArray)
  x = x.to_type(NArray::DFLOAT) if x.integer?
  y = NArray.to_na(y) unless y.kind_of?(NArray)
  y = y.to_type(NArray::DFLOAT) if y.integer?
  n = x.rank_total(*ranks)
  xm = x.accum(*ranks).div!(n)
  ym = y.accum(*ranks).div!(n)
  ((x-xm)*(y-ym)).sum(*ranks) / (n-1)
end
csc(x) click to toggle source

Trigonometric function

# File narray_ext.rb, line 294
def csc x
  1/sin(x)
end
csch(x) click to toggle source
# File narray_ext.rb, line 297
def csch x
  1/sinh(x)
end
exp(arg) → narray click to toggle source
static VALUE na_math_exp(VALUE obj, VALUE x)
{ return na_math_func(x,expFuncs); }

/*
 *  call-seq:
 *     NMath.log(arg)  -> narray
 */
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
log(arg) → narray click to toggle source
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
log10(arg) → narray click to toggle source
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
log2(arg) → narray click to toggle source
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
recip(x) click to toggle source
# File narray_ext.rb, line 289
def recip x
  1/x.to_f
end
sec(x) click to toggle source
# File narray_ext.rb, line 307
def sec x
  1/cos(x)
end
sech(x) click to toggle source
# File narray_ext.rb, line 310
def sech x
  1/cosh(x)
end
sin(arg) → narray click to toggle source
static VALUE na_math_sin(VALUE obj, VALUE x)
{ return na_math_func(x,sinFuncs); }

/*
 *  call-seq:
 *     NMath.cos(arg)  -> narray
 */
static VALUE na_math_cos(VALUE obj, VALUE x)
{ return na_math_func(x,cosFuncs); }

/*
 *  call-seq:
 *     NMath.tan(arg)  -> narray
 */
static VALUE na_math_tan(VALUE obj, VALUE x)
{ return na_math_func(x,tanFuncs); }

/*
 *  call-seq:
 *     NMath.sinh(arg)  -> narray
 */
static VALUE na_math_sinh(VALUE obj, VALUE x)
{ return na_math_func(x,sinhFuncs); }

/*
 *  call-seq:
 *     NMath.cosh(arg)  -> narray
 */
static VALUE na_math_cosh(VALUE obj, VALUE x)
{ return na_math_func(x,coshFuncs); }

/*
 *  call-seq:
 *     NMath.tanh(arg)  -> narray
 */
static VALUE na_math_tanh(VALUE obj, VALUE x)
{ return na_math_func(x,tanhFuncs); }

/*
 *  call-seq:
 *     NMath.exp(arg)  -> narray
 */
static VALUE na_math_exp(VALUE obj, VALUE x)
{ return na_math_func(x,expFuncs); }

/*
 *  call-seq:
 *     NMath.log(arg)  -> narray
 */
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
sinh(arg) → narray click to toggle source
static VALUE na_math_sinh(VALUE obj, VALUE x)
{ return na_math_func(x,sinhFuncs); }

/*
 *  call-seq:
 *     NMath.cosh(arg)  -> narray
 */
static VALUE na_math_cosh(VALUE obj, VALUE x)
{ return na_math_func(x,coshFuncs); }

/*
 *  call-seq:
 *     NMath.tanh(arg)  -> narray
 */
static VALUE na_math_tanh(VALUE obj, VALUE x)
{ return na_math_func(x,tanhFuncs); }

/*
 *  call-seq:
 *     NMath.exp(arg)  -> narray
 */
static VALUE na_math_exp(VALUE obj, VALUE x)
{ return na_math_func(x,expFuncs); }

/*
 *  call-seq:
 *     NMath.log(arg)  -> narray
 */
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
sqrt(arg) → narray click to toggle source
static VALUE na_math_sqrt(VALUE obj, VALUE x)
{ return na_math_func(x,sqrtFuncs); }

/*
 *  call-seq:
 *     NMath.sin(arg)  -> narray
 */
static VALUE na_math_sin(VALUE obj, VALUE x)
{ return na_math_func(x,sinFuncs); }

/*
 *  call-seq:
 *     NMath.cos(arg)  -> narray
 */
static VALUE na_math_cos(VALUE obj, VALUE x)
{ return na_math_func(x,cosFuncs); }

/*
 *  call-seq:
 *     NMath.tan(arg)  -> narray
 */
static VALUE na_math_tan(VALUE obj, VALUE x)
{ return na_math_func(x,tanFuncs); }

/*
 *  call-seq:
 *     NMath.sinh(arg)  -> narray
 */
static VALUE na_math_sinh(VALUE obj, VALUE x)
{ return na_math_func(x,sinhFuncs); }

/*
 *  call-seq:
 *     NMath.cosh(arg)  -> narray
 */
static VALUE na_math_cosh(VALUE obj, VALUE x)
{ return na_math_func(x,coshFuncs); }

/*
 *  call-seq:
 *     NMath.tanh(arg)  -> narray
 */
static VALUE na_math_tanh(VALUE obj, VALUE x)
{ return na_math_func(x,tanhFuncs); }

/*
 *  call-seq:
 *     NMath.exp(arg)  -> narray
 */
static VALUE na_math_exp(VALUE obj, VALUE x)
{ return na_math_func(x,expFuncs); }

/*
 *  call-seq:
 *     NMath.log(arg)  -> narray
 */
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
tan(arg) → narray click to toggle source
static VALUE na_math_tan(VALUE obj, VALUE x)
{ return na_math_func(x,tanFuncs); }

/*
 *  call-seq:
 *     NMath.sinh(arg)  -> narray
 */
static VALUE na_math_sinh(VALUE obj, VALUE x)
{ return na_math_func(x,sinhFuncs); }

/*
 *  call-seq:
 *     NMath.cosh(arg)  -> narray
 */
static VALUE na_math_cosh(VALUE obj, VALUE x)
{ return na_math_func(x,coshFuncs); }

/*
 *  call-seq:
 *     NMath.tanh(arg)  -> narray
 */
static VALUE na_math_tanh(VALUE obj, VALUE x)
{ return na_math_func(x,tanhFuncs); }

/*
 *  call-seq:
 *     NMath.exp(arg)  -> narray
 */
static VALUE na_math_exp(VALUE obj, VALUE x)
{ return na_math_func(x,expFuncs); }

/*
 *  call-seq:
 *     NMath.log(arg)  -> narray
 */
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}
tanh(arg) → narray click to toggle source
static VALUE na_math_tanh(VALUE obj, VALUE x)
{ return na_math_func(x,tanhFuncs); }

/*
 *  call-seq:
 *     NMath.exp(arg)  -> narray
 */
static VALUE na_math_exp(VALUE obj, VALUE x)
{ return na_math_func(x,expFuncs); }

/*
 *  call-seq:
 *     NMath.log(arg)  -> narray
 */
static VALUE na_math_log(VALUE obj, VALUE x)
{ return na_math_func(x,logFuncs); }

/*
 *  call-seq:
 *     NMath.log10(arg)  -> narray
 */
static VALUE na_math_log10(VALUE obj, VALUE x)
{ return na_math_func(x,log10Funcs); }

/*
 *  call-seq:
 *     NMath.log2(arg)  -> narray
 */
static VALUE na_math_log2(VALUE obj, VALUE x)
{ return na_math_func(x,log2Funcs); }

/*
 *  call-seq:
 *     NMath.asin(arg)  -> narray
 */
static VALUE na_math_asin(VALUE obj, VALUE x)
{ return na_math_func(x,asinFuncs); }

/*
 *  call-seq:
 *     NMath.asinh(arg)  -> narray
 */
static VALUE na_math_asinh(VALUE obj, VALUE x)
{ return na_math_func(x,asinhFuncs); }

/*
 *  call-seq:
 *     NMath.acos(arg)  -> narray
 */
static VALUE na_math_acos(VALUE obj, VALUE x)
{ return na_math_func(x,acosFuncs); }

/*
 *  call-seq:
 *     NMath.acosh(arg)  -> narray
 */
static VALUE na_math_acosh(VALUE obj, VALUE x)
{ return na_math_func(x,acoshFuncs); }

/*
 *  call-seq:
 *     NMath.atan(arg)  -> narray
 */
static VALUE na_math_atan(VALUE obj, VALUE x)
{ return na_math_func(x,atanFuncs); }

/*
 *  call-seq:
 *     NMath.atanh(arg)  -> narray
 */
static VALUE na_math_atanh(VALUE obj, VALUE x)
{ return na_math_func(x,atanhFuncs); }


/* Initialization of NMath module */
void Init_nmath(void)
{
  /* define ExtMath module */
  rb_mNMath = rb_define_module("NMath");

  /* methods */
  rb_define_module_function(rb_mNMath,"sqrt",na_math_sqrt,1);
  rb_define_module_function(rb_mNMath,"sin",na_math_sin,1);
  rb_define_module_function(rb_mNMath,"cos",na_math_cos,1);
  rb_define_module_function(rb_mNMath,"tan",na_math_tan,1);
  rb_define_module_function(rb_mNMath,"sinh",na_math_sinh,1);
  rb_define_module_function(rb_mNMath,"cosh",na_math_cosh,1);
  rb_define_module_function(rb_mNMath,"tanh",na_math_tanh,1);
  rb_define_module_function(rb_mNMath,"exp",na_math_exp,1);
  rb_define_module_function(rb_mNMath,"log",na_math_log,1);
  rb_define_module_function(rb_mNMath,"log10",na_math_log10,1);
  rb_define_module_function(rb_mNMath,"log2",na_math_log2,1);
  rb_define_module_function(rb_mNMath,"asin",na_math_asin,1);
  rb_define_module_function(rb_mNMath,"asinh",na_math_asinh,1);
  rb_define_module_function(rb_mNMath,"acos",na_math_acos,1);
  rb_define_module_function(rb_mNMath,"acosh",na_math_acosh,1);
  rb_define_module_function(rb_mNMath,"atan",na_math_atan,1);
  rb_define_module_function(rb_mNMath,"atanh",na_math_atanh,1);
}

Private Instance Methods

acot(x) click to toggle source
# File narray_ext.rb, line 326
def acot x
  atan(1/x.to_f)
end
acoth(x) click to toggle source
# File narray_ext.rb, line 329
def acoth x
  atanh(1/x.to_f)
end
acsc(x) click to toggle source
# File narray_ext.rb, line 300
def acsc x
  asin(1/x.to_f)
end
acsch(x) click to toggle source
# File narray_ext.rb, line 303
def acsch x
  asinh(1/x.to_f)
end
asec(x) click to toggle source
# File narray_ext.rb, line 313
def asec x
  acos(1/x.to_f)
end
asech(x) click to toggle source
# File narray_ext.rb, line 316
def asech x
  acosh(1/x.to_f)
end
cot(x) click to toggle source
# File narray_ext.rb, line 320
def cot x
  1/tan(x)
end
coth(x) click to toggle source
# File narray_ext.rb, line 323
def coth x
  1/tanh(x)
end
covariance(x,y,*ranks) click to toggle source

Statistics

# File narray_ext.rb, line 334
def covariance(x,y,*ranks)
  x = NArray.to_na(x) unless x.kind_of?(NArray)
  x = x.to_type(NArray::DFLOAT) if x.integer?
  y = NArray.to_na(y) unless y.kind_of?(NArray)
  y = y.to_type(NArray::DFLOAT) if y.integer?
  n = x.rank_total(*ranks)
  xm = x.accum(*ranks).div!(n)
  ym = y.accum(*ranks).div!(n)
  ((x-xm)*(y-ym)).sum(*ranks) / (n-1)
end
csc(x) click to toggle source

Trigonometric function

# File narray_ext.rb, line 294
def csc x
  1/sin(x)
end
csch(x) click to toggle source
# File narray_ext.rb, line 297
def csch x
  1/sinh(x)
end
recip(x) click to toggle source
# File narray_ext.rb, line 289
def recip x
  1/x.to_f
end
sec(x) click to toggle source
# File narray_ext.rb, line 307
def sec x
  1/cos(x)
end
sech(x) click to toggle source
# File narray_ext.rb, line 310
def sech x
  1/cosh(x)
end