digiproc 0.2.0 → 0.2.5

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: 4d49c5205077bdeed24e25abd67014521fef219caa6187104efd16456faa3b7a
4
- data.tar.gz: 6f846c95767ca30943f0ef55c9c302af576a1ee2ff3231ccc062c255f70a6b64
3
+ metadata.gz: 31ca4f5ba15b2f7dbefe946d24bc9f69f57308dca39f04b836de296e6e068d43
4
+ data.tar.gz: 995fd90cbf150fa30db77f7091357041cffbc07d327f5673e84dba9634e7a65a
5
5
  SHA512:
6
- metadata.gz: 01f77d89d7bffe1eff3ce7008562350582c2950dc4f087d9503ef258daca42a9abb7b23ad7a7ee2958313a5ab76ae88f0748316162ceb805c0350710d87869a1
7
- data.tar.gz: 546f470e516191684c5fcab26f06dea0c25c6132450d23b8e4a7d70219d5e0446414b05ba3d45b8803ca2a30f6c7d4679a46a821271790c7d05b29c3326dd8db
6
+ metadata.gz: 11096509ee34d9f8c78201f45280a557d9297fef94697735bf5a36d31eb3d92c0f6f3d7abe83769e0d70b8e6f0bfaa87a0396d73ebcee888cd11a52291dc6449
7
+ data.tar.gz: e4ae86838bcb1c40479eaed012c27cacde242f034aaba7e1b94c4c60423f813e460fe1c05f027670ff3deb34b63b121bba62618a5a779b11b62a5e22e284bea0
data/Gemfile CHANGED
@@ -5,4 +5,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in digiproc.gemspec
6
6
  gemspec
7
7
  gem 'gruff'
8
+ gem 'bigdecimal'
8
9
 
@@ -1,13 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- digiproc (0.2.0)
4
+ digiproc (0.2.5)
5
+ bigdecimal
5
6
  bundler
