Class: Vdsp::DoubleArray

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Array
Defined in:
ext/vdsp/vdsp.c

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Array

#blkman_window, #hamm_window, #hann_window, #length

Constructor Details

#initialize(length) ⇒ Object

Vdsp::DoubleArray



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'ext/vdsp/vdsp.c', line 191

VALUE rb_double_array_initialize(VALUE self, VALUE length)
{
  if (!FIXNUM_P(length)) {
    rb_raise(rb_eArgError, "Integer required: length");
  }
  long _length = FIX2LONG(length);

  VdspArrayNativeResource *p = ALLOC(VdspArrayNativeResource);
  p->v.ptr = NULL;
  p->length = 0;

  VALUE resource = Data_Wrap_Struct(CLASS_OF(self), 0, vdsp_array_native_resource_delete, p);
  rb_iv_set(self, "native_resource", resource);

  p->v.ptr = calloc(_length, sizeof(double));
  p->length = _length;

  return self;
}

Class Method Details

.blkman_window(*args) ⇒ Object



790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
# File 'ext/vdsp/vdsp.c', line 790

VALUE rb_double_array_blkman_window(int argc, const VALUE *argv, VALUE cls)
{
  rb_check_arity(argc, 1, 2);
  VALUE n = argv[0];

  vDSP_Length _n = NUM2LONG(n);
  int flag = 0;
  if (argc==2) {
    flag = (int)NUM2LONG(argv[1]);
  }

  VALUE c = rb_class_new_instance(1, &n, rb_cDoubleArray);
  VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

  vDSP_blkman_windowD(_c->v.d, _n, flag);

  return c;
}

.create(ary) ⇒ Object



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'ext/vdsp/vdsp.c', line 273

VALUE rb_double_array_create(VALUE cls, VALUE ary)
{
  if (rb_obj_is_kind_of(ary, rb_mVdspArray)) {
    return rb_funcall(ary, rb_intern("to_da"), 0);
  }
  if (!RB_TYPE_P(ary, T_ARRAY)) {
    rb_raise(rb_eArgError, "Array required");
  }

  VALUE len = LONG2NUM(RARRAY_LEN(ary));
  VALUE obj = rb_class_new_instance(1, &len, rb_cDoubleArray);
  rb_double_array_set_values(obj, ary);

  return obj;
}

.hamm_window(*args) ⇒ Object



809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
# File 'ext/vdsp/vdsp.c', line 809

VALUE rb_double_array_hamm_window(int argc, const VALUE *argv, VALUE cls)
{
  rb_check_arity(argc, 1, 2);
  VALUE n = argv[0];

  vDSP_Length _n = NUM2LONG(n);
  int flag = 0;
  if (argc==2) {
    flag = (int)NUM2LONG(argv[1]);
  }

  VALUE c = rb_class_new_instance(1, &n, rb_cDoubleArray);
  VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

  vDSP_hamm_windowD(_c->v.d, _n, flag);

  return c;
}

.hann_window(*args) ⇒ Object



828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
# File 'ext/vdsp/vdsp.c', line 828

VALUE rb_double_array_hann_window(int argc, const VALUE *argv, VALUE cls)
{
  rb_check_arity(argc, 1, 2);
  VALUE n = argv[0];

  vDSP_Length _n = NUM2LONG(n);
  int flag = 0;
  if (argc==2) {
    flag = (int)NUM2LONG(argv[1]);
  }

  VALUE c = rb_class_new_instance(1, &n, rb_cDoubleArray);
  VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

  vDSP_hann_windowD(_c->v.d, _n, flag);

  return c;
}

.vgen(a, b, n) ⇒ Object



776
777
778
779
780
781
782
783
784
785
786
787
788
# File 'ext/vdsp/vdsp.c', line 776

