zipf 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/zipf/SparseVector.rb +9 -0
- data/lib/zipf/fileutil.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54d12705390ff839421fa266ca48785fe6650a67
|
4
|
+
data.tar.gz: 04ec96bf88ce2227f09fc2ec1d247403813931f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77e3ff04eb800c75f2c69175ec05c9594c8b3d7bec1b65dfbb3b021cd052a60cda6cfe187aa3f9a4dbd8074029a8055d85fa04d3442039e6fcc0ba573d03b7cb
|
7
|
+
data.tar.gz: 0a7d2b0cdc6b3a87d5d1290e570f323f05fb7963ff82d6d17dab75f89581153f363ae34a3310300a3633cbbe47794d5b3233b6559f3fbd174c0583798526b715
|
data/lib/zipf/SparseVector.rb
CHANGED
@@ -179,6 +179,15 @@ class SparseVector < Hash
|
|
179
179
|
return new
|
180
180
|
end
|
181
181
|
|
182
|
+
def / scalar
|
183
|
+
raise ArgumentError, "Arg is not numeric #{scalar}" unless scalar.is_a? Numeric
|
184
|
+
new = SparseVector.new
|
185
|
+
self.keys.each { |k|
|
186
|
+
new[k] = self[k] / scalar
|
187
|
+
}
|
188
|
+
return new
|
189
|
+
end
|
190
|
+
|
182
191
|
def self.mean a
|
183
192
|
mean = SparseVector.new
|
184
193
|
a.each { |i|
|
data/lib/zipf/fileutil.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zipf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Simianer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|