Class: CScalar
Class Method Summary collapse
-
.boolean ⇒ Object
(Construction) Short-Hand of
CArray.new(:boolean) { ... }
. -
.uint8 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:uint8) { ... }
. -
.cmplx128 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:cmplx128) { ... }
. -
.cmplx256 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:cmplx256) { ... }
. -
.cmplx64 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:cmplx64) { ... }
. -
.cmplx64 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:cmplx64) { ... }
. -
.cmplx128 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:cmplx128) { ... }
. -
.float64 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:float64) { ... }
. -
.fixlen(*dim, bytes: ) ⇒ Object
(Construction) Short-Hand of
CScalar.new(:fixlen, bytes: ) { ... }
. -
.float32 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:float32) { ... }
. -
.float128 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:float128) { ... }
. -
.float32 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:float32) { ... }
. -
.float64 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:float64) { ... }
. -
.int32 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:int32) { ... }
. -
.int16 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:int16) { ... }
. -
.int32 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:int32) { ... }
. -
.int64 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:int64) { ... }
. -
.int8 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:int8) { ... }
. -
.object ⇒ Object
(Construction) Short-Hand of
CScalar.new(:object) { ... }
. -
.int16 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:int16) { ... }
. -
.uint16 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:uint16) { ... }
. -
.uint32 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:uint32) { ... }
. -
.uint64 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:uint64) { ... }
. -
.uint8 ⇒ Object
(Construction) Short-Hand of
CScalar.new(:uint8) { ... }
.
Instance Method Summary collapse
-
#new(data_type, bytes = 0) { ... } ⇒ Object
constructor
Constructs a new CScalar object of data_type.
- #initialize_copy(other) ⇒ Object
Methods inherited from CArray
#==, #__attach__, #__detach__, #__sync__, #all_masked?, #ancestors, #any_masked?, #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, attach, #attach, #attach!, attach!, #attached?, big_endian?, #bitarray, #bitfield, #boolean, #boolean?, #bsearch, #bsearch_index, #bytes, cast, cast_self_or_other, #cast_with, #clip, #cmplx128, #cmplx256, #cmplx64, #coerce, #collect!, #collect_addr!, #collect_index!, #collect_with_addr!, #collect_with_index!, #complex?, #convert, #data_class, #data_class=, data_class?, #data_type, data_type?, data_type_name, #data_type_name, #dim, #dim0, #dim1, #dim2, #dim3, #dump_binary, #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?, #fetch_linear_addr, #fields, #fields_at, #fixlen, #fixlen?, #float128, #float32, #float64, #float?, #freeze, #has_data_class?, #has_mask?, #hash, #incr_addr, #inherit_mask, #inherit_mask_replace, #int16, #int32, #int64, #int8, #integer?, #invert_mask, #is_masked, #is_not_masked, #length, little_endian?, #load_binary, #map!, #map_addr!, #map_index!, #map_with_addr!, #map_with_index!, #mask, #mask=, #mask_array?, #members, #mul_add, #ndim, #numeric?, #obj_type, #object, #object?, #parent, #paste, #project, #rank, #read_only?, #reverse, #reverse!, #root_array, #same_shape?, #scalar?, #search, #search_index, #search_nearest, #search_nearest_index, #section, #seq, #seq!, #set, #shape, #size, sizeof, #sort, #sort!, #sort_addr, #str_format, #str_strptime, #swap_bytes, #swap_bytes!, #template, #time_strftime, #to_a, #to_ca, #to_s, #to_type, #trim, #trim!, #uint16, #uint32, #uint64, #uint8, #unmask, #unmask_copy, #unset, #unsigned?, #valid_addr?, #valid_index?, #value, #value_array?, #vectorized_fetch_linear_addr, #vectorized_find_linear_addr, #vectorized_section, #virtual?, #where, wrap, wrap_readonly, wrap_writable
Constructor Details
#new(data_type, bytes = 0) { ... } ⇒ Object
Constructs a new CScalar object of data_type.
The byte size of each element for the fixed length data type
(data_type == CA_FIXLEN
) is specified optional argument
bytes. Otherwise, this optional argument has no
effect. If the block is given, the new CScalar
object will be initialized by the value returned from the block.
def CScalar.new(data_type,bytes=0)
end
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 |
# File 'ext/ca_obj_array.c', line 1043
static VALUE
rb_cs_initialize (int argc, VALUE *argv, VALUE self)
{
volatile VALUE rtype, ropt, rbytes = Qnil;
CScalar *ca;
int8_t data_type;
ca_size_t bytes;
rb_scan_args(argc, argv, "11", (VALUE *) &rtype, (VALUE *) &ropt);
rb_scan_options(ropt, "bytes", &rbytes);
rb_ca_guess_type_and_bytes(rtype, rbytes, &data_type, &bytes);
rb_ca_data_type_import(self, rtype);
Data_Get_Struct(self, CScalar, ca);
cscalar_setup(ca, data_type, bytes, NULL);
if ( rb_block_given_p() ) {
volatile VALUE rval = rb_yield(self);
if ( rval != self ) {
rb_ca_store_addr(self, 0, rval);
}
}
return Qnil;
}
|
Class Method Details
.boolean ⇒ Object
(Construction)
Short-Hand of CArray.new(:boolean) { ... }
1102 1103 1104 1105 |
# File 'ext/ca_obj_array.c', line 1102
static VALUE
rb_cs_s_boolean (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_BOOLEAN);
}
|
.uint8 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:uint8) { ... }
1122 1123 1124 1125 |
# File 'ext/ca_obj_array.c', line 1122
static VALUE
rb_cs_s_uint8 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_UINT8);
}
|
.cmplx128 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:cmplx128) { ... }
1234 1235 1236 1237 |
# File 'ext/ca_obj_array.c', line 1234
static VALUE
rb_cs_s_cmplx128 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_CMPLX128);
}
|
.cmplx256 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:cmplx256) { ... }
1244 1245 1246 1247 |
# File 'ext/ca_obj_array.c', line 1244
static VALUE
rb_cs_s_cmplx256 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_CMPLX256);
}
|
.cmplx64 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:cmplx64) { ... }
1224 1225 1226 1227 |
# File 'ext/ca_obj_array.c', line 1224
static VALUE
rb_cs_s_cmplx64 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_CMPLX64);
}
|
.cmplx64 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:cmplx64) { ... }
1224 1225 1226 1227 |
# File 'ext/ca_obj_array.c', line 1224
static VALUE
rb_cs_s_cmplx64 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_CMPLX64);
}
|
.cmplx128 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:cmplx128) { ... }
1234 1235 1236 1237 |
# File 'ext/ca_obj_array.c', line 1234
static VALUE
rb_cs_s_cmplx128 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_CMPLX128);
}
|
.float64 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:float64) { ... }
1203 1204 1205 1206 |
# File 'ext/ca_obj_array.c', line 1203
static VALUE
rb_cs_s_float64 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_FLOAT64);
}
|
.fixlen(*dim, bytes: ) ⇒ Object
(Construction)
Short-Hand of CScalar.new(:fixlen, bytes: ) { ... }
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 |
# File 'ext/ca_obj_array.c', line 1076
static VALUE
rb_cs_s_fixlen (int argc, VALUE *argv, VALUE klass)
{
volatile VALUE ropt = rb_pop_options(&argc, &argv);
VALUE args[2] = { INT2NUM(CA_FIXLEN), ropt };
if ( argc > 0 ) {
rb_raise(rb_eArgError, "invalid number of arguments");
}
return rb_class_new_instance(2, args, klass);
}
|
.float32 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:float32) { ... }
1193 1194 1195 1196 |
# File 'ext/ca_obj_array.c', line 1193
static VALUE
rb_cs_s_float32 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_FLOAT32);
}
|
.float128 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:float128) { ... }
1213 1214 1215 1216 |
# File 'ext/ca_obj_array.c', line 1213
static VALUE
rb_cs_s_float128 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_FLOAT128);
}
|
.float32 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:float32) { ... }
1193 1194 1195 1196 |
# File 'ext/ca_obj_array.c', line 1193
static VALUE
rb_cs_s_float32 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_FLOAT32);
}
|
.float64 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:float64) { ... }
1203 1204 1205 1206 |
# File 'ext/ca_obj_array.c', line 1203
static VALUE
rb_cs_s_float64 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_FLOAT64);
}
|
.int32 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:int32) { ... }
1153 1154 1155 1156 |
# File 'ext/ca_obj_array.c', line 1153
static VALUE
rb_cs_s_int32 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_INT32);
}
|
.int16 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:int16) { ... }
1133 1134 1135 1136 |
# File 'ext/ca_obj_array.c', line 1133
static VALUE
rb_cs_s_int16 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_INT16);
}
|
.int32 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:int32) { ... }
1153 1154 1155 1156 |
# File 'ext/ca_obj_array.c', line 1153
static VALUE
rb_cs_s_int32 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_INT32);
}
|
.int64 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:int64) { ... }
1173 1174 1175 1176 |
# File 'ext/ca_obj_array.c', line 1173
static VALUE
rb_cs_s_int64 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_INT64);
}
|
.int8 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:int8) { ... }
1112 1113 1114 1115 |
# File 'ext/ca_obj_array.c', line 1112
static VALUE
rb_cs_s_int8 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_INT8);
}
|
.object ⇒ Object
(Construction)
Short-Hand of CScalar.new(:object) { ... }
1255 1256 1257 1258 |
# File 'ext/ca_obj_array.c', line 1255
static VALUE
rb_cs_s_VALUE (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_OBJECT);
}
|
.int16 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:int16) { ... }
1133 1134 1135 1136 |
# File 'ext/ca_obj_array.c', line 1133
static VALUE
rb_cs_s_int16 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_INT16);
}
|
.uint16 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:uint16) { ... }
1143 1144 1145 1146 |
# File 'ext/ca_obj_array.c', line 1143
static VALUE
rb_cs_s_uint16 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_UINT16);
}
|
.uint32 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:uint32) { ... }
1163 1164 1165 1166 |
# File 'ext/ca_obj_array.c', line 1163
static VALUE
rb_cs_s_uint32 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_UINT32);
}
|
.uint64 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:uint64) { ... }
1183 1184 1185 1186 |
# File 'ext/ca_obj_array.c', line 1183
static VALUE
rb_cs_s_uint64 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_UINT64);
}
|
.uint8 ⇒ Object
(Construction)
Short-Hand of CScalar.new(:uint8) { ... }
1122 1123 1124 1125 |
# File 'ext/ca_obj_array.c', line 1122
static VALUE
rb_cs_s_uint8 (int argc, VALUE *argv, VALUE klass) {
rb_cs_s_body(CA_UINT8);
}
|
Instance Method Details
#initialize_copy(other) ⇒ Object
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 |
# File 'ext/ca_obj_array.c', line 1264
static VALUE
rb_cs_initialize_copy (VALUE self, VALUE other)
{
CScalar *ca, *cs;
Data_Get_Struct(self, CScalar, ca);
Data_Get_Struct(other, CScalar, cs);
cscalar_setup(ca, cs->data_type, cs->bytes, NULL);
memcpy(ca->ptr, cs->ptr, ca->bytes);
rb_ca_data_type_inherit(self, other);
return self;
}
|