Class: Hornetseye::Store

Inherits:
Node show all
Defined in:
lib/multiarray/store.rb

Instance Method Summary collapse

Methods inherited from Node

===, #[], #[]=, array_type, basetype, #basetype, bool, byte, #check_shape, #coerce, coercion_bool, coercion_byte, coercion_maxint, compilable?, cond, contiguous, #decompose, 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, #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 Hornetseye::Sequence_::Match

#align, #fit

Methods included from BOOL::Match

#fit

Methods included from RGB_::Match

#align, #fit

Methods included from 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

#initialize(dest, source) ⇒ Store

Returns a new instance of Store.



21
22
23
# File 'lib/multiarray/store.rb', line 21

def initialize( dest, source )
  @dest, @source = dest, source
end

Instance Method Details

#array_typeObject



29
30
31
# File 'lib/multiarray/store.rb', line 29

def array_type
  @dest.array_type
end

#compilable?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/multiarray/store.rb', line 65

def compilable?
  @dest.compilable? and @source.compilable?
end

#demandObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/multiarray/store.rb', line 33

def demand
  if variables.empty?
    if dimension > 0
      shape.last.times do |i|
        dest = @dest.element INT.new( i )
        source = @source.dimension == 0 ? @source :
                                          @source.element( INT.new( i ) )
        Store.new( dest, source ).demand
      end  
    else
      @dest.store @source.demand
    end
    @dest
  else
    super
  end
end

#descriptor(hash) ⇒ Object



25
26
27
# File 'lib/multiarray/store.rb', line 25

def descriptor( hash )
  "Store(#{@dest.descriptor( hash )},#{@source.descriptor( hash )})"
end

#stripObject



59
60
61
62
63
# File 'lib/multiarray/store.rb', line 59

def strip
  vars1, values1, term1 = @dest.strip
  vars2, values2, term2 = @source.strip
  return vars1 + vars2, values1 + values2, Store.new( term1, term2 )
end

#subst(hash) ⇒ Object



51
52
53
# File 'lib/multiarray/store.rb', line 51

def subst( hash )
  self.class.new @dest.subst( hash ), @source.subst( hash )
end

#variablesObject



55
56
57
# File 'lib/multiarray/store.rb', line 55

def variables
  @dest.variables + @source.variables
end