class Ikra::Symbolic::ArrayIdentityCommand

Attributes

target[R]

Public Class Methods

new(target, block_size: DEFAULT_BLOCK_SIZE, dimensions: nil) click to toggle source
Calls superclass method Ikra::Symbolic::ArrayCommand::new
# File lib/symbolic/symbolic.rb, line 804
def initialize(target, block_size: DEFAULT_BLOCK_SIZE, dimensions: nil)
    super(block_size: block_size)

    # Ensure that base array cannot be modified
    target.freeze

    # One thread per array element
    @target = target
    @input = [SingleInput.new(command: target, pattern: :tid)]

    @dimensions = dimensions
end

Public Instance Methods

accept(visitor) click to toggle source
# File lib/symbolic/visitor.rb, line 34
def accept(visitor)
    visitor.visit_array_identity_command(self)
end
base_type() click to toggle source
# File lib/symbolic/symbolic.rb, line 839
def base_type
    # TODO: add caching (`input` is frozen)
    type = Types::UnionType.new

    input.first.command.each do |element|
        type.add(element.class.to_ikra_type)
    end

    return type
end
dimensions() click to toggle source
# File lib/symbolic/symbolic.rb, line 825
def dimensions
    if @dimensions == nil
        return [size]
    else
        return @dimensions
    end
end
execute() click to toggle source
# File lib/symbolic/symbolic.rb, line 817
def execute
    return input.first.command
end
externals() click to toggle source

Returns a collection of external objects that are accessed within a parallel section. This includes all elements of the base array.

# File lib/symbolic/symbolic.rb, line 835
def externals
    lexical_externals.keys + input.first.command
end
size() click to toggle source
# File lib/symbolic/symbolic.rb, line 821
def size
    return input.first.command.size
end