Class: Numo::GSL::Sf::Mathieu

Inherits:
Object
  • Object
show all
Defined in:
ext/numo/gsl/sf/gsl_sf.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(n, qmax) ⇒ Object

allocate instance of Mathieu class.

This function returns a workspace for the array versions of the Mathieu routines. The arguments n and qmax specify the maximum order and q-value of Mathieu functions which can be computed with this workspace.

This is required in order to properly terminate the infinite eigenvalue matrix for high precision solutions. The characteristic values for all orders 0 \to n are stored in the work structure array element work->char_value.

Parameters:

  • n (Integer)
  • qmax (Float)


24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
# File 'ext/numo/gsl/sf/gsl_sf.c', line 24007

static VALUE
sf_mathieu_s_new(VALUE self, VALUE v1, VALUE v2)
{
    gsl_sf_mathieu_workspace *w;
    w = gsl_sf_mathieu_alloc(NUM2SIZET(v1), NUM2DBL(v2));
    if (!w) {
        rb_raise(rb_eNoMemError,"fail to allocate struct");
    }
    return TypedData_Wrap_Struct(cMathieu, &sf_mathieu_data_type, (void*)w);
}

Instance Method Details

#a_array(order_min, order_max, q) ⇒ Numo::DFloat

These routines compute a series of Mathieu characteristic values a_n(q), b_n(q) for n from order_min to order_max inclusive, storing the results in the array result_array.

Parameters:

  • order_min (Integer)
  • order_max (Integer)
  • q (Numo::DFloat)

Returns:

  • (Numo::DFloat)

    returns result_array[]



24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
# File 'ext/numo/gsl/sf/gsl_sf.c', line 24048

static VALUE
sf_mathieu_a_array(VALUE self, VALUE v0, VALUE v1, VALUE v2)
{
    gsl_sf_mathieu_workspace *w;
    int nmin, nmax;
    size_t shape[1];
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
    ndfunc_t ndf = {iter_sf_mathieu_a_array,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,1,1,ain,aout};
    void *opt[3];

    TypedData_Get_Struct(self, gsl_sf_mathieu_workspace, &sf_mathieu_data_type, w);

    nmin = NUM2INT(v0);
    nmax = NUM2INT(v1);
    opt[0] = w;
    opt[1] = &nmin;
    opt[2] = &nmax;
    if (nmin<0 || nmax<0 || nmin>nmax) {
        rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
    }
    shape[0] = nmax-nmin+1;
    return na_ndloop3(&ndf,opt,1,v2);
}

#b_array(order_min, order_max, q) ⇒ Numo::DFloat

These routines compute a series of Mathieu characteristic values a_n(q), b_n(q) for n from order_min to order_max inclusive, storing the results in the array result_array.

Parameters:

  • order_min (Integer)
  • order_max (Integer)
  • q (Numo::DFloat)

Returns:

  • (Numo::DFloat)

    returns result_array[]



24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
# File 'ext/numo/gsl/sf/gsl_sf.c', line 24103

