Class: Numo::GSL::Spline2D

Inherits:
Object
  • Object
show all
Defined in:
ext/numo/gsl/interp/gsl_interp.c

Direct Known Subclasses

Bicubic, Bilinear

Defined Under Namespace

Classes: Bicubic, Bilinear

Instance Method Summary collapse

Instance Method Details

#eval(x, y) ⇒ DFloat

These functions return the interpolated value of z for a given point (x,y), using the interpolation object interp, data arrays xa, ya, and za and the accelerators xacc and yacc. When x is outside the range of xa or y is outside the range of ya, the error code GSL_EDOM is returned.

Parameters:

  • x (DFloat)
  • y (DFloat)

Returns:

  • (DFloat)

    result



860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
# File 'ext/numo/gsl/interp/gsl_interp.c', line 860

static VALUE
spline2d_eval(VALUE self, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_spline2d_eval, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};
    gsl_spline2d *w;
    gsl_interp_accel *a1, *a2;
    void *opts[3];
    VALUE vac1, vac2, v;

    TypedData_Get_Struct(self, gsl_spline2d, &spline2d_data_type, w);
    opts[0] = w;
    vac1 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac1, gsl_interp_accel, &interp_accel_data_type, a1);
    opts[1] = a1;
    vac2 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac2, gsl_interp_accel, &interp_accel_data_type, a2);
    opts[2] = a2;
    v = na_ndloop3(&ndf, opts, 2, v1, v2);
    RB_GC_GUARD(vac1);
    RB_GC_GUARD(vac2);
    return v;
}

#eval_deriv_x(x, y) ⇒ DFloat

These functions return the interpolated value d = \partial z / \partial x for a given point (x,y), using the interpolation object interp, data arrays xa, ya, and za and the accelerators xacc and yacc. When x is outside the range of xa or y is outside the range of ya, the error code GSL_EDOM is returned.

Parameters:

  • x (DFloat)
  • y (DFloat)

Returns:

  • (DFloat)

    result



930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
# File 'ext/numo/gsl/interp/gsl_interp.c', line 930

static VALUE
spline2d_eval_deriv_x(VALUE self, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_spline2d_eval_deriv_x, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};
    gsl_spline2d *w;
    gsl_interp_accel *a1, *a2;
    void *opts[3];
    VALUE vac1, vac2, v;

    TypedData_Get_Struct(self, gsl_spline2d, &spline2d_data_type, w);
    opts[0] = w;
    vac1 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac1, gsl_interp_accel, &interp_accel_data_type, a1);
    opts[1] = a1;
    vac2 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac2, gsl_interp_accel, &interp_accel_data_type, a2);
    opts[2] = a2;
    v = na_ndloop3(&ndf, opts, 2, v1, v2);
    RB_GC_GUARD(vac1);
    RB_GC_GUARD(vac2);
    return v;
}

#eval_deriv_xx(x, y) ⇒ DFloat

These functions return the interpolated value d = \partial^2 z / \partial x^2 for a given point (x,y), using the interpolation object interp, data arrays xa, ya, and za and the accelerators xacc and yacc. When x is outside the range of xa or y is outside the range of ya, the error code GSL_EDOM is returned.

Parameters:

  • x (DFloat)
  • y (DFloat)

Returns:

  • (DFloat)

    result



1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
# File 'ext/numo/gsl/interp/gsl_interp.c', line 1070

static VALUE
spline2d_eval_deriv_xx(VALUE self, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_spline2d_eval_deriv_xx, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};
    gsl_spline2d *w;
    gsl_interp_accel *a1, *a2;
    void *opts[3];
    VALUE vac1, vac2, v;

    TypedData_Get_Struct(self, gsl_spline2d, &spline2d_data_type, w);
    opts[0] = w;
    vac1 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac1, gsl_interp_accel, &interp_accel_data_type, a1);
    opts[1] = a1;
    vac2 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac2, gsl_interp_accel, &interp_accel_data_type, a2);
    opts[2] = a2;
    v = na_ndloop3(&ndf, opts, 2, v1, v2);
    RB_GC_GUARD(vac1);
    RB_GC_GUARD(vac2);
    return v;
}

#eval_deriv_xy(x, y) ⇒ DFloat

These functions return the interpolated value d = \partial^2 z / \partial x \partial y for a given point (x,y), using the interpolation object interp, data arrays xa, ya, and za and the accelerators xacc and yacc. When x is outside the range of xa or y is outside the range of ya, the error code GSL_EDOM is returned.

Parameters:

  • x (DFloat)
  • y (DFloat)

Returns:

  • (DFloat)

    result



1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
# File 'ext/numo/gsl/interp/gsl_interp.c', line 1210

