Class: NoyesC::LogCompressor

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

Instance Method Summary collapse

Constructor Details

#initializeObject


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

static VALUE t_init(VALUE self, VALUE args) {
  int len = RARRAY_LEN(args);
  double log_zero = -0.00001;
  if (len > 0) {
     log_zero = NUM2DBL(rb_ary_entry(args, 0));
  }
  LogCompressor *lc = log_compressor_new(log_zero);
  VALUE lcv = Data_Wrap_Struct(cLogCompressor, 0, _log_compressor_free, lc);
  rb_iv_set(self, "@log_compressor", lcv);
  return self;
}

Instance Method Details

#<<Object


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

static VALUE t_left_shift(VALUE self, VALUE obj) {
  Cmat *M = r2cmat(obj);
  LogCompressor *lc;
  VALUE lcv = rb_iv_get(self, "@log_compressor");
  Data_Get_Struct(lcv, LogCompressor, lc);
  Cmat *N = log_compressor_apply(lc, M);
  VALUE result = cmat2r(N);
  cmat_free(N);
  cmat_free(M);
  return result;
}