Class: CAWindow

Inherits:
CAVirtual show all
Defined in:
ext/ca_obj_window.c

Constant Summary

Constants inherited from CArray

CArray::DComplex, CArray::DEFAULT_GC_INTERVAL, CArray::DFloat, CArray::DataType, CArray::HAVE_COMPLEX, CArray::RObject, CArray::SComplex, CArray::SFloat, CArray::TypeSymbol, CArray::VERSION, CArray::VERSION_CODE, CArray::VERSION_DATE, CArray::VERSION_MAJOR, CArray::VERSION_MINOR, CArray::VERSION_TEENY

Instance Method Summary collapse

Methods inherited from CArray

#<=>, #==, #[], #[]=, #__attach__, #__detach__, __new__, __new_fixlen__, #__sync__, _scan_float, _scan_int, #addr2index, #address, #all_close?, #all_equal?, #all_equiv?, #all_masked?, #ancestors, #anomaly, #any_close?, #any_equal?, #any_equiv?, #any_masked?, #arg, #as_boolean, #as_cmplx128, #as_cmplx256, #as_cmplx64, #as_fixlen, #as_float128, #as_float32, #as_float64, #as_int16, #as_int32, #as_int64, #as_int8, #as_object, #as_type, #as_uint16, #as_uint32, #as_uint64, #as_uint8, #asign, #attach, attach, attach!, #attach!, #attached?, #attribute, #attribute=, #between, big_endian?, #bin, bind, #bitarray, #bitfield, #bits, #block_iterator, #blocks, boolean, #boolean, #boolean?, broadcast, #broadcast_to, #bsearch, #bsearch_index, #by, byte, #bytes, cast, cast_self_or_other, #cast_with, #classes, #classify, #clip, #cmplx128, cmplx128, #cmplx256, cmplx256, cmplx64, #cmplx64, #code, #coerce, #collect!, #collect_addr!, #collect_index!, #collect_with_addr!, #collect_with_index!, combine, #compact, #compacted, complex, #complex?, composite, #contains, #convert, #correlation, #count_close, #count_equal, #count_equiv, #count_false, #count_masked, #count_not_masked, #count_true, #covariance, #covariancep, #cummax, #cummin, #cumprod, #cumwsum, #data_class, #data_type, data_type?, data_type_name, #data_type_name, dcomplex, #deg_180, #deg_180!, #deg_360, #deg_360!, #delete_block, #dim, #dim0, #dim1, #dim2, #dim3, #display_by_magick, double, dump, #dump_binary, #duplicated_values, #each, #each_addr, each_index, #each_index, #each_with_addr, #each_with_index, #elem_copy, #elem_decr, #elem_fetch, #elem_incr, #elem_masked?, #elem_store, #elem_swap, #elements, #empty?, endian, #entity?, #extend_as_table, #fa, #fake, #false, #farray, #field, #fields, #fields_at, #fill, #fill_copy, #first, #fixlen, fixlen, #fixlen?, #flatten, #flattened, float, #float128, float128, #float32, float32, #float64, float64, #float?, #freeze, from_binary, #from_bit_string, from_bit_string, gc_interval, gc_interval=, #gradate, #grade, #grid, guess_array_shape, guess_type_and_bytes, #has_attribute?, #has_data_class?, #has_mask?, #hash, #imag, #imag=, #incr_addr, #index, #index2addr, #indices, #inherit_mask, #inherit_mask_replace, #initialize, #insert_block, #inspect, int, int16, #int16, int32, #int32, int64, #int64, int8, #int8, #integer?, #invert_mask, #is_close, #is_divisible, #is_equiv, #is_masked, #is_not_divisible, #is_not_masked, #is_real, #join, join, #last, #length, little_endian?, load, load_binary, #load_binary, load_binary_io, load_by_magick, #map, #map!, #map_addr!, #map_index!, #map_with_addr!, #map_with_index!, #marshal_dump, #marshal_load, #mask, #mask=, #mask_array?, #maskout, #maskout!, #matchup, #matchup_nearest, #max_by, #max_with, #median, mem_usage, #members, merge, meshgrid, #min_by, #min_with, #mul_add, #ndim, #nlargest, #nlargest_addr, #none_close?, #none_equal?, #none_equiv?, #normalize_index, #nsmallest, #nsmallest_addr, #numeric?, #obj_type, object, #object, #object?, #order, pack, #parent, #paste, #percentile, pickup, #project, #pull, #pulled, #quantile, #quantize, #quo, #rad_2pi, #rad_2pi!, #rad_pi, #rad_pi!, #random, #randomn, #randomn!, #range, #rank, #read_only?, #real, #real=, #real?, #recurrence, #recurrence!, #refer, #replace_value, reset_gc_interval, #reshape, #resize, #reverse, #reverse!, #reversed, #roll, #roll!, #rolled, #root_array, #rotate, #rotate!, #rotated, #same_shape?, save, #save_binary, #save_binary_io, #save_by_magick, #scalar?, #scale, #scale!, scan_index, #search, #search_index, #search_nearest, #search_nearest_index, #select, #seq, #seq!, #set, #shape, #shift, #shift!, #shifted, short, #sign, #size, sizeof, #sort, #sort!, #sort_addr, #sort_by, #sort_with, #sorted_by, #sorted_with, #span, span, #span!, #split, #st, #str_bytesize, #str_capitalize, #str_center, #str_chomp, #str_chop, #str_chr, #str_clear, #str_count, #str_delete, #str_delete_prefix, #str_delete_suffix, #str_downcase, #str_dump, #str_encode, #str_encoding, #str_extract, #str_force_encoding, #str_format, #str_gsub, #str_includes, #str_index, #str_intern, #str_is_empty, #str_is_end_with, #str_is_start_with, #str_len, #str_ljust, #str_lstrip, #str_matches, #str_rindex, #str_rjust, #str_rstrip, #str_scrub, #str_size, #str_strip, #str_strptime, #str_sub, #str_swapcase, #str_to_datetime, #str_to_f, #str_to_i, #str_to_r, #str_to_time, #str_upcase, summation, #swap_bytes, #swap_bytes!, #t, #template, #test, #test_ca_to_cptr, #time_ajd, #time_day, #time_format, #time_hour, #time_is_leap, #time_jd, #time_minute, #time_month, #time_second, #time_strftime, #time_year, #to_a, #to_binary, #to_bit_string, #to_ca, #to_column, #to_row, #to_s, #to_type, #transform, #transpose, #transpose!, #transposed, #trim, #trim!, #true, #uint16, uint16, #uint32, uint32, #uint64, uint64, #uint8, uint8, #unbound_repeat, #uniq, #unmask, #unmask_copy, #unset, #unsigned?, #valid_addr?, #valid_index?, #value, #value_array?, #variance, #variancep, #virtual?, #where, #where_range, #window, #window_iterator, #windows, #wmean, wrap, wrap_readonly, wrap_writable, #wsum

