Class: Cowboy::CowboyArray
- Inherits:
-
Object
- Object
- Cowboy::CowboyArray
- Includes:
- Enumerable
- Defined in:
- ext/cowboy/cowboy_array.c
Instance Method Summary collapse
Constructor Details
#initialize ⇒ Object
58 59 60 |
# File 'ext/cowboy/cowboy_array.c', line 58 VALUE ca_not_implemented(VALUE self){ rb_notimplement(); } |
Instance Method Details
#[](index) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'ext/cowboy/cowboy_array.c', line 16
VALUE array_index(VALUE self, VALUE index){
fftw_complex * fc;
CowboyArray * ca;
long i = NUM2LONG(index);
Data_Get_Struct(self, CowboyArray, ca);
if (i >= ca->N){
return Qnil;
}
return c_to_rb_complex(ca->fc[i][0],
ca->fc[i][1]);
}
|
#each ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'ext/cowboy/cowboy_array.c', line 35
VALUE array_each(VALUE self){
int i;
fftw_complex * fc;
CowboyArray * ca;
Data_Get_Struct(self, CowboyArray, ca);
if (!rb_block_given_p())
rb_raise(rb_eArgError, "Expected Block");
for(i = 0; i < ca->N; i++)
rb_yield(c_to_rb_complex(ca->fc[i][0],
ca->fc[i][1]));
return self;
}
|
#size ⇒ Object
28 29 30 31 32 33 |
# File 'ext/cowboy/cowboy_array.c', line 28
VALUE array_size(VALUE self){
fftw_complex * fc;
CowboyArray * ca;
Data_Get_Struct(self, CowboyArray, ca);
return LONG2NUM(ca->N);
}
|