module Digiproc::CoreExtensions::ArrayExtension::Multiply

Multiply two arrays element by element. They must be the same size

myArray.times(anotherArr) => Array (same size as the input)

Public Instance Methods

times(arr) click to toggle source
# File lib/extensions/core_extensions.rb, line 36
def times(arr)
    raise ArgumentError.new("Array sizes must be equal") if self.size != arr.size
    output = []
    self.each_with_index do |o,i|
        output << o * arr[i]
    end
    output
end