lib/classifier/extensions/vector.rb in luisparravicini-classifier-1.3.8 vs lib/classifier/extensions/vector.rb in luisparravicini-classifier-1.3.9
- old
+ new
@@ -4,18 +4,9 @@
# These are extensions to the std-lib 'matrix' to allow an all ruby SVD
require 'matrix'
require 'mathn'
-# Conflicts with ActiveSupport
-unless Array.new.respond_to?(:sum)
- class Array
- def sum
- inject(0) { |sum,term| sum += term }.to_f
- end
- end
-end
-
class Vector
def magnitude
sumsqs = 0.0
self.size.times do |i|
sumsqs += self[i] ** 2.0