Class: Array

### Home Classes Methods

### In Files

- lib/classifier/extensions/vector.rb

### Parent

Object

### Methods

- #sum

### Class/Module Index

Quicksearch

- Classifier
- Classifier::Bayes
- Classifier::ContentNode
- Classifier::LSI
- Classifier::WordList
- GSL
- GSL::Matrix
- GSL::Vector
- Array
- Matrix
- Object
- String
- Vector

No matching classes.

# 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.