Methods included from CArray::DataTypeExtension

#arange, #eye, #full, #identity, #linspace, #ones, #zeros

Constructor Details

This class inherits a constructor from CArray

Instance Method Details

#addr2addr0Object

yard:

class CAWindow
  def addr2addr0 (addr)
  end
end


882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
# File 'ext/ca_obj_window.c', line 882

static VALUE
rb_ca_window_addr2addr0 (VALUE self, VALUE raddr)
{
  CAWindow *cw;
  ca_size_t addr = NUM2SIZE(raddr);
  ca_size_t idx[CA_RANK_MAX];
  int8_t i;

  Data_Get_Struct(self, CAWindow, cw);

  ca_addr2index((CArray*)cw, addr, idx);

  addr = 0;
  for (i=0; i<cw->ndim; i++) {
    addr *= cw->size0[i];
    addr += cw->start[i] + idx[i];
  }

  return SIZE2NUM(addr);
}

#boundsObject



955
956
957
958
959
960
961
# File 'ext/ca_obj_window.c', line 955

static VALUE
rb_ca_window_get_bounds (VALUE self)
{
  CAWindow *cw;
  Data_Get_Struct(self, CAWindow, cw);
  return SIZE2NUM(cw->bounds);
}

#countObject

#fill_valueObject



947
948
949
950
951
952
953
# File 'ext/ca_obj_window.c', line 947

static VALUE
rb_ca_window_get_fill_value (VALUE self)
{
  CAWindow *cw;
  Data_Get_Struct(self, CAWindow, cw);
  return rb_ca_ptr2obj(self, cw->fill);
}

#fill_value=Object

yard:

class CAWindow
  def fill_value
  end
  def fill_value= (val)
  end
end


938
939
940
941
942
943
944
945
# File 'ext/ca_obj_window.c', line 938

static VALUE
rb_ca_window_set_fill_value (VALUE self, VALUE rfval)
{
  CAWindow *cw;
  Data_Get_Struct(self, CAWindow, cw);
  rb_ca_obj2ptr(self, rfval, cw->fill);
  return Qnil;
}

#index2addr0Object

yard:

class CAWindow
  def index2addr0 (idx)
  end
end


845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
# File 'ext/ca_obj_window.c', line 845

static VALUE
rb_ca_window_idx2addr0 (int argc, VALUE *argv, VALUE self)
{
  CAWindow *cw;
  ca_size_t addr;
  int8_t i;
  ca_size_t idxi;

  Data_Get_Struct(self, CAWindow, cw);

  if ( argc != cw->ndim ) {
    rb_raise(rb_eArgError,
             "invalid # of arguments (should be <%i>)", cw->ndim);
  }

  addr = 0;
  for (i=0; i<cw->ndim; i++) {
    idxi = NUM2SIZE(argv[i]);
    CA_CHECK_INDEX(idxi, cw->dim[i]);
    addr = cw->size0[i] * addr + cw->start[i] + idxi;
  }

  if ( addr < 0 || addr >= cw->parent->elements ) {
    return Qnil;
  }
  else {
    return SIZE2NUM(addr);
  }
}

#initialize_copyObject



825
826
827
828
829
830
831
832
833
834
835
836
# File 'ext/ca_obj_window.c', line 825

static VALUE
rb_ca_window_initialize_copy (VALUE self, VALUE other)
{
  CAWindow *ca, *cs;

  Data_Get_Struct(self,  CAWindow, ca);
  Data_Get_Struct(other, CAWindow, cs);

  ca_window_setup(ca, cs->parent, cs->start, cs->count, cs->bounds, cs->fill);

  return self;
}

#moveObject



904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
# File 'ext/ca_obj_window.c', line 904

static VALUE
rb_ca_window_move (int argc, VALUE *argv, VALUE self)
{
  CAWindow *cw;
  ca_size_t start;
  int8_t i;

  Data_Get_Struct(self, CAWindow, cw);

  if ( argc != cw->ndim ) {
    rb_raise(rb_eArgError, "invalid # of arguments");
  }

  ca_update_mask(cw);
  for (i=0; i<cw->ndim; i++) {
    start = NUM2SIZE(argv[i]);
    cw->start[i] = start;
    if ( cw->mask ) {
      ((CAWindow*)(cw->mask))->start[i] = start;
    }
  }

  return self;
}

#size0Object

#startObject