6
7
  gruff (~> 0.7.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
12
+ bigdecimal (2.0.0)
11
13
  coderay (1.1.2)
12
14
  diff-lcs (1.3)
13
15
  gruff (0.7.0)
@@ -37,6 +39,7 @@ PLATFORMS
37
39
  ruby
38
40
 
39
41
  DEPENDENCIES
42
+ bigdecimal
40
43
  bundler
41
44
  digiproc!
42
45
  gruff
@@ -46,4 +49,4 @@ DEPENDENCIES
46
49
  rspec (~> 3.0)
47
50
 
48
51
  BUNDLED WITH
49
- 2.0.1
52
+ 2.1.2
@@ -1,7 +1,7 @@
1
1
 
2
2
  require "bundler/setup"
3
-
4
- Bundler.require(:default)
3
+ require 'bigdecimal'
4
+ require 'gruff'
5
5
 
6
6
  require 'matrix'
7
7
  require 'ostruct'
@@ -10,7 +10,7 @@ require 'digiproc'
10
10
 
11
11
 
12
12
  #Extensions
13
- require './lib/extensions/core_extensions'
13
+ require_relative '../lib/extensions/core_extensions'
14
14
 
15
15
  Array.include Digiproc::CoreExtensions::ArrayExtension::DotProduct
16
16
  Array.include Digiproc::CoreExtensions::ArrayExtension::Sum
@@ -59,60 +59,60 @@ class Gruff::Base
59
59
  end
60
60
 
61
61
  #Strategies
62
- require './lib/strategies/strategies'
63
- require './lib/strategies/fft/inverse_fft_conjugate_strategy'
64
- require './lib/strategies/fft/brute_force_dft_strategy'
65
- require './lib/strategies/fft/radix2_strategy'
66
- require './lib/strategies/convolution/bf_conv'
67
- require './lib/strategies/window/window'
68
- require './lib/strategies/window/blackman_window'
69
- require './lib/strategies/window/hamming_window'
70
- require './lib/strategies/window/hanning_window'
71
- require './lib/strategies/window/rectangular_window'
72
- require './lib/strategies/companding/custom_companding_strategy'
73
- require './lib/strategies/gaussian/gaussian_generator'
74
- require './lib/strategies/orthogonalize/gram_schmidt'
75
- require './lib/strategies/code/gray_code'
76
- require './lib/strategies/code/differential_encoding_strategy'
77
- require './lib/strategies/code/xor_differential_encoding_strategy'
78
- require './lib/strategies/code/xor_differential_encoding_zero_angle_strategy'
79
- require './lib/strategies/modulation/phase_shift_keying_strategy'
80
- require './lib/strategies/linear_algebra/jacobi_strategy'
81
- require './lib/strategies/linear_algebra/gauss_seidel_strategy'
82
- require './lib/strategies/linear_algebra/sor_strategy'
83
- require './lib/strategies/linear_algebra/sor2_strategy'
62
+ require_relative '../lib/strategies/strategies'
63
+ require_relative '../lib/strategies/fft/inverse_fft_conjugate_strategy'
64
+ require_relative '../lib/strategies/fft/brute_force_dft_strategy'
65
+ require_relative '../lib/strategies/fft/radix2_strategy'
66
+ require_relative '../lib/strategies/convolution/bf_conv'
67
+ require_relative '../lib/strategies/window/window'
68
+ require_relative '../lib/strategies/window/blackman_window'
69
+ require_relative '../lib/strategies/window/hamming_window'
70
+ require_relative '../lib/strategies/window/hanning_window'
71
+ require_relative '../lib/strategies/window/rectangular_window'
72
+ require_relative '../lib/strategies/companding/custom_companding_strategy'
73
+ require_relative '../lib/strategies/gaussian/gaussian_generator'
74
+ require_relative '../lib/strategies/orthogonalize/gram_schmidt'
75
+ require_relative '../lib/strategies/code/gray_code'
76
+ require_relative '../lib/strategies/code/differential_encoding_strategy'
77
+ require_relative '../lib/strategies/code/xor_differential_encoding_strategy'
78
+ require_relative '../lib/strategies/code/xor_differential_encoding_zero_angle_strategy'
79
+ require_relative '../lib/strategies/modulation/phase_shift_keying_strategy'
80
+ require_relative '../lib/strategies/linear_algebra/jacobi_strategy'
81
+ require_relative '../lib/strategies/linear_algebra/gauss_seidel_strategy'
82
+ require_relative '../lib/strategies/linear_algebra/sor_strategy'
83
+ require_relative '../lib/strategies/linear_algebra/sor2_strategy'
84
84
 
85
85
  #Modules
86
- require './lib/concerns/plottable'
87
- require './lib/concerns/requires_data'
88
- require './lib/concerns/initializable'
89
- require './lib/concerns/convolvable'
90
- require './lib/concerns/fourier_transformable'
91
- require './lib/concerns/multipliable'
92
- require './lib/concerns/data_properties'
93
- require './lib/functions'
94
- require './lib/probability/probability'
95
- require './lib/concerns/os'
86
+ require_relative '../lib/concerns/plottable'
87
+ require_relative '../lib/concerns/requires_data'
88
+ require_relative '../lib/concerns/initializable'
89
+ require_relative '../lib/concerns/convolvable'
90
+ require_relative '../lib/concerns/fourier_transformable'
91
+ require_relative '../lib/concerns/multipliable'
92
+ require_relative '../lib/concerns/data_properties'
93
+ require_relative '../lib/functions'
94
+ require_relative '../lib/probability/probability'
95
+ require_relative '../lib/concerns/os'
96
96
 
97
97
 
98
98
 
99
99
  #Classes
100
- require './lib/fft'
101
- require './lib/signals/digital_signal'
102
- require './lib/filters/digital_filter.rb'
103
- require './lib/filters/lowpass_filter.rb'
104
- require './lib/filters/highpass_filter.rb'
105
- require './lib/filters/bandpass_filter.rb'
106
- require './lib/filters/bandstop_filter.rb'
107
- require './lib/signals/analog_signal'
108
- require './lib/probability/gaussian_distribution'
109
- require './lib/probability/theoretical_gaussian_distribution'
110
- require './lib/probability/bit_generator'
111
- require './lib/probability/binomial_distribution'
112
- require './lib/quick_plot'
113
- require './lib/rbplot'
100
+ require_relative '../lib/fft'
101
+ require_relative '../lib/signals/digital_signal'
102
+ require_relative '../lib/filters/digital_filter.rb'
103
+ require_relative '../lib/filters/lowpass_filter.rb'
104
+ require_relative '../lib/filters/highpass_filter.rb'
105
+ require_relative '../lib/filters/bandpass_filter.rb'
106
+ require_relative '../lib/filters/bandstop_filter.rb'
107
+ require_relative '../lib/signals/analog_signal'
108
+ require_relative '../lib/probability/gaussian_distribution'
109
+ require_relative '../lib/probability/theoretical_gaussian_distribution'
110
+ require_relative '../lib/probability/bit_generator'
111
+ require_relative '../lib/probability/binomial_distribution'
112
+ require_relative '../lib/quick_plot'
113
+ require_relative '../lib/rbplot'
114
114
 
115
115
  #Factories
116
- require './lib/factories/factories'
117
- require './lib/factories/window_factory'
118
- require './lib/factories/filter_factory'
116
+ require_relative '../lib/factories/factories'
117
+ require_relative '../lib/factories/window_factory'
118
+ require_relative '../lib/factories/filter_factory'
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.require_paths = ["lib"]
39
39
 
40
40
  spec.add_development_dependency "bundler"
41
+ spec.add_runtime_dependency "bigdecimal"
41
42
  spec.add_development_dependency "rake", "~> 10.0"
42
43
  spec.add_development_dependency "rspec", "~> 3.0"
43
44
  spec.add_development_dependency 'rdoc'
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Digiproc
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
 
6
6
 
@@ -13,9 +13,9 @@ class Digiproc::Probability::TheoreticalBinomialDistribution
13
13
  # k:: [Integer] (optional at initialization) Number of successes
14
14
  # p:: [Numeric] Probability of success
15
15
  def initialize(n: ,k: nil , p: )
16
- @n = n.to_f
17
- @k = k.to_f
18
- @p = p.to_f
16
+ @n = n
17
+ @k = k
18
+ @p = p
19
19
  end
20
20
 
21
21
  ##
@@ -66,17 +66,18 @@ class Digiproc::Probability::TheoreticalBinomialDistribution
66
66
  karr.each do |k_val|
67
67
  sum += self.coefficient(k_val) * ((self.p) ** (k_val)) * (1 - self.p) ** (n - k_val)
68
68
  end
69
- sum
69
+ sum.to_f
70
70
  end
71
71
 
72
72
  ##
73
73
  # Returns the binomial equation coefficient for a given number of wins, ie returns n! / (k! * (n - k)!)
74
74
  # Can take an argument of `k`, which defaults to `self.k`
75
+ # Returns a BigDecimal
75
76
  ## bd.coefficient(4) # => 210.0
76
77
  def coefficient(k = self.k)
77
- n_fact = Digiproc::Functions.fact(self.n)
78
- k_fact = Digiproc::Functions.fact(k)
79
- n_fact / (k_fact.to_f * (Digiproc::Functions.fact(self.n - k)))
78
+ n_fact = BigDecimal(Digiproc::Functions.fact(self.n))
79
+ k_fact = BigDecimal(Digiproc::Functions.fact(k))
80
+ n_fact / (k_fact * BigDecimal((Digiproc::Functions.fact(self.n - k))))
80
81
  end
81
82
 
82
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digiproc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - micahshute
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-10 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bigdecimal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -328,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
342
  - !ruby/object:Gem::Version
329
343
  version: '0'
330
344
  requirements: []
331
- rubygems_version: 3.0.3
345
+ rubygems_version: 3.1.2
332
346
  signing_key:
333
347
  specification_version: 4
334
348
  summary: Perform basic Digital Signal Processing tasks, including convolution, fft,