static VALUE
sf_mathieu_b_array(VALUE self, VALUE v0, VALUE v1, VALUE v2)
{
    gsl_sf_mathieu_workspace *w;
    int nmin, nmax;
    size_t shape[1];
    ndfunc_arg_in_t ain[1] = {{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
    ndfunc_t ndf = {iter_sf_mathieu_b_array,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,1,1,ain,aout};
    void *opt[3];

    TypedData_Get_Struct(self, gsl_sf_mathieu_workspace, &sf_mathieu_data_type, w);

    nmin = NUM2INT(v0);
    nmax = NUM2INT(v1);
    opt[0] = w;
    opt[1] = &nmin;
    opt[2] = &nmax;
    if (nmin<0 || nmax<0 || nmin>nmax) {
        rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
    }
    shape[0] = nmax-nmin+1;
    return na_ndloop3(&ndf,opt,1,v2);
}

#ce_array(nmin, nmax, q, x) ⇒ Numo::DFloat

These routines compute a series of the angular Mathieu functions ce_n(q,x) and se_n(q,x) of order n from nmin to nmax inclusive, storing the results in the array result_array.

Parameters:

  • nmin (Integer)
  • nmax (Integer)
  • q (Numo::DFloat)
  • x (Numo::DFloat)

Returns:

  • (Numo::DFloat)

    returns result_array[]



24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
# File 'ext/numo/gsl/sf/gsl_sf.c', line 24161

static VALUE
sf_mathieu_ce_array(VALUE self, VALUE v0, VALUE v1, VALUE v2, VALUE v3)
{
    gsl_sf_mathieu_workspace *w;
    int nmin, nmax;
    size_t shape[1];
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
    ndfunc_t ndf = {iter_sf_mathieu_ce_array,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,2,1,ain,aout};
    void *opt[3];

    TypedData_Get_Struct(self, gsl_sf_mathieu_workspace, &sf_mathieu_data_type, w);

    nmin = NUM2INT(v0);
    nmax = NUM2INT(v1);
    opt[0] = w;
    opt[1] = &nmin;
    opt[2] = &nmax;
    if (nmin<0 || nmax<0 || nmin>nmax) {
        rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
    }
    shape[0] = nmax-nmin+1;
    return na_ndloop3(&ndf,opt,2,v2,v3);
}

#Mc_array(j, nmin, nmax, q) ⇒ Numo::DFloat

These routines compute a series of the radial Mathieu functions of kind j, with order from nmin to nmax inclusive, storing the results in the array result_array.

Parameters:

  • j (Integer)
  • nmin (Integer)
  • nmax (Numo::DFloat)
  • q (Numo::DFloat)

Returns:

  • (Numo::DFloat)

    returns work



24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
# File 'ext/numo/gsl/sf/gsl_sf.c', line 24277

static VALUE
sf_mathieu_Mc_array(VALUE self, VALUE v0, VALUE v1, VALUE v2, VALUE v3, VALUE v4)
{
    gsl_sf_mathieu_workspace *w;
    int j, nmin, nmax;
    size_t shape[1];
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
    ndfunc_t ndf = {iter_sf_mathieu_Mc_array,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,2,1,ain,aout};
    void *opt[4];

    TypedData_Get_Struct(self, gsl_sf_mathieu_workspace, &sf_mathieu_data_type, w);

    j    = NUM2INT(v0);
    nmin = NUM2INT(v1);
    nmax = NUM2INT(v2);
    opt[0] = w;
    opt[1] = &j; //j
    opt[2] = &nmin;
    opt[3] = &nmax;
    if (nmin<0 || nmax<0 || nmin>nmax) {
        rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
    }
    shape[0] = nmax-nmin+1;
    return na_ndloop3(&ndf,opt,2,v3,v4);
}

#Ms_array(j, nmin, nmax, q) ⇒ Numo::DFloat

These routines compute a series of the radial Mathieu functions of kind j, with order from nmin to nmax inclusive, storing the results in the array result_array.

Parameters:

  • j (Integer)
  • nmin (Integer)
  • nmax (Numo::DFloat)
  • q (Numo::DFloat)

Returns:

  • (Numo::DFloat)

    returns work



24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
# File 'ext/numo/gsl/sf/gsl_sf.c', line 24337

static VALUE
sf_mathieu_Ms_array(VALUE self, VALUE v0, VALUE v1, VALUE v2, VALUE v3, VALUE v4)
{
    gsl_sf_mathieu_workspace *w;
    int j, nmin, nmax;
    size_t shape[1];
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
    ndfunc_t ndf = {iter_sf_mathieu_Ms_array,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,2,1,ain,aout};
    void *opt[4];

    TypedData_Get_Struct(self, gsl_sf_mathieu_workspace, &sf_mathieu_data_type, w);

    j    = NUM2INT(v0);
    nmin = NUM2INT(v1);
    nmax = NUM2INT(v2);
    opt[0] = w;
    opt[1] = &j; //j
    opt[2] = &nmin;
    opt[3] = &nmax;
    if (nmin<0 || nmax<0 || nmin>nmax) {
        rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
    }
    shape[0] = nmax-nmin+1;
    return na_ndloop3(&ndf,opt,2,v3,v4);
}

#se_array(nmin, nmax, q, x) ⇒ Numo::DFloat

These routines compute a series of the angular Mathieu functions ce_n(q,x) and se_n(q,x) of order n from nmin to nmax inclusive, storing the results in the array result_array.

Parameters:

  • nmin (Integer)
  • nmax (Integer)
  • q (Numo::DFloat)
  • x (Numo::DFloat)

Returns:

  • (Numo::DFloat)

    returns result_array[]



24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
# File 'ext/numo/gsl/sf/gsl_sf.c', line 24219

static VALUE
sf_mathieu_se_array(VALUE self, VALUE v0, VALUE v1, VALUE v2, VALUE v3)
{
    gsl_sf_mathieu_workspace *w;
    int nmin, nmax;
    size_t shape[1];
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
    ndfunc_t ndf = {iter_sf_mathieu_se_array,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,2,1,ain,aout};
    void *opt[3];

    TypedData_Get_Struct(self, gsl_sf_mathieu_workspace, &sf_mathieu_data_type, w);

    nmin = NUM2INT(v0);
    nmax = NUM2INT(v1);
    opt[0] = w;
    opt[1] = &nmin;
    opt[2] = &nmax;
    if (nmin<0 || nmax<0 || nmin>nmax) {
        rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
    }
    shape[0] = nmax-nmin+1;
    return na_ndloop3(&ndf,opt,2,v2,v3);
}