silicium 0.0.2 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +3 -3
- data/.gitignore +13 -13
- data/.rakeTasks +8 -0
- data/.travis.yml +28 -25
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +8 -8
- data/LICENSE.txt +21 -21
- data/Makefile +269 -269
- data/README.md +588 -46
- data/Rakefile +16 -16
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/docs/Object.html +117 -117
- data/docs/README_md.html +142 -142
- data/docs/Silicium/Combinatorics.html +270 -270
- data/docs/Silicium/Dice/Polyhedron.html +315 -315
- data/docs/Silicium/Dice/PolyhedronSet.html +321 -321
- data/docs/Silicium/Dice.html +99 -99
- data/docs/Silicium/Error.html +106 -106
- data/docs/Silicium/Geometry/Line2dCanon.html +243 -243
- data/docs/Silicium/Geometry/VariablesOrderException.html +106 -106
- data/docs/Silicium/Geometry.html +940 -940
- data/docs/Silicium/GraphVisualizer.html +226 -0
- data/docs/Silicium/Graphs/GraphError.html +106 -106
- data/docs/Silicium/Graphs/OrientedGraph.html +901 -775
- data/docs/Silicium/Graphs/UnorientedGraph.html +237 -284
- data/docs/Silicium/Graphs.html +374 -164
- data/docs/Silicium/IntegralDoesntExistError.html +106 -106
- data/docs/Silicium/NumericalIntegration.html +521 -521
- data/docs/Silicium/Optimization.html +629 -639
- data/docs/Silicium/Plotter/Image.html +297 -297
- data/docs/Silicium/Plotter.html +186 -186
- data/docs/Silicium.html +101 -101
- data/docs/created.rid +9 -9
- data/docs/css/fonts.css +167 -167
- data/docs/css/rdoc.css +619 -619
- data/docs/index.html +134 -132
- data/docs/js/darkfish.js +84 -84
- data/docs/js/navigation.js +105 -105
- data/docs/js/search.js +110 -110
- data/docs/js/search_index.js +1 -1
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -229
- data/docs/table_of_contents.html +697 -608
- data/lib/algebra.rb +452 -0
- data/lib/algebra_diff.rb +258 -0
- data/lib/geometry/figure.rb +62 -0
- data/lib/geometry.rb +290 -236
- data/lib/geometry3d.rb +270 -0
- data/lib/graph/dfs.rb +42 -0
- data/lib/graph/kruskal.rb +36 -0
- data/lib/graph/scc.rb +97 -0
- data/lib/graph.rb +350 -164
- data/lib/graph_visualizer.rb +287 -0
- data/lib/ml_algorithms.rb +181 -0
- data/lib/numerical_integration.rb +184 -147
- data/lib/optimization.rb +209 -144
- data/lib/plotter.rb +256 -96
- data/lib/polynomial_division.rb +132 -0
- data/lib/polynomial_interpolation.rb +94 -0
- data/lib/regression.rb +120 -0
- data/lib/silicium/adding.rb +37 -0
- data/lib/silicium/conversions.rb +23 -0
- data/lib/silicium/multi.rb +82 -0
- data/lib/silicium/sparse.rb +76 -0
- data/lib/silicium/sugar.rb +37 -0
- data/lib/silicium/trans.rb +26 -0
- data/lib/silicium/version.rb +3 -3
- data/lib/silicium.rb +5 -5
- data/lib/theory_of_probability.rb +240 -226
- data/lib/topological_sort.rb +50 -0
- data/oriented_graph.png +0 -0
- data/plot.png +0 -0
- data/silicium.gemspec +38 -39
- 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
|
data/oriented_graph.png
ADDED
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", "
|
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.
|
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:
|
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:
|
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:
|
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
|
-
|
181
|
-
|
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: []
|