Class: Ikra::Symbolic::ArrayIndexCommand

Inherits:
Object
  • Object
show all
Includes:
ArrayCommand
Defined in:
lib/symbolic/visitor.rb,
lib/symbolic/symbolic.rb

Instance Attribute Summary collapse

Attributes included from ArrayCommand

#block, #block_size, #generator_node, #gpu_result_pointer, #input, #keep, #unique_id

Instance Method Summary collapse

Methods included from ArrayCommand

#[], #block_def_node, #block_parameter_names, #command_binding, #command_translator_class, #each, #eql?, #execute, #externals, #has_previous_result?, #hash, #ikra_type, included, #lexical_externals, #pack, #post_execute, reset_unique_id, #result_type, #set_unique_id, #to_c_type, #to_command, #to_ffi_type, #to_ruby_type, #to_s, #with_index

Methods included from Types::RubyType

#class_id, #eql?, #hash, #inspect, #is_primitive?, #is_union_type?, #should_generate_self_arg?, #to_array_type, #to_c_type, #to_ruby_type, #to_str, #to_union_type

Methods included from ParallelOperations

#&, #*, #+, #-, #/, #<, #<=, #>, #>=, #^, #pcombine, #pmap, #preduce, #pstencil, #pzip, #|

Constructor Details

#initialize(block_size: DEFAULT_BLOCK_SIZE, keep: false, dimensions: nil) ⇒ ArrayIndexCommand

Returns a new instance of ArrayIndexCommand.



422
423
424
425
426
427
428
429
430
# File 'lib/symbolic/symbolic.rb', line 422

def initialize(block_size: DEFAULT_BLOCK_SIZE, keep: false, dimensions: nil)
    super(block_size: block_size, keep: keep)

    @dimensions = dimensions
    @size = dimensions.reduce(:*)

    # No input
    @input = []
end

Instance Attribute Details

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



419
420
421
# File 'lib/symbolic/symbolic.rb', line 419

def dimensions
  @dimensions
end

#sizeObject (readonly)

Returns the value of attribute size.



420
421
422
# File 'lib/symbolic/symbolic.rb', line 420

def size
  @size
end

Instance Method Details

#==(other) ⇒ Object



432
433
434
# File 'lib/symbolic/symbolic.rb', line 432

def ==(other)
    return super(other) && dimensions == other.dimensions && size == other.size
end

#accept(visitor) ⇒ Object



4
5
6
# File 'lib/symbolic/visitor.rb', line 4

def accept(visitor)
    visitor.visit_array_index_command(self)
end