chris_lib 2.0.6 → 2.0.9

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: 956710619bb99978d14f19b219f20574d71bc394cbeebbfb6aee967edd187d3a
4
+ data.tar.gz: 32e53ef0e3cbe473e16f45e235f158d8a3a57694088fece0b59d8c9213e9bb55
5
5
  SHA512:
6
- metadata.gz: adb81857b6da01ac1ce99289841a4f0ddf0477c00e36d5067c9e6bcf28adb29f781a255d4bde94aeeac79dd64c18862bece4a689f284a2940d59393ca2b65b03
7
- data.tar.gz: 55a4532a245f4a97567078799565e35557e6a9d3d8639f043c362e89c68b7d0add8f5f29d823c5ad735ea50d6ec96eeec5f293f6b03dd00626db7c0e6d2f1168
6
+ metadata.gz: 9c90eadf334c22831c50491ec45d52e3eb98de2305633bb54a25cc24275477e6f337c30ec95564d95efa32c86ad3f458ce0ea6eb181b32641b245ca0bf7bdac2
7
+ data.tar.gz: 7d4c14a98746fd819bf78597dce9e65ef2000ce9fb306ae755e824b1c1ecc4d8045d240a0a19ad3e015ca0501045cf6383dab87f8f92dfecd5a93d8b45a41993
@@ -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.9"
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.9
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-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -114,6 +114,20 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: colorize
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
117
131
  description: It includes maths, datetime, and rspec access test libraries.
118
132
  email:
119
133
  - obromios@gmail.com