Class: NoyesC::PowerSpectrumFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/cext/power_spectrum.c

Instance Method Summary collapse

Constructor Details

#initializeObject


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cext/power_spectrum.c', line 11

static VALUE t_init(VALUE self, VALUE args) {
  int len = RARRAY_LEN(args);
  int nfft = 256;
  if (len > 0) {
     nfft = NUM2INT(rb_ary_entry(args, 0));
  }
  PowerSpectrum *ps = new_power_spectrum(nfft);
  VALUE psv = Data_Wrap_Struct(cPowerSpectrum, 0, _power_spectrum_free, ps);
  rb_iv_set(self, "@ps", psv);
  return self;
}

Instance Method Details

#<<Object


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cext/power_spectrum.c', line 23

static VALUE t_left_shift(VALUE self, VALUE obj) {
  Cmat *M = r2cmat(obj);
  PowerSpectrum *ps;
  VALUE psv = rb_iv_get(self, "@ps");
  Data_Get_Struct(psv, PowerSpectrum, ps);
  Cmat *N = power_spectrum_apply(ps, M);
  VALUE result = cmat2r(N);
  cmat_free(N);
  cmat_free(M);
  return result;
}