Class: Hornetseye::INDEX_

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

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Element

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

Methods inherited from Node

===, #[], #[]=, #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, float_scalar, floating, #force, #get, height, #height, indgen, #inspect, match, maxint, #memory, #pointer_type, pointer_type, #rgb?, rgb?, scalar, #shape, shape, #simplify, #size, #storage_size, #strip, #subst, #to_a, to_s, #to_s, to_type, #typecode, typecode, typecodes, #variables, #width, width

Methods included from FLOAT_::Match

#align, #fit

Methods included from OBJECT::Match

#align, #fit

Methods included from COMPLEX_::Match

#align, #fit

Methods included from Sequence_::Match

#align, #fit

Methods included from BOOL::Match

#fit

Methods included from RGB_::Match

#align, #fit

Methods included from Hornetseye::INT_::Match

#fit

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

#initializeINDEX_

Returns a new instance of INDEX_.



99
100
101
# File 'lib/multiarray/index.rb', line 99

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.



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

def size
  @size
end

Class Method Details

.array_typeClass

Get type of result of delayed operation

Returns:

  • (Class)

    Type of result.



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

def array_type
  INT
end

.descriptor(hash) ⇒ String

Get unique descriptor of this class

Parameters:

  • hash (Hash)

    Labels for any variables.

Returns:

  • (String)

    Descriptor of this class.



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

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))”).



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

def inspect
  "INDEX(#{size.inspect})"
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

.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