classifier 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/classifier/extensions/vector.rb +9 -3
- metadata +2 -2
data/Rakefile
CHANGED
@@ -7,9 +7,15 @@ require 'matrix'
|
|
7
7
|
require 'mathn'
|
8
8
|
|
9
9
|
class Array
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def sum(identity = 0, &block)
|
11
|
+
return identity unless size > 0
|
12
|
+
|
13
|
+
if block_given?
|
14
|
+
map(&block).sum
|
15
|
+
else
|
16
|
+
inject { |sum, element| sum + element }.to_f
|
17
|
+
end
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
21
|
class Vector
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Carlson
|
@@ -9,7 +9,7 @@ autorequire: classifier
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-07-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|