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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c7c8165557ae3b2b4b431e71fe111676688ac5cd962ef5607abdc162e9f25f8
4
- data.tar.gz: fd500a446db634ef54d25198aa48f5cff8f55c66b66178a87b0a654afecc4982
3
+ metadata.gz: b6d799d0f8000a13766abc5e042a0533e989112b6d3a87abd3f193d18157fb75
4
+ data.tar.gz: 0dcc9ec5aeaa4a2179b8c79bbaa4e5ccaa7f93d235c7e907f5f8941a7dde6fc7
5
5
  SHA512:
6
- metadata.gz: adb81857b6da01ac1ce99289841a4f0ddf0477c00e36d5067c9e6bcf28adb29f781a255d4bde94aeeac79dd64c18862bece4a689f284a2940d59393ca2b65b03
7
- data.tar.gz: 55a4532a245f4a97567078799565e35557e6a9d3d8639f043c362e89c68b7d0add8f5f29d823c5ad735ea50d6ec96eeec5f293f6b03dd00626db7c0e6d2f1168
6
+ metadata.gz: ce73e2ca6a4ed4096ac3ffe1c940ea984fbae0aebafcc1a122c26a49dc8d1cff98ad48188ecd9485ec9c5f10a6644672b8b81513abc6741d2dc9628a7f62f0fd
7
+ data.tar.gz: 2804b6cd5d494ffbfcb0bf366efa0700d5c5772b620857dc8c3df2556ceaab806cbf60d7b4a7870d998a8684af397451c700f32f52b6bd6a03bdcf2163a68b6a
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ChrisLib
2
- VERSION = "2.0.6"
2
+ VERSION = "2.0.7"
3
3
  end
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.6
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-13 00:00:00.000000000 Z
11
+ date: 2022-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv