silicium 0.0.20 → 0.0.21

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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +3 -3
  3. data/.gitignore +13 -13
  4. data/.rakeTasks +8 -0
  5. data/.travis.yml +28 -25
  6. data/CODE_OF_CONDUCT.md +74 -74
  7. data/Gemfile +8 -8
  8. data/LICENSE.txt +21 -21
  9. data/Makefile +269 -269
  10. data/README.md +588 -46
  11. data/Rakefile +16 -16
  12. data/bin/console +14 -14
  13. data/bin/setup +8 -8
  14. data/docs/Object.html +117 -117
  15. data/docs/README_md.html +142 -142
  16. data/docs/Silicium/Combinatorics.html +270 -270
  17. data/docs/Silicium/Dice/Polyhedron.html +315 -315
  18. data/docs/Silicium/Dice/PolyhedronSet.html +321 -321
  19. data/docs/Silicium/Dice.html +99 -99
  20. data/docs/Silicium/Error.html +106 -106
  21. data/docs/Silicium/Geometry/Line2dCanon.html +243 -243
  22. data/docs/Silicium/Geometry/VariablesOrderException.html +106 -106
  23. data/docs/Silicium/Geometry.html +940 -940
  24. data/docs/Silicium/GraphVisualizer.html +226 -0
  25. data/docs/Silicium/Graphs/GraphError.html +106 -106
  26. data/docs/Silicium/Graphs/OrientedGraph.html +901 -775
  27. data/docs/Silicium/Graphs/UnorientedGraph.html +237 -284
  28. data/docs/Silicium/Graphs.html +374 -164
  29. data/docs/Silicium/IntegralDoesntExistError.html +106 -106
  30. data/docs/Silicium/NumericalIntegration.html +521 -521
  31. data/docs/Silicium/Optimization.html +629 -639
  32. data/docs/Silicium/Plotter/Image.html +297 -297
  33. data/docs/Silicium/Plotter.html +186 -186
  34. data/docs/Silicium.html +101 -101
  35. data/docs/created.rid +9 -9
  36. data/docs/css/fonts.css +167 -167
  37. data/docs/css/rdoc.css +619 -619
  38. data/docs/index.html +134 -132
  39. data/docs/js/darkfish.js +84 -84
  40. data/docs/js/navigation.js +105 -105
  41. data/docs/js/search.js +110 -110
  42. data/docs/js/search_index.js +1 -1
  43. data/docs/js/search_index.js.gz +0 -0
  44. data/docs/js/searcher.js +229 -229
  45. data/docs/table_of_contents.html +697 -608
  46. data/lib/algebra.rb +452 -0
  47. data/lib/algebra_diff.rb +258 -0
  48. data/lib/geometry/figure.rb +62 -0
  49. data/lib/geometry.rb +290 -236
  50. data/lib/geometry3d.rb +270 -0
  51. data/lib/graph/dfs.rb +42 -0
  52. data/lib/graph/kruskal.rb +36 -0
  53. data/lib/graph/scc.rb +97 -0
  54. data/lib/graph.rb +350 -164
  55. data/lib/graph_visualizer.rb +287 -0
  56. data/lib/ml_algorithms.rb +181 -0
  57. data/lib/numerical_integration.rb +184 -147
  58. data/lib/optimization.rb +209 -144
  59. data/lib/plotter.rb +256 -96
  60. data/lib/polynomial_division.rb +132 -0
  61. data/lib/polynomial_interpolation.rb +94 -0
  62. data/lib/regression.rb +120 -0
  63. data/lib/silicium/adding.rb +37 -0
  64. data/lib/silicium/conversions.rb +23 -0
  65. data/lib/silicium/multi.rb +82 -0
  66. data/lib/silicium/sparse.rb +76 -0
  67. data/lib/silicium/sugar.rb +37 -0
  68. data/lib/silicium/trans.rb +26 -0
  69. data/lib/silicium/version.rb +3 -3
  70. data/lib/silicium.rb +5 -5
  71. data/lib/theory_of_probability.rb +240 -226
  72. data/lib/topological_sort.rb +50 -0
  73. data/oriented_graph.png +0 -0
  74. data/plot.png +0 -0
  75. data/silicium.gemspec +38 -39
  76. metadata +38 -16
@@ -0,0 +1,50 @@
1
+ require "set"
2
+
3
+ module Silicium
4
+ module Graphs
5
+ class Graph
6
+ attr_accessor :nodes
7
+
8
+ def initialize
9
+ @nodes = []
10
+ end
11
+
12
+ def add_edge(from, to)
13
+ from.adjacents << to
14
+ end
15
+ end
16
+
17
+ class Node
18
+ attr_accessor :name, :adjacents
19
+
20
+ def initialize(name)
21
+ # using Set instead of an Array to avoid duplications
22
+ @adjacents = Set.new
23
+ @name = name
24
+ end
25
+
26
+ def to_s
27
+ @name
28
+ end
29
+ end
30
+
31
+ class TopologicalSortClass
32
+ attr_accessor :post_order
33
+
34
+ def initialize(graph)
35
+ @post_order = []
36
+ @visited = []
37
+
38
+ graph.nodes.each { |node| dfs(node) unless @visited.include?(node)}
39
+ end
40
+
41
+ private
42
+ def dfs(node)
43
+ @visited << node
44
+ node.adjacents.each { |adj_node| dfs(adj_node) unless @visited.include?(adj_node)}
45
+
46
+ @post_order << node
47
+ end
48
+ end
49
+ end
50
+ end
Binary file
data/plot.png ADDED
Binary file
data/silicium.gemspec CHANGED
@@ -1,39 +1,38 @@
1
- lib = File.expand_path("lib", __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "silicium/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "silicium"
7
- spec.version = Silicium::VERSION
8
- spec.authors = ["mmcs-ruby"]
9
- spec.email = ["poganesyan@sfedu.ru"]
10
-
11
- spec.summary = %q{Ruby math library made as exercise by MMCS students .}
12
- spec.description = %q{Long list of applied functions}
13
- # spec.homepage = "TODO: Put your gem's website or public repo URL here."
14
- spec.license = "MIT"
15
-
16
- =begin
17
-
18
- spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
19
-
20
- spec.metadata["homepage_uri"] = spec.homepage
21
-
22
- spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
23
- =end
24
- spec.metadata["source_code_uri"] = 'https://github.com/mmcs-ruby/silicium'
25
- # Specify which files should be added to the gem when it is released.
26
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
- end
30
- spec.bindir = "exe"
31
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
33
-
34
- spec.add_development_dependency "bundler", "~> 2.0"
35
- spec.add_development_dependency "rake", "~> 10.0"
36
- spec.add_development_dependency "minitest", "~> 5.0"
37
- spec.add_development_dependency 'simplecov'
38
-
39
- end
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "silicium/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "silicium"
7
+ spec.version = Silicium::VERSION
8
+ spec.authors = ["mmcs-ruby"]
9
+ spec.email = ["poganesyan@sfedu.ru"]
10
+
11
+ spec.summary = %q{Ruby math library made as exercise by MMCS students .}
12
+ spec.description = %q{Long list of applied functions}
13
+ # spec.homepage = "TODO: Put your gem's website or public repo URL here."
14
+ spec.license = "MIT"
15
+
16
+ =begin
17
+
18
+ spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+
22
+ spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
23
+ =end
24
+ spec.metadata["source_code_uri"] = 'https://github.com/mmcs-ruby/silicium'
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency "bundler", "~> 2.0"
35
+ spec.add_development_dependency "rake", ">= 12.3.3"
36
+ spec.add_development_dependency "minitest", "~> 5.0"
37
+ spec.add_development_dependency 'simplecov', "0.17"
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silicium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmcs-ruby
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2021-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.17'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.17'
69
69
  description: Long list of applied functions
70
70
  email:
71
71
  - poganesyan@sfedu.ru
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".codeclimate.yml"
77
77
  - ".gitignore"
78
+ - ".rakeTasks"
78
79
  - ".travis.yml"
79
80
  - CODE_OF_CONDUCT.md
80
81
  - Gemfile
@@ -95,6 +96,7 @@ files:
95
96
  - docs/Silicium/Geometry.html
96
97
  - docs/Silicium/Geometry/Line2dCanon.html
97
98
  - docs/Silicium/Geometry/VariablesOrderException.html
99
+ - docs/Silicium/GraphVisualizer.html
98
100
  - docs/Silicium/Graphs.html
99
101
  - docs/Silicium/Graphs/GraphError.html
100
102
  - docs/Silicium/Graphs/OrientedGraph.html
@@ -148,21 +150,42 @@ files:
148
150
  - docs/js/searcher.js
149
151
  - docs/js/searcher.js.gz
150
152
  - docs/table_of_contents.html
153
+ - lib/algebra.rb
154
+ - lib/algebra_diff.rb
151
155
  - lib/geometry.rb
156
+ - lib/geometry/figure.rb
157
+ - lib/geometry3d.rb
152
158
  - lib/graph.rb
159
+ - lib/graph/dfs.rb
160
+ - lib/graph/kruskal.rb
161
+ - lib/graph/scc.rb
162
+ - lib/graph_visualizer.rb
163
+ - lib/ml_algorithms.rb
153
164
  - lib/numerical_integration.rb
154
165
  - lib/optimization.rb
155
166
  - lib/plotter.rb
167
+ - lib/polynomial_division.rb
168
+ - lib/polynomial_interpolation.rb
169
+ - lib/regression.rb
156
170
  - lib/silicium.rb
171
+ - lib/silicium/adding.rb
172
+ - lib/silicium/conversions.rb
173
+ - lib/silicium/multi.rb
174
+ - lib/silicium/sparse.rb
175
+ - lib/silicium/sugar.rb
176
+ - lib/silicium/trans.rb
157
177
  - lib/silicium/version.rb
158
178
  - lib/theory_of_probability.rb
179
+ - lib/topological_sort.rb
180
+ - oriented_graph.png
181
+ - plot.png
159
182
  - silicium.gemspec
160
- homepage:
183
+ homepage:
161
184
  licenses:
162
185
  - MIT
163
186
  metadata:
164
187
  source_code_uri: https://github.com/mmcs-ruby/silicium
165
- post_install_message:
188
+ post_install_message:
166
189
  rdoc_options: []
167
190
  require_paths:
168
191
  - lib
@@ -177,9 +200,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
200
  - !ruby/object:Gem::Version
178
201
  version: '0'
179
202
  requirements: []
180
- rubyforge_project:
181
- rubygems_version: 2.7.7
182
- signing_key:
203
+ rubygems_version: 3.1.4
204
+ signing_key:
183
205
  specification_version: 4
184
206
  summary: Ruby math library made as exercise by MMCS students .
185
207
  test_files: []