Class: Hornetseye::ElementWise_
- Defined in:
- docs/multiarray/lib/multiarray/elementwise.rb
Overview
Class for representing element-wise operations
Class Attribute Summary collapse
-
.conversion ⇒ Proc
Name of method for type conversion.
-
.key ⇒ Symbol, String
Unique key to identify operation.
-
.operation ⇒ Proc
Name of operation.
Class Method Summary collapse
-
.inspect ⇒ String
Get string with information about this class.
Instance Method Summary collapse
-
#decompose(i) ⇒ Node
Decompose composite elements.
-
#initialize(*values) ⇒ ElementWise_
constructor
Initialise unary operation.
- #shape ⇒ Object
- #typecode ⇒ Object
Methods inherited from Node
#<=>, ===, #[], #[]=, #allocate, #b=, #b_with_decompose, #basetype, #between?, bool, #check_shape, #clip, coercion_bool, coercion_byte, coercion_maxint, #collect, #components, cond, #conditional, #convolve, #dilate, dimension, #dimension, #downsample, #dup, #each, #empty?, #eq_with_multiarray, #erode, #fill!, #flip, float_scalar, floating, #fmod_with_float, #g=, #g_with_decompose, #gauss_blur, #gauss_gradient, #height, #histogram, #histogram_with_rgb, #if, #if_else, #imag=, #imag_with_decompose, indgen, #inject, #inspect, #integral, #lut, #lut_with_rgb, #mask, #matched?, #max, #mean, #memorise, #memory, #min, #normalise, #orig_to_cvmat, #orig_to_type_with_frame, #prod, #r=, #r_with_decompose, #range, #real=, #real_with_decompose, #reshape, rgb?, #rgb?, #roll, #save_dfloat, #save_dfloatrgb, #save_magick, #save_openexr, #save_sfloat, #save_sfloatrgb, #save_ubyte, #save_ubytergb, #save_uint, #save_uintrgb, #save_usint, #save_usintrgb, scalar, shape, #shift, #show, #size, #sobel, #stretch, #sum, #swap_rgb_with_scalar, #to_a, #to_cvmat, #to_magick, #to_narray, to_type, #to_type, #to_type_with_frame, #to_type_with_identity, #to_type_with_rgb, #transpose, typecode, #unmask, #unroll, #warp, #width
Constructor Details
#initialize(*values) ⇒ ElementWise_
Initialise unary operation
72 73 74 75 |
# File 'docs/multiarray/lib/multiarray/elementwise.rb', line 72 def initialize( *values ) @values = values check_shape *values end |
Class Attribute Details
.conversion ⇒ Proc
Name of method for type conversion
38 39 40 |
# File 'docs/multiarray/lib/multiarray/elementwise.rb', line 38 def conversion @conversion end |
.key ⇒ Symbol, String
Unique key to identify operation
33 34 35 |
# File 'docs/multiarray/lib/multiarray/elementwise.rb', line 33 def key @key end |
.operation ⇒ Proc
Name of operation
28 29 30 |
# File 'docs/multiarray/lib/multiarray/elementwise.rb', line 28 def operation @operation end |
Class Method Details
.inspect ⇒ String
Get string with information about this class
43 44 45 |
# File 'docs/multiarray/lib/multiarray/elementwise.rb', line 43 def inspect key.to_s end |
Instance Method Details
#decompose(i) ⇒ Node
Decompose composite elements
This method decomposes composite elements into array.
196 197 198 199 |
# File 'docs/multiarray/lib/multiarray/elementwise.rb', line 196 def decompose( i ) values = @values.collect { |value| value.decompose i } self.class.new( *values ).demand end |
#shape ⇒ Object
94 95 96 97 |
# File 'docs/multiarray/lib/multiarray/elementwise.rb', line 94 def shape shapes = @values.collect { |value| value.shape } shapes.inject { |a,b| a.size > b.size ? a : b } end |
#typecode ⇒ Object
89 90 91 92 |
# File 'docs/multiarray/lib/multiarray/elementwise.rb', line 89 def typecode typecodes = @values.collect { |value| value.typecode } self.class.conversion.call *typecodes end |