VALUE rb_double_array_vgen(VALUE cls, VALUE a, VALUE b, VALUE n)
{
  double _a = NUM2DBL(a);
  double _b = NUM2DBL(b);
  vDSP_Length _n = NUM2LONG(n);

  VALUE c = rb_class_new_instance(1, &n, rb_cDoubleArray);
  VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

  vDSP_vgenD(&_a, &_b, _c->v.d, 1, _n);

  return c;
}

.vramp(a, b, n) ⇒ Object

Vdsp::DoubleArray Vector Generation



762
763
764
765
766
767
768
769
770
771
772
773
774
# File 'ext/vdsp/vdsp.c', line 762

VALUE rb_double_array_vramp(VALUE cls, VALUE a, VALUE b, VALUE n)
{
  double _a = NUM2DBL(a);
  double _b = NUM2DBL(b);
  vDSP_Length _n = NUM2LONG(n);

  VALUE c = rb_class_new_instance(1, &n, rb_cDoubleArray);
  VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

  vDSP_vrampD(&_a, &_b, _c->v.d, 1, _n);

  return c;
}

Instance Method Details

#*(other) ⇒ Object



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'ext/vdsp/vdsp.c', line 360

VALUE rb_double_array_mul(VALUE self, VALUE other)
{
  if (rb_obj_is_kind_of(other, rb_mVdspArray)) {
    other = rb_funcall(other, rb_intern("to_da"), 0);

    VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
    VdspArrayNativeResource *_b = get_vdsp_array_native_resource(other);

    vDSP_Length len = MIN(_a->length, _b->length);
    VALUE lenv = LONG2NUM(len);
    VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
    VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

    vDSP_vmulD(_a->v.d, 1, _b->v.d, 1, _c->v.d, 1, len);
    return c;

  } else if (rb_obj_is_kind_of(other, rb_cNumeric)) {
    other = rb_funcall(other, rb_intern("to_f"), 0);
    double _b = NUM2DBL(other);

    VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
    VALUE lenv = LONG2NUM(_a->length);
    VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
    VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

    vDSP_vsmulD(_a->v.d, 1, &_b, _c->v.d, 1, _a->length);
    return c;

  } else {
    return rb_num_coerce_bin(self, other, '*');
  }
}

#+(other) ⇒ Object



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'ext/vdsp/vdsp.c', line 294

VALUE rb_double_array_plus(VALUE self, VALUE other)
{
  if (rb_obj_is_kind_of(other, rb_mVdspArray)) {
    other = rb_funcall(other, rb_intern("to_da"), 0);

    VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
    VdspArrayNativeResource *_b = get_vdsp_array_native_resource(other);

    vDSP_Length len = MIN(_a->length, _b->length);
    VALUE lenv = LONG2NUM(len);
    VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
    VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

    vDSP_vaddD(_a->v.d, 1, _b->v.d, 1, _c->v.d, 1, len);
    return c;

  } else if (rb_obj_is_kind_of(other, rb_cNumeric)) {
    other = rb_funcall(other, rb_intern("to_f"), 0);
    double _b = NUM2DBL(other);

    VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
    VALUE lenv = LONG2NUM(_a->length);
    VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
    VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

    vDSP_vsaddD(_a->v.d, 1, &_b, _c->v.d, 1, _a->length);
    return c;

  } else {
    return rb_num_coerce_bin(self, other, '+');
  }
}

#-(other) ⇒ Object



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'ext/vdsp/vdsp.c', line 327

VALUE rb_double_array_minus(VALUE self, VALUE other)
{
  if (rb_obj_is_kind_of(other, rb_mVdspArray)) {
    other = rb_funcall(other, rb_intern("to_da"), 0);

    VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
    VdspArrayNativeResource *_b = get_vdsp_array_native_resource(other);

    vDSP_Length len = MIN(_a->length, _b->length);
    VALUE lenv = LONG2NUM(len);
    VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
    VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

    vDSP_vsubD(_b->v.d, 1, _a->v.d, 1, _c->v.d, 1, len);
    return c;

  } else if (rb_obj_is_kind_of(other, rb_cNumeric)) {
    other = rb_funcall(other, rb_intern("to_f"), 0);
    double _b = -NUM2DBL(other);

    VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
    VALUE lenv = LONG2NUM(_a->length);
    VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
    VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

    vDSP_vsaddD(_a->v.d, 1, &_b, _c->v.d, 1, _a->length);
    return c;

  } else {
    return rb_num_coerce_bin(self, other, '-');
  }
}

