Parent

Methods

Array

Public Instance Methods

sum(identity = 0, &block) click to toggle source
# File lib/classifier/extensions/vector.rb, line 10
def sum(identity = 0, &block)
  return identity unless size > 0

  if block_given?
    map(&block).sum
  else
    inject { |sum, element| sum + element }.to_f
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.