static VALUE
spline2d_eval_deriv_xy(VALUE self, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_spline2d_eval_deriv_xy, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};
    gsl_spline2d *w;
    gsl_interp_accel *a1, *a2;
    void *opts[3];
    VALUE vac1, vac2, v;

    TypedData_Get_Struct(self, gsl_spline2d, &spline2d_data_type, w);
    opts[0] = w;
    vac1 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac1, gsl_interp_accel, &interp_accel_data_type, a1);
    opts[1] = a1;
    vac2 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac2, gsl_interp_accel, &interp_accel_data_type, a2);
    opts[2] = a2;
    v = na_ndloop3(&ndf, opts, 2, v1, v2);
    RB_GC_GUARD(vac1);
    RB_GC_GUARD(vac2);
    return v;
}

#eval_deriv_y(x, y) ⇒ DFloat

These functions return the interpolated value d = \partial z / \partial y for a given point (x,y), using the interpolation object interp, data arrays xa, ya, and za and the accelerators xacc and yacc. When x is outside the range of xa or y is outside the range of ya, the error code GSL_EDOM is returned.

Parameters:

  • x (DFloat)
  • y (DFloat)

Returns:

  • (DFloat)

    result



1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'ext/numo/gsl/interp/gsl_interp.c', line 1000

static VALUE
spline2d_eval_deriv_y(VALUE self, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_spline2d_eval_deriv_y, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};
    gsl_spline2d *w;
    gsl_interp_accel *a1, *a2;
    void *opts[3];
    VALUE vac1, vac2, v;

    TypedData_Get_Struct(self, gsl_spline2d, &spline2d_data_type, w);
    opts[0] = w;
    vac1 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac1, gsl_interp_accel, &interp_accel_data_type, a1);
    opts[1] = a1;
    vac2 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac2, gsl_interp_accel, &interp_accel_data_type, a2);
    opts[2] = a2;
    v = na_ndloop3(&ndf, opts, 2, v1, v2);
    RB_GC_GUARD(vac1);
    RB_GC_GUARD(vac2);
    return v;
}

#eval_deriv_yy(x, y) ⇒ DFloat

These functions return the interpolated value d = \partial^2 z / \partial y^2 for a given point (x,y), using the interpolation object interp, data arrays xa, ya, and za and the accelerators xacc and yacc. When x is outside the range of xa or y is outside the range of ya, the error code GSL_EDOM is returned.

Parameters:

  • x (DFloat)
  • y (DFloat)

Returns:

  • (DFloat)

    result



1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
# File 'ext/numo/gsl/interp/gsl_interp.c', line 1140

static VALUE
spline2d_eval_deriv_yy(VALUE self, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_spline2d_eval_deriv_yy, STRIDE_LOOP|NDF_EXTRACT, 2,1, ain,aout};
    gsl_spline2d *w;
    gsl_interp_accel *a1, *a2;
    void *opts[3];
    VALUE vac1, vac2, v;

    TypedData_Get_Struct(self, gsl_spline2d, &spline2d_data_type, w);
    opts[0] = w;
    vac1 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac1, gsl_interp_accel, &interp_accel_data_type, a1);
    opts[1] = a1;
    vac2 = interp_accel_s_new(cInterpAccel);
    TypedData_Get_Struct(vac2, gsl_interp_accel, &interp_accel_data_type, a2);
    opts[2] = a2;
    v = na_ndloop3(&ndf, opts, 2, v1, v2);
    RB_GC_GUARD(vac1);
    RB_GC_GUARD(vac2);
    return v;
}

#min_sizeInteger

These functions return the minimum number of points required by the interpolation object interp or interpolation type T. For example, bicubic interpolation requires a minimum of 4 points.

Returns:

  • (Integer)


806
807
808
809
810
811
812
813
814
# File 'ext/numo/gsl/interp/gsl_interp.c', line 806

static VALUE
spline2d_min_size(VALUE self)
{
    gsl_spline2d *w;

    TypedData_Get_Struct(self, gsl_spline2d, &spline2d_data_type, w);

    return UINT2NUM(gsl_spline2d_min_size(w));
}

#nameString

This function returns the name of the interpolation type used by interp. For example,

printf (“interp uses ‘%s’ interpolation.\n”, gsl_interp2d_name (interp));

would print something like,

interp uses ‘bilinear’ interpolation.

Returns:

  • (String)


786
787
788
789
790
791
792
793
794
# File 'ext/numo/gsl/interp/gsl_interp.c', line 786

static VALUE
spline2d_name(VALUE self)
{
    gsl_spline2d *w;

    TypedData_Get_Struct(self, gsl_spline2d, &spline2d_data_type, w);

    return rb_str_new_cstr(gsl_spline2d_name(w));
}