Class: Hornetseye::INDEX_

Inherits:
Element show all
Defined in:
lib/multiarray/index.rb

Overview

Class for representing native array index types

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Element

#assign, coercion, #compilable?, construct, #descriptor, #dup, fetch, #get, #skip, #strip, #values, #write

Methods inherited from Node

#+@, #<=>, ===, #[], #[]=, #allocate, #b=, #b_with_decompose, #basetype, basetype, #between?, bool, byte, #check_shape, #clip, #coerce, coercion_bool, coercion_byte, coercion_maxint, #collect, #compilable?, compilable?, #components, cond, #conditional, #convolve, #decompose, define_binary_op, define_unary_op, #demand, #descriptor, #diagonal, #dilate, #dimension, dimension, #downsample, #dup, #each, #empty?, #eq_with_multiarray, #erode, #fill!, finalised?, #finalised?, #flip, float, float_scalar, floating, #fmod_with_float, #force, #g=, #g_with_decompose, #gauss_blur, #gauss_gradient, #get, #height, #histogram, #histogram_with_rgb, identity, #if, #if_else, #imag=, #imag_with_decompose, indgen, #inject, #inspect, #integral, #lut, #lut_with_rgb, #malloc, #mask, match, #matched?, #max, maxint, #mean, #memorise, #memory, #min, #normalise, #prod, #r=, #r_with_decompose, #range, #real=, #real_with_decompose, #reshape, #rgb?, rgb?, #roll, scalar, #shape, #shift, #simplify, #size, #sobel, #stretch, #stride, #strides, #strip, #subst, #sum, #swap_rgb_with_scalar, #table, #to_a, #to_s, to_s, #to_type, to_type, #to_type_with_identity, #to_type_with_rgb, #transpose, #typecode, typecodes, #unmask, #unroll, #variables, #warp, #width

Methods included from Field_::Match

#align, #fit

Methods included from FLOAT_::Match

#align, #fit

Methods included from OBJECT::Match

#align, #fit

Methods included from COMPLEX_::Match

#align, #fit

Methods included from BOOL::Match

#fit

Methods included from RGB_::Match

#align, #fit

Methods included from Hornetseye::INT_::Match

#fit

Constructor Details

#initializeINDEX_

This value must not be instantiated

The method throws an exception.



104
105
106
# File 'lib/multiarray/index.rb', line 104

def initialize
  raise "#{self.class.inspect} must not be instantiated"
end

Class Attribute Details

.sizeObject

Size of range for this index

Returns:

  • (Object)

    Size of range for this index.



28
29
30
# File 'lib/multiarray/index.rb', line 28

def size
  @size
end

Class Method Details

.descriptor(hash) ⇒ String

Get unique descriptor of this class

Parameters:

  • hash (Hash)

    Labels for any variables.

Returns:

  • (String)

    Descriptor of this class.



45
46
47
# File 'lib/multiarray/index.rb', line 45

def descriptor( hash )
  "INDEX(#{size.descriptor( hash )})"
end

.inspectString

Display information about this class

Returns:

  • (String)

    Returns string with information about this class (e.g. “INDEX(INT(5))”).



34
35
36
# File 'lib/multiarray/index.rb', line 34

def inspect
  "INDEX(#{size.inspect})"
end

.shapeObject



53
54
55
# File 'lib/multiarray/index.rb', line 53

def shape
  []
end

.stripArray<Array,Node>

Strip of all values

Split up into variables, values, and a term where all values have been replaced with variables.

values, and the term based on variables.

Returns:



66
67
68
69
70
71
72
73
# File 'lib/multiarray/index.rb', line 66

def strip
  meta_vars, meta_values = size.strip
  if meta_vars.empty?
    return [], [], self
  else
    return meta_vars, meta_values, Hornetseye::INDEX( meta_vars.first )
  end
end

.subst(hash) ⇒ Class

Substitute variables

Substitute the variables with the values given in the hash.

Parameters:

  • hash (Hash)

    Substitutions to apply.

Returns:

  • (Class)

    Class with substitutions applied.



84
85
86
# File 'lib/multiarray/index.rb', line 84

def subst( hash )
  Hornetseye::INDEX size.subst( hash )
end

.typecodeObject



49
50
51
# File 'lib/multiarray/index.rb', line 49

def typecode
  INT
end

.variablesSet

Get variables contained in this class

Returns:

  • (Set)

    Returns set of variables.



93
94
95
# File 'lib/multiarray/index.rb', line 93

def variables
  size.variables
end