#/(other) ⇒ Object



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'ext/vdsp/vdsp.c', line 393

VALUE rb_double_array_div(VALUE self, VALUE other)
{
  if (rb_obj_is_kind_of(other, rb_mVdspArray)) {
    other = rb_funcall(other, rb_intern("to_da"), 0);

    VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
    VdspArrayNativeResource *_b = get_vdsp_array_native_resource(other);

    vDSP_Length len = MIN(_a->length, _b->length);
    VALUE lenv = LONG2NUM(len);
    VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
    VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

    vDSP_vdivD(_a->v.d, 1, _b->v.d, 1, _c->v.d, 1, len);
    return c;

  } else if (rb_obj_is_kind_of(other, rb_cNumeric)) {
    other = rb_funcall(other, rb_intern("to_f"), 0);
    double _b = NUM2DBL(other);

    VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
    VALUE lenv = LONG2NUM(_a->length);
    VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
    VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

    vDSP_vsdivD(_a->v.d, 1, &_b, _c->v.d, 1, _a->length);
    return c;

  } else {
    return rb_num_coerce_bin(self, other, '/');
  }
}

#[](*args) ⇒ Object



496
497
498
499
500
501
502
503
504
# File 'ext/vdsp/vdsp.c', line 496

VALUE rb_double_array_aref(int argc, const VALUE *argv, VALUE self)
{
  rb_check_arity(argc, 1, 2);

  if (argc == 2) {
    return rb_double_array_aref2(self, argv[0], argv[1]);
  }
  return rb_double_array_aref1(self, argv[0]);
}

#[]=(*args) ⇒ Object



604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
# File 'ext/vdsp/vdsp.c', line 604

VALUE rb_double_array_aset(int argc, const VALUE *argv, VALUE self)
{
  long offset, beg, len;
  VALUE val;

  if (argc == 3) {
    beg = NUM2LONG(argv[0]);
    len = NUM2LONG(argv[1]);
    val = argv[2];
    return double_array_aset2(self, beg, len, val);
  }

  rb_check_arity(argc, 2, 2);

  if (FIXNUM_P(argv[0])) {
    offset = FIX2LONG(argv[0]);
    val = argv[1];
    return double_array_aset1(self, offset, val);
  }

  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
  if (rb_range_beg_len(argv[0], &beg, &len, _a->length, 1)) {
    val = argv[1];
    return double_array_aset2(self, beg, len, val);
  }

  offset = NUM2LONG(argv[0]);
  val = argv[1];
  return double_array_aset1(self, offset, val);
}

#absObject



696
697
698
699
700
701
702
703
704
705
706
707
# File 'ext/vdsp/vdsp.c', line 696

VALUE rb_double_array_abs(VALUE self)
{
  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);

  VALUE lenv = LONG2NUM(_a->length);
  VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
  VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

  vDSP_vabsD(_a->v.d, 1, _c->v.d, 1, _a->length);

  return c;
}

#abs!Object



709
710
711
712
713
714
715
716
# File 'ext/vdsp/vdsp.c', line 709

VALUE rb_double_array_abs_bang(VALUE self)
{
  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);

  vDSP_vabsD(_a->v.d, 1, _a->v.d, 1, _a->length);

  return self;
}

#clear!Object

Vdsp::DoubleArray Vector Clear and Fill Functions



847
848
849
850
851
852
# File 'ext/vdsp/vdsp.c', line 847

VALUE rb_double_array_clear_bang(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  vDSP_vclrD(p->v.d, 1, p->length);
  return self;
}

#coerce(other) ⇒ Object



635
636
637
638
639
# File 'ext/vdsp/vdsp.c', line 635

