Class: Hornetseye::FLOAT_
- Defined in:
- lib/multiarray/float.rb
Defined Under Namespace
Modules: Match
Class Attribute Summary collapse
-
.double ⇒ Object
Returns the value of attribute double.
Class Method Summary collapse
-
.==(other) ⇒ Boolean
Test equality of classes.
-
.coerce(other) ⇒ Array<Class>
Type coercion for native elements.
-
.coercion(other) ⇒ Class
Compute balanced type for binary operation.
-
.default ⇒ Object
Get default value for elements of this type.
-
.descriptor(hash) ⇒ String
Get unique descriptor of this class.
-
.directive ⇒ String
Directive for packing/unpacking elements of this type.
-
.eql?(other) ⇒ Boolean
Equality for hash operations.
-
.float ⇒ Class
Convert to type based on floating point numbers.
-
.hash ⇒ Fixnum
Compute hash value for this class.
-
.inspect ⇒ String
Return string with information about this class.
-
.memory ⇒ Class
Memory type required to store elements of this type.
-
.storage_size ⇒ Integer
Get storage size to store an element of this type.
Methods inherited from Element
#compilable?, construct, #descriptor, #dup, fetch, #get, #initialize, #skip, #store, #strip, #values, #write
Methods inherited from Node
===, #[], #[]=, #array_type, array_type, basetype, #basetype, bool, byte, #check_shape, #coerce, coercion_bool, coercion_byte, coercion_maxint, compilable?, #compilable?, cond, contiguous, #decompose, #demand, #descriptor, dimension, #dimension, #dup, empty?, #empty?, finalised?, #finalised?, float_scalar, floating, #force, #get, height, #height, indgen, #inspect, match, maxint, #memory, #pointer_type, pointer_type, rgb?, #rgb?, scalar, #shape, shape, #simplify, size, #size, #storage_size, strip, #strip, subst, #subst, #to_a, to_s, #to_s, to_type, #typecode, typecode, typecodes, variables, #variables, #width, width
Methods included from Match
Methods included from OBJECT::Match
Methods included from COMPLEX_::Match
Methods included from Sequence_::Match
Methods included from BOOL::Match
Methods included from RGB_::Match
Methods included from INT_::Match
Methods included from Operations
#+@, #<=>, #b=, #b_with_decompose, #collect, #conditional, #convolve, define_binary_op, define_unary_op, #diagonal, #eq_with_multiarray, #fill!, #g=, #g_with_decompose, #histogram, #histogram_with_composite, #imag=, #imag_with_decompose, #inject, #integral, #lut, #lut_with_composite, #max, #min, #normalise, #product, #r=, #r_with_decompose, #range, #real=, #real_with_decompose, #roll, #sum, #to_type, #to_type_with_rgb, #transpose, #unroll
Constructor Details
This class inherits a constructor from Hornetseye::Element
Class Attribute Details
.double ⇒ Object
Returns the value of attribute double.
24 25 26 |
# File 'lib/multiarray/float.rb', line 24 def double @double end |
Class Method Details
.==(other) ⇒ Boolean
Test equality of classes
128 129 130 |
# File 'lib/multiarray/float.rb', line 128 def ==( other ) other.is_a? Class and other < FLOAT_ and double == other.double end |
.coerce(other) ⇒ Array<Class>
Type coercion for native elements
77 78 79 80 81 82 83 84 85 |
# File 'lib/multiarray/float.rb', line 77 def coerce( other ) if other < FLOAT_ return other, self elsif other < INT_ return self, self else super other end end |
.coercion(other) ⇒ Class
Compute balanced type for binary operation
60 61 62 63 64 65 66 67 68 |
# File 'lib/multiarray/float.rb', line 60 def coercion( other ) if other < FLOAT_ Hornetseye::FLOAT( ( double or other.double ) ) elsif other < INT_ self else super other end end |
.default ⇒ Object
Get default value for elements of this type
49 50 51 |
# File 'lib/multiarray/float.rb', line 49 def default 0.0 end |
.descriptor(hash) ⇒ String
Get unique descriptor of this class
119 120 121 |
# File 'lib/multiarray/float.rb', line 119 def descriptor( hash ) inspect end |
.directive ⇒ String
Directive for packing/unpacking elements of this type
101 102 103 |
# File 'lib/multiarray/float.rb', line 101 def directive double ? 'd' : 'f' end |
.eql?(other) ⇒ Boolean
Equality for hash operations
148 149 150 |
# File 'lib/multiarray/float.rb', line 148 def eql?( other ) self == other end |
.float ⇒ Class
Convert to type based on floating point numbers
92 93 94 |
# File 'lib/multiarray/float.rb', line 92 def float self end |
.hash ⇒ Fixnum
Compute hash value for this class.
137 138 139 |
# File 'lib/multiarray/float.rb', line 137 def hash [ :FLOAT_, double ].hash end |
.inspect ⇒ String
Return string with information about this class.
108 109 110 |
# File 'lib/multiarray/float.rb', line 108 def inspect "#{ double ? 'D' : 'S' }FLOAT" end |
.memory ⇒ Class
Memory type required to store elements of this type
31 32 33 |
# File 'lib/multiarray/float.rb', line 31 def memory Malloc end |
.storage_size ⇒ Integer
Get storage size to store an element of this type
40 41 42 |
# File 'lib/multiarray/float.rb', line 40 def storage_size double ? 8 : 4 end |