Class: Jac::Quadrature
- Inherits:
-
GSL::Object
- Object
- GSL::Object
- Jac::Quadrature
- Defined in:
- ext/gsl_native/jacobi.c
Class Method Summary collapse
Instance Method Summary collapse
- #alpha ⇒ Object
- #beta ⇒ Object
- #D ⇒ Object
- #differentiate(*args) ⇒ Object
- #integrate(ff) ⇒ Object
- #interpmat_alloc(*args) ⇒ Object
- #interpmat_free ⇒ Object
- #interpolate(*args) ⇒ Object
- #Q ⇒ Object
- #type ⇒ Object
- #w ⇒ Object
- #x ⇒ Object
- #xp ⇒ Object
- #zwd(*args) ⇒ Object
Methods inherited from GSL::Object
Class Method Details
.alloc(vQ) ⇒ Object
**
225 226 227 228 229 230 231 232 |
# File 'ext/gsl_native/jacobi.c', line 225 static VALUE rb_jac_quadrature_alloc(VALUE klass, VALUE vQ) { jac_quadrature *q; q = jac_quadrature_alloc(FIX2INT(vQ)); return Data_Wrap_Struct(klass, 0, jac_quadrature_free, q); } |
Instance Method Details
#alpha ⇒ Object
248 249 250 251 252 253 |
# File 'ext/gsl_native/jacobi.c', line 248 static VALUE rb_jac_quadrature_alpha(VALUE obj) { jac_quadrature *q; Data_Get_Struct(obj, jac_quadrature, q); return NUM2DBL(q->alpha); } |
#beta ⇒ Object
255 256 257 258 259 260 |
# File 'ext/gsl_native/jacobi.c', line 255 static VALUE rb_jac_quadrature_beta(VALUE obj) { jac_quadrature *q; Data_Get_Struct(obj, jac_quadrature, q); return NUM2DBL(q->beta); } |
#D ⇒ Object
286 287 288 289 290 291 292 293 294 295 296 |
# File 'ext/gsl_native/jacobi.c', line 286 static VALUE rb_jac_quadrature_D(VALUE obj) { jac_quadrature *q; gsl_vector_view *v; Data_Get_Struct(obj, jac_quadrature, q); v = gsl_vector_view_alloc(); v->vector.data = q->D; v->vector.size = q->Q; v->vector.stride = 1; return Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free, v); } |
#differentiate(*args) ⇒ Object
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File 'ext/gsl_native/jacobi.c', line 409 static VALUE rb_jac_differentiate(int argc, VALUE *argv, VALUE obj) { jac_quadrature *q; gsl_vector *f, *fout; VALUE vfout; switch (argc) { case 1: CHECK_VECTOR(argv[0]); Data_Get_Struct(argv[0], gsl_vector, f); fout = gsl_vector_alloc(f->size); vfout = Data_Wrap_Struct(VECTOR_ROW_COL(CLASS_OF(argv[0])), 0, gsl_vector_free, fout); break; case 2: CHECK_VECTOR(argv[0]); Data_Get_Struct(argv[0], gsl_vector, f); CHECK_VECTOR(argv[1]); Data_Get_Struct(argv[1], gsl_vector, fout); vfout = argv[1]; break; default: rb_raise(rb_eArgError, "Wrong number of arguments (%d for 1 or 2)", argc); } Data_Get_Struct(obj, jac_quadrature, q); jac_differentiate(q, f->data, fout->data); return vfout; } |
#integrate(ff) ⇒ Object
372 373 374 375 376 377 378 379 380 |
# File 'ext/gsl_native/jacobi.c', line 372 static VALUE rb_jac_integrate(VALUE obj, VALUE ff) { jac_quadrature *q; gsl_vector *f; CHECK_VECTOR(ff); Data_Get_Struct(obj, jac_quadrature, q); Data_Get_Struct(ff, gsl_vector, f); return rb_float_new(jac_integrate(q, f->data)); } |
#interpmat_alloc(*args) ⇒ Object
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'ext/gsl_native/jacobi.c', line 310 static VALUE rb_jac_interpmat_alloc(int argc, VALUE *argv, VALUE obj) { int err; jac_quadrature *q; gsl_vector *xp; int np; Data_Get_Struct(obj, jac_quadrature, q); switch (argc) { case 1: CHECK_VECTOR(argv[0]); Data_Get_Struct(argv[0], gsl_vector, xp); np = xp->size; break; case 2: CHECK_VECTOR(argv[1]); Data_Get_Struct(argv[1], gsl_vector, xp); np = FIX2INT(argv[0]); break; default: rb_raise(rb_eArgError, "Wrong number of arguments (%d for 1 or 2)", argc); } err = jac_interpmat_alloc(q, np, xp->data); return FIX2INT(err); } |
#interpmat_free ⇒ Object
335 336 337 338 339 340 341 |
# File 'ext/gsl_native/jacobi.c', line 335 static VALUE rb_jac_interpmat_free(VALUE obj) { jac_quadrature *q; Data_Get_Struct(obj, jac_quadrature, q); jac_interpmat_free(q); return Qtrue; } |
#interpolate(*args) ⇒ Object
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'ext/gsl_native/jacobi.c', line 382 static VALUE rb_jac_interpolate(int argc, VALUE *argv, VALUE obj) { jac_quadrature *q; gsl_vector *f, *fout; VALUE vfout; switch (argc) { case 1: CHECK_VECTOR(argv[0]); Data_Get_Struct(argv[0], gsl_vector, f); fout = gsl_vector_alloc(f->size); vfout = Data_Wrap_Struct(VECTOR_ROW_COL(CLASS_OF(argv[0])), 0, gsl_vector_free, fout); break; case 2: CHECK_VECTOR(argv[0]); Data_Get_Struct(argv[0], gsl_vector, f); CHECK_VECTOR(argv[1]); Data_Get_Struct(argv[1], gsl_vector, fout); vfout = argv[1]; break; default: rb_raise(rb_eArgError, "Wrong number of arguments (%d for 1 or 2)", argc); } Data_Get_Struct(obj, jac_quadrature, q); jac_interpolate(q, f->data, fout->data); return vfout; } |
#Q ⇒ Object
234 235 236 237 238 239 |
# File 'ext/gsl_native/jacobi.c', line 234 static VALUE rb_jac_quadrature_Q(VALUE obj) { jac_quadrature *q; Data_Get_Struct(obj, jac_quadrature, q); return INT2FIX(q->Q); } |
#type ⇒ Object
241 242 243 244 245 246 |
# File 'ext/gsl_native/jacobi.c', line 241 static VALUE rb_jac_quadrature_type(VALUE obj) { jac_quadrature *q; Data_Get_Struct(obj, jac_quadrature, q); return INT2FIX((int) q->type); } |
#w ⇒ Object
274 275 276 277 278 279 280 281 282 283 284 |
# File 'ext/gsl_native/jacobi.c', line 274 static VALUE rb_jac_quadrature_w(VALUE obj) { jac_quadrature *q; gsl_vector_view *v; Data_Get_Struct(obj, jac_quadrature, q); v = gsl_vector_view_alloc(); v->vector.data = q->w; v->vector.size = q->Q; v->vector.stride = 1; return Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free, v); } |
#x ⇒ Object
262 263 264 265 266 267 268 269 270 271 272 |
# File 'ext/gsl_native/jacobi.c', line 262 static VALUE rb_jac_quadrature_x(VALUE obj) { jac_quadrature *q; gsl_vector_view *v; Data_Get_Struct(obj, jac_quadrature, q); v = gsl_vector_view_alloc(); v->vector.data = q->x; v->vector.size = q->Q; v->vector.stride = 1; return Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free, v); } |
#xp ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 |
# File 'ext/gsl_native/jacobi.c', line 298 static VALUE rb_jac_quadrature_xp(VALUE obj) { jac_quadrature *q; gsl_vector_view *v; Data_Get_Struct(obj, jac_quadrature, q); v = gsl_vector_view_alloc(); v->vector.data = q->w; v->vector.size = q->np; v->vector.stride = 1; return Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free, v); } |
#zwd(*args) ⇒ Object
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'ext/gsl_native/jacobi.c', line 343 static VALUE rb_jac_quadrature_zwd(int argc, VALUE *argv, VALUE obj) { jac_quadrature *q; gsl_vector *ws; int flag = 0, type, status; double a, b; Data_Get_Struct(obj, jac_quadrature, q); switch (argc) { case 3: type = FIX2INT(argv[0]); a = NUM2DBL(argv[1]); b = NUM2DBL(argv[2]); ws = gsl_vector_alloc(q->Q); flag = 1; break; case 4: type = FIX2INT(argv[0]); a = NUM2DBL(argv[1]); b = NUM2DBL(argv[2]); Data_Get_Struct(argv[3], gsl_vector, ws); break; default: rb_raise(rb_eArgError, "Wrong number of arguments (%d for 3 or 4)", argc); } status = jac_quadrature_zwd(q, type, a, b, ws->data); if (flag == 1) gsl_vector_free(ws); return INT2FIX(status); } |