chris_lib 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chris_lib/chris_math.rb +4 -2
- data/lib/chris_lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6d799d0f8000a13766abc5e042a0533e989112b6d3a87abd3f193d18157fb75
|
4
|
+
data.tar.gz: 0dcc9ec5aeaa4a2179b8c79bbaa4e5ccaa7f93d235c7e907f5f8941a7dde6fc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce73e2ca6a4ed4096ac3ffe1c940ea984fbae0aebafcc1a122c26a49dc8d1cff98ad48188ecd9485ec9c5f10a6644672b8b81513abc6741d2dc9628a7f62f0fd
|
7
|
+
data.tar.gz: 2804b6cd5d494ffbfcb0bf366efa0700d5c5772b620857dc8c3df2556ceaab806cbf60d7b4a7870d998a8684af397451c700f32f52b6bd6a03bdcf2163a68b6a
|
data/lib/chris_lib/chris_math.rb
CHANGED
@@ -80,8 +80,10 @@ Array.class_eval do
|
|
80
80
|
|
81
81
|
# mean of array
|
82
82
|
def mean
|
83
|
-
raise 'Length must be greater than 0.' if length < 1
|
84
|
-
sum.to_f / length
|
83
|
+
raise 'chris_lib - f - Length must be greater than 0.' if length < 1
|
84
|
+
return sum.to_f / length unless all? { |e| e.class == Vector }
|
85
|
+
ary = map { |v| v.to_a }.transpose.map { |a| a.mean }
|
86
|
+
Vector.elements ary
|
85
87
|
end
|
86
88
|
|
87
89
|
# unbiased sample variance of array
|
data/lib/chris_lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chris_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02
|
11
|
+
date: 2022-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|