VALUE rb_double_array_coerce(VALUE self, VALUE other)
{
  other = rb_class_new_instance(1, &other, rb_cDoubleScalar);
  return rb_assoc_new(other, self);
}

#concat(*args) ⇒ Object



667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'ext/vdsp/vdsp.c', line 667

VALUE rb_double_array_concat(int argc, const VALUE *argv, VALUE self)
{
  rb_check_frozen(self);
  rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);

  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
  VdspArrayNativeResource *_argv[argc];

  unsigned long len = _a->length;
  unsigned long new_len = len;
  for (long i=0; i<argc; i++) {
    VALUE arg = rb_funcall(argv[i], rb_intern("to_da"), 0);
    _argv[i] = get_vdsp_array_native_resource(arg);
    new_len += _argv[i]->length;
  }

  double_array_resize(_a, new_len);

  new_len = len;
  for (long i=0; i<argc; i++) {
    VdspArrayNativeResource *_b = _argv[i];
    memcpy(_a->v.d+new_len, _b->v.d, _b->length * sizeof(double));
    new_len += _b->length;
  }
  _a->length = new_len;

  return self;
}

#eachObject



247
248
249
250
251
252
253
254
255
256
257
258
# File 'ext/vdsp/vdsp.c', line 247

VALUE rb_double_array_each(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double *d = p->v.d;

  RETURN_ENUMERATOR(self, 0, 0);

  for (unsigned long i=0; i<p->length; i++) {
      rb_yield(DBL2NUM(d[i]));
  }
  return self;
}

#fill!(a) ⇒ Object



854
855
856
857
858
859
860
# File 'ext/vdsp/vdsp.c', line 854

VALUE rb_double_array_fill_bang(VALUE self, VALUE a)
{
  double _a = NUM2DBL(a);
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  vDSP_vfillD(&_a, p->v.d, 1, p->length);
  return self;
}

#maxmgvObject



870
871
872
873
874
875
876
# File 'ext/vdsp/vdsp.c', line 870

