Class: Ikra::Symbolic::ArrayCombineCommand

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

Instance Attribute Summary

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, #dimensions, #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(target, others, block, ast: nil, block_size: DEFAULT_BLOCK_SIZE, keep: false, generator_node: nil, with_index: false, command_binding: nil) ⇒ ArrayCombineCommand

Returns a new instance of ArrayCombineCommand.



440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/symbolic/symbolic.rb', line 440

def initialize(
    target, 
    others, 
    block, 
    ast: nil, 
    block_size: DEFAULT_BLOCK_SIZE, 
    keep: false,
    generator_node: nil,
    with_index: false,
    command_binding: nil)

    super(block: block, block_ast: ast, block_size: block_size, keep: keep, generator_node: generator_node, command_binding: command_binding)

    # Read array at position `tid`
    @input = [SingleInput.new(command: target.to_command, pattern: :tid)] + others.map do |other|
        SingleInput.new(command: other.to_command, pattern: :tid)
    end

    if with_index
        @input.push(SingleInput.new(
            command: ArrayIndexCommand.new(dimensions: dimensions),
            pattern: :tid))
    end
end

Instance Method Details

#==(other) ⇒ Object



469
470
471
# File 'lib/symbolic/symbolic.rb', line 469

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

#accept(visitor) ⇒ Object



10
11
12
# File 'lib/symbolic/visitor.rb', line 10

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

#sizeObject



465
466
467
# File 'lib/symbolic/symbolic.rb', line 465

def size
    return input.first.command.size
end