VALUE rb_double_array_maxmgv(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_maxmgvD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#maxvObject

Vdsp::DoubleArray Vector Extrema Calculation



862
863
864
865
866
867
868
# File 'ext/vdsp/vdsp.c', line 862

VALUE rb_double_array_maxv(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_maxvD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#meamgvObject



902
903
904
905
906
907
908
# File 'ext/vdsp/vdsp.c', line 902

VALUE rb_double_array_meamgv(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_meamgvD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#meanvObject

Vdsp::DoubleArray Vector Average Calculation



894
895
896
897
898
899
900
# File 'ext/vdsp/vdsp.c', line 894

VALUE rb_double_array_meanv(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_meanvD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#measqvObject



910
911
912
913
914
915
916
# File 'ext/vdsp/vdsp.c', line 910

VALUE rb_double_array_measqv(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_measqvD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#minmgvObject



886
887
888
889
890
891
892
# File 'ext/vdsp/vdsp.c', line 886

VALUE rb_double_array_minmgv(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_minmgvD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#minvObject



878
879
880
881
882
883
884
# File 'ext/vdsp/vdsp.c', line 878

VALUE rb_double_array_minv(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_minvD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#mvessqObject



918
919
920
921
922
923
924
# File 'ext/vdsp/vdsp.c', line 918

VALUE rb_double_array_mvessq(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_mvessqD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#nabsObject



718
719
720
721
722
723
724
725
726
727
728
729
# File 'ext/vdsp/vdsp.c', line 718

VALUE rb_double_array_nabs(VALUE self)
{
  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);

  VALUE lenv = LONG2NUM(_a->length);
  VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
  VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

  vDSP_vnabsD(_a->v.d, 1, _c->v.d, 1, _a->length);

  return c;
}

#nabs!Object



731
732
733
734
735
736
737
738
# File 'ext/vdsp/vdsp.c', line 731

VALUE rb_double_array_nabs_bang(VALUE self)
{
  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);

  vDSP_vnabsD(_a->v.d, 1, _a->v.d, 1, _a->length);

  return self;
}

#negativeObject Also known as: neg



740
741
742
743
744
745
746
747
748
749
750
751
# File 'ext/vdsp/vdsp.c', line 740

VALUE rb_double_array_negative(VALUE self)
{
  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);

  VALUE lenv = LONG2NUM(_a->length);
  VALUE c = rb_class_new_instance(1, &lenv, rb_cDoubleArray);
  VdspArrayNativeResource *_c = get_vdsp_array_native_resource(c);

  vDSP_vnegD(_a->v.d, 1, _c->v.d, 1, _a->length);

  return c;
}

#negative!Object Also known as: neg!



753
754
755
756
757
758
759
760
# File 'ext/vdsp/vdsp.c', line 753

VALUE rb_double_array_negative_bang(VALUE self)
{
  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);

  vDSP_vnegD(_a->v.d, 1, _a->v.d, 1, _a->length);

  return self;
}

#resize(size) ⇒ Object



656
657
658
659
660
661
662
663
664
665
# File 'ext/vdsp/vdsp.c', line 656

VALUE rb_double_array_resize(VALUE self, VALUE size)
{
  unsigned long len = NUM2LONG(size);

  VdspArrayNativeResource *_a = get_vdsp_array_native_resource(self);
  double_array_resize(_a, len);
  _a->length = len;

  return self;
}

#rmsqvObject



926
927
928
929
930
931
932
# File 'ext/vdsp/vdsp.c', line 926

VALUE rb_double_array_rmsqv(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_rmsqvD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#slice(*args) ⇒ Object



496
497
498
499
500
501
502
503
504
# File 'ext/vdsp/vdsp.c', line 496

VALUE rb_double_array_aref(int argc, const VALUE *argv, VALUE self)
{
  rb_check_arity(argc, 1, 2);

  if (argc == 2) {
    return rb_double_array_aref2(self, argv[0], argv[1]);
  }
  return rb_double_array_aref1(self, argv[0]);
}

#sveObject

Vdsp::DoubleArray Vector Summation



934
935
936
937
938
939
940
# File 'ext/vdsp/vdsp.c', line 934

VALUE rb_double_array_sve(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_sveD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#sve_svesqObject



958
959
960
961
962
963
964
965
# File 'ext/vdsp/vdsp.c', line 958

VALUE rb_double_array_sve_svesq(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _sum;
  double _sum_of_squares;
  vDSP_sve_svesqD(p->v.d, 1, &_sum, &_sum_of_squares, p->length);
  return rb_assoc_new(DBL2NUM(_sum), DBL2NUM(_sum_of_squares));
}

#svemgObject



942
943
944
945
946
947
948
# File 'ext/vdsp/vdsp.c', line 942

VALUE rb_double_array_svemg(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_svemgD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#svesqObject



950
951
952
953
954
955
956
# File 'ext/vdsp/vdsp.c', line 950

VALUE rb_double_array_svesq(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_svesqD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#svsObject



967
968
969
970
971
972
973
# File 'ext/vdsp/vdsp.c', line 967

VALUE rb_double_array_svs(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double _c;
  vDSP_svsD(p->v.d, 1, &_c, p->length);
  return DBL2NUM(_c);
}

#to_aObject



260
261
262
263
264
265
266
267
268
269
270
271
# File 'ext/vdsp/vdsp.c', line 260

VALUE rb_double_array_get_values(VALUE self)
{
  VdspArrayNativeResource *p = get_vdsp_array_native_resource(self);
  double *d = p->v.d;

  VALUE ret = rb_ary_new2(p->length);
  for (unsigned long i=0; i<p->length; i++) {
    rb_ary_push(ret, DBL2NUM(d[i]));
  }

  return ret;
}

#to_daObject



289
290
291
292
# File 'ext/vdsp/vdsp.c', line 289

VALUE rb_double_array_to_da(VALUE self)
{
  return self;
}