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
data/docs/js/search.js CHANGED
@@ -1,110 +1,110 @@
1
- Search = function(data, input, result) {
2
- this.data = data;
3
- this.input = input;
4
- this.result = result;
5
-
6
- this.current = null;
7
- this.view = this.result.parentNode;
8
- this.searcher = new Searcher(data.index);
9
- this.init();
10
- }
11
-
12
- Search.prototype = Object.assign({}, Navigation, new function() {
13
- var suid = 1;
14
-
15
- this.init = function() {
16
- var _this = this;
17
- var observer = function(e) {
18
- switch(e.keyCode) {
19
- case 38: // Event.KEY_UP
20
- case 40: // Event.KEY_DOWN
21
- return;
22
- }
23
- _this.search(_this.input.value);
24
- };
25
- this.input.addEventListener('keyup', observer);
26
- this.input.addEventListener('click', observer); // mac's clear field
27
-
28
- this.searcher.ready(function(results, isLast) {
29
- _this.addResults(results, isLast);
30
- })
31
-
32
- this.initNavigation();
33
- this.setNavigationActive(false);
34
- }
35
-
36
- this.search = function(value, selectFirstMatch) {
37
- value = value.trim().toLowerCase();
38
- if (value) {
39
- this.setNavigationActive(true);
40
- } else {
41
- this.setNavigationActive(false);
42
- }
43
-
44
- if (value == '') {
45
- this.lastQuery = value;
46
- this.result.innerHTML = '';
47
- this.result.setAttribute('aria-expanded', 'false');
48
- this.setNavigationActive(false);
49
- } else if (value != this.lastQuery) {
50
- this.lastQuery = value;
51
- this.result.setAttribute('aria-busy', 'true');
52
- this.result.setAttribute('aria-expanded', 'true');
53
- this.firstRun = true;
54
- this.searcher.find(value);
55
- }
56
- }
57
-
58
- this.addResults = function(results, isLast) {
59
- var target = this.result;
60
- if (this.firstRun && (results.length > 0 || isLast)) {
61
- this.current = null;
62
- this.result.innerHTML = '';
63
- }
64
-
65
- for (var i=0, l = results.length; i < l; i++) {
66
- var item = this.renderItem.call(this, results[i]);
67
- item.setAttribute('id', 'search-result-' + target.childElementCount);
68
- target.appendChild(item);
69
- };
70
-
71
- if (this.firstRun && results.length > 0) {
72
- this.firstRun = false;
73
- this.current = target.firstChild;
74
- this.current.classList.add('search-selected');
75
- }
76
- //TODO: ECMAScript
77
- //if (jQuery.browser.msie) this.$element[0].className += '';
78
-
79
- if (isLast) this.result.setAttribute('aria-busy', 'false');
80
- }
81
-
82
- this.move = function(isDown) {
83
- if (!this.current) return;
84
- var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
85
- if (next) {
86
- this.current.classList.remove('search-selected');
87
- next.classList.add('search-selected');
88
- this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
89
- this.scrollIntoView(next, this.view);
90
- this.current = next;
91
- this.input.value = next.firstChild.firstChild.text;
92
- this.input.select();
93
- }
94
- return true;
95
- }
96
-
97
- this.hlt = function(html) {
98
- return this.escapeHTML(html).
99
- replace(/\u0001/g, '<em>').
100
- replace(/\u0002/g, '</em>');
101
- }
102
-
103
- this.escapeHTML = function(html) {
104
- return html.replace(/[&<>]/g, function(c) {
105
- return '&#' + c.charCodeAt(0) + ';';
106
- });
107
- }
108
-
109
- });
110
-
1
+ Search = function(data, input, result) {
2
+ this.data = data;
3
+ this.input = input;
4
+ this.result = result;
5
+
6
+ this.current = null;
7
+ this.view = this.result.parentNode;
8
+ this.searcher = new Searcher(data.index);
9
+ this.init();
10
+ }
11
+
12
+ Search.prototype = Object.assign({}, Navigation, new function() {
13
+ var suid = 1;
14
+
15
+ this.init = function() {
16
+ var _this = this;
17
+ var observer = function(e) {
18
+ switch(e.keyCode) {
19
+ case 38: // Event.KEY_UP
20
+ case 40: // Event.KEY_DOWN
21
+ return;
22
+ }
23
+ _this.search(_this.input.value);
24
+ };
25
+ this.input.addEventListener('keyup', observer);
26
+ this.input.addEventListener('click', observer); // mac's clear field
27
+
28
+ this.searcher.ready(function(results, isLast) {
29
+ _this.addResults(results, isLast);
30
+ })
31
+
32
+ this.initNavigation();
33
+ this.setNavigationActive(false);
34
+ }
35
+
36
+ this.search = function(value, selectFirstMatch) {
37
+ value = value.trim().toLowerCase();
38
+ if (value) {
39
+ this.setNavigationActive(true);
40
+ } else {
41
+ this.setNavigationActive(false);
42
+ }
43
+
44
+ if (value == '') {
45
+ this.lastQuery = value;
46
+ this.result.innerHTML = '';
47
+ this.result.setAttribute('aria-expanded', 'false');
48
+ this.setNavigationActive(false);
49
+ } else if (value != this.lastQuery) {
50
+ this.lastQuery = value;
51
+ this.result.setAttribute('aria-busy', 'true');
52
+ this.result.setAttribute('aria-expanded', 'true');
53
+ this.firstRun = true;
54
+ this.searcher.find(value);
55
+ }
56
+ }
57
+
58
+ this.addResults = function(results, isLast) {
59
+ var target = this.result;
60
+ if (this.firstRun && (results.length > 0 || isLast)) {
61
+ this.current = null;
62
+ this.result.innerHTML = '';
63
+ }
64
+
65
+ for (var i=0, l = results.length; i < l; i++) {
66
+ var item = this.renderItem.call(this, results[i]);
67
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
68
+ target.appendChild(item);
69
+ };
70
+
71
+ if (this.firstRun && results.length > 0) {
72
+ this.firstRun = false;
73
+ this.current = target.firstChild;
74
+ this.current.classList.add('search-selected');
75
+ }
76
+ //TODO: ECMAScript
77
+ //if (jQuery.browser.msie) this.$element[0].className += '';
78
+
79
+ if (isLast) this.result.setAttribute('aria-busy', 'false');
80
+ }
81
+
82
+ this.move = function(isDown) {
83
+ if (!this.current) return;
84
+ var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
85
+ if (next) {
86
+ this.current.classList.remove('search-selected');
87
+ next.classList.add('search-selected');
88
+ this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
89
+ this.scrollIntoView(next, this.view);
90
+ this.current = next;
91
+ this.input.value = next.firstChild.firstChild.text;
92
+ this.input.select();
93
+ }
94
+ return true;
95
+ }
96
+
97
+ this.hlt = function(html) {
98
+ return this.escapeHTML(html).
99
+ replace(/\u0001/g, '<em>').
100
+ replace(/\u0002/g, '</em>');
101
+ }
102
+
103
+ this.escapeHTML = function(html) {
104
+ return html.replace(/[&<>]/g, function(c) {
105
+ return '&#' + c.charCodeAt(0) + ';';
106
+ });
107
+ }
108
+
109
+ });
110
+
@@ -1 +1 @@
1
- var search_data = {"index":{"searchIndex":["object","silicium","combinatorics","dice","polyhedron","polyhedronset","error","geometry","line2dcanon","variablesorderexception","graphs","grapherror","orientedgraph","unorientedgraph","integraldoesntexisterror","numericalintegration","optimization","plotter","image","accuracy()","add_edge!()","add_edge!()","add_edge_force!()","add_vertex!()","adjacted_with()","arrangement()","bar_chart()","bogosort()","bogosort!()","clockwise()","color()","combination()","counter_clockwise()","csides()","cut_by_eq()","delete_edge!()","delete_edge!()","delete_vertex!()","dijkstra_algorythm()","directing_vector3d()","distance_point_line2d()","distance_point_line_equation2d()","distance_point_to_point2d()","distance_point_to_point3d()","edge_label_number()","edge_number()","edge_number()","export()","fact()","factorial()","get_edge_label()","get_vertex_label()","half_division()","half_division_step()","has_edge?()","has_vertex?()","height_point_3d()","hook_jeeves()","hook_jeeves_step()","insert_eq()","integrating_monte_carlo_base()","label_edge!()","label_edge!()","label_vertex!()","left_rect_integration()","left_rect_integration_n()","make_graph_by_plotter()","middle()","middle_rectangles()","middle_rectangles_with_a_segment()","minimal_convex_hull_2d()","needed_variables_order?()","new()","new()","new()","new()","new()","not_polygon?()","oriented_area()","percentage()","point_is_on_line?()","point_to_line_distance_3d()","process_cf()","process_free_member()","process_line_by_coordinates()","put_point_in_part()","re_lu()","rectangle()","sides()","sigmoid()","simpson_integration()","simpson_integration_with_a_segment()","sorted?()","switch_step()","three_eights_integration()","three_eights_integration_n()","throw()","throw()","to_s()","to_s()","trapezoid()","trapezoid_with_a_segment()","vector_length()","vectors_product()","vertex_label_number()","vertex_number()","readme"],"longSearchIndex":["object","silicium","silicium::combinatorics","silicium::dice","silicium::dice::polyhedron","silicium::dice::polyhedronset","silicium::error","silicium::geometry","silicium::geometry::line2dcanon","silicium::geometry::variablesorderexception","silicium::graphs","silicium::graphs::grapherror","silicium::graphs::orientedgraph","silicium::graphs::unorientedgraph","silicium::integraldoesntexisterror","silicium::numericalintegration","silicium::optimization","silicium::plotter","silicium::plotter::image","silicium::optimization#accuracy()","silicium::graphs::orientedgraph#add_edge!()","silicium::graphs::unorientedgraph#add_edge!()","silicium::graphs::orientedgraph#add_edge_force!()","silicium::graphs::orientedgraph#add_vertex!()","silicium::graphs::orientedgraph#adjacted_with()","silicium::combinatorics#arrangement()","silicium::plotter::image#bar_chart()","silicium::optimization#bogosort()","silicium::optimization#bogosort!()","silicium::geometry#clockwise()","silicium::plotter#color()","silicium::combinatorics#combination()","silicium::geometry#counter_clockwise()","silicium::dice::polyhedron#csides()","silicium::geometry#cut_by_eq()","silicium::graphs::orientedgraph#delete_edge!()","silicium::graphs::unorientedgraph#delete_edge!()","silicium::graphs::orientedgraph#delete_vertex!()","silicium::graphs#dijkstra_algorythm()","silicium::geometry#directing_vector3d()","silicium::geometry#distance_point_line2d()","silicium::geometry#distance_point_line_equation2d()","silicium::geometry#distance_point_to_point2d()","silicium::geometry#distance_point_to_point3d()","silicium::graphs::orientedgraph#edge_label_number()","silicium::graphs::orientedgraph#edge_number()","silicium::graphs::unorientedgraph#edge_number()","silicium::plotter::image#export()","silicium::combinatorics#fact()","silicium::combinatorics#factorial()","silicium::graphs::orientedgraph#get_edge_label()","silicium::graphs::orientedgraph#get_vertex_label()","silicium::optimization#half_division()","silicium::optimization#half_division_step()","silicium::graphs::orientedgraph#has_edge?()","silicium::graphs::orientedgraph#has_vertex?()","silicium::geometry#height_point_3d()","silicium::optimization#hook_jeeves()","silicium::optimization#hook_jeeves_step()","silicium::geometry#insert_eq()","silicium::optimization#integrating_monte_carlo_base()","silicium::graphs::orientedgraph#label_edge!()","silicium::graphs::unorientedgraph#label_edge!()","silicium::graphs::orientedgraph#label_vertex!()","silicium::numericalintegration::left_rect_integration()","silicium::numericalintegration::left_rect_integration_n()","silicium::dice::polyhedronset#make_graph_by_plotter()","silicium::optimization#middle()","silicium::numericalintegration::middle_rectangles()","silicium::numericalintegration::middle_rectangles_with_a_segment()","silicium::geometry#minimal_convex_hull_2d()","silicium::geometry#needed_variables_order?()","silicium::dice::polyhedron::new()","silicium::dice::polyhedronset::new()","silicium::geometry::line2dcanon::new()","silicium::graphs::orientedgraph::new()","silicium::plotter::image::new()","silicium::geometry#not_polygon?()","silicium::geometry#oriented_area()","silicium::dice::polyhedronset#percentage()","silicium::geometry::line2dcanon#point_is_on_line?()","silicium::geometry#point_to_line_distance_3d()","silicium::geometry#process_cf()","silicium::geometry#process_free_member()","silicium::geometry#process_line_by_coordinates()","silicium::geometry#put_point_in_part()","silicium::optimization#re_lu()","silicium::plotter::image#rectangle()","silicium::dice::polyhedron#sides()","silicium::optimization#sigmoid()","silicium::numericalintegration::simpson_integration()","silicium::numericalintegration::simpson_integration_with_a_segment()","silicium::optimization#sorted?()","silicium::optimization#switch_step()","silicium::numericalintegration::three_eights_integration()","silicium::numericalintegration::three_eights_integration_n()","silicium::dice::polyhedron#throw()","silicium::dice::polyhedronset#throw()","silicium::dice::polyhedron#to_s()","silicium::dice::polyhedronset#to_s()","silicium::numericalintegration::trapezoid()","silicium::numericalintegration::trapezoid_with_a_segment()","silicium::geometry#vector_length()","silicium::geometry#vectors_product()","silicium::graphs::orientedgraph#vertex_label_number()","silicium::graphs::orientedgraph#vertex_number()",""],"info":[["Object","","Object.html","",""],["Silicium","","Silicium.html","","<p>require &#39;set&#39; require &#39;silicium&#39;\n"],["Silicium::Combinatorics","","Silicium/Combinatorics.html","",""],["Silicium::Dice","","Silicium/Dice.html","",""],["Silicium::Dice::Polyhedron","","Silicium/Dice/Polyhedron.html","","<p>Class represents a polyhedron csides - number or sides sides - array of sides(unusual for custom polyhedrons) …\n"],["Silicium::Dice::PolyhedronSet","","Silicium/Dice/PolyhedronSet.html","","<p>Class represents a PolyhedronsSet percentage - hash with chances of getting definite score\n"],["Silicium::Error","","Silicium/Error.html","",""],["Silicium::Geometry","","Silicium/Geometry.html","",""],["Silicium::Geometry::Line2dCanon","","Silicium/Geometry/Line2dCanon.html","","<p>Class represents a line as equation y = k*x +b k - slope b - free_term in two-dimensional space\n"],["Silicium::Geometry::VariablesOrderException","","Silicium/Geometry/VariablesOrderException.html","",""],["Silicium::Graphs","","Silicium/Graphs.html","",""],["Silicium::Graphs::GraphError","","Silicium/Graphs/GraphError.html","",""],["Silicium::Graphs::OrientedGraph","","Silicium/Graphs/OrientedGraph.html","",""],["Silicium::Graphs::UnorientedGraph","","Silicium/Graphs/UnorientedGraph.html","",""],["Silicium::IntegralDoesntExistError","","Silicium/IntegralDoesntExistError.html","",""],["Silicium::NumericalIntegration","","Silicium/NumericalIntegration.html","","<p>A class providing numerical integration methods\n"],["Silicium::Optimization","","Silicium/Optimization.html","",""],["Silicium::Plotter","","Silicium/Plotter.html","",""],["Silicium::Plotter::Image","","Silicium/Plotter/Image.html","","<p>A class representing canvas for plotting bar charts and function graphs\n"],["accuracy","Silicium::Optimization","Silicium/Optimization.html#method-i-accuracy","(step)","<p>calculate current accuracy in Hook - Jeeves method\n"],["add_edge!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-add_edge-21","(from, to)",""],["add_edge!","Silicium::Graphs::UnorientedGraph","Silicium/Graphs/UnorientedGraph.html#method-i-add_edge-21","(from, to)",""],["add_edge_force!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-add_edge_force-21","(from, to)","<p>should only be used in constructor\n"],["add_vertex!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-add_vertex-21","(vertex_id)",""],["adjacted_with","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-adjacted_with","(vertex)",""],["arrangement","Silicium::Combinatorics","Silicium/Combinatorics.html#method-i-arrangement","(n, k)","<p>Function A(n,k)\n"],["bar_chart","Silicium::Plotter::Image","Silicium/Plotter/Image.html#method-i-bar_chart","(bars, bar_width, bars_color = ChunkyPNG::Color('red @ 1.0'), axis_color = ChunkyPNG::Color::BLACK)","<p>Draws a bar chart in the plot using provided <code>bars</code>, each of them has width of <code>bar_width</code> and colored <code>bars_color</code> …\n"],["bogosort","Silicium::Optimization","Silicium/Optimization.html#method-i-bogosort","(a)","<p>fastest(but it is not exactly) sort\n"],["bogosort!","Silicium::Optimization","Silicium/Optimization.html#method-i-bogosort-21","(a)","<p>fastest(but it is not exactly) sort, modify sequance\n"],["clockwise","Silicium::Geometry","Silicium/Geometry.html#method-i-clockwise","(a, b, c)","<p>Determines if a clockwise crawl is performed for defined order of points\n"],["color","Silicium::Plotter","Silicium/Plotter.html#method-i-color","(*args)","<p>Factory method to return a color value, based on the arguments given.\n<p>@overload Color(r, g, b, a)\n\n<pre class=\"ruby\"><span class=\"ruby-ivar\">@param</span> <span class=\"ruby-operator\">...</span>\n</pre>\n"],["combination","Silicium::Combinatorics","Silicium/Combinatorics.html#method-i-combination","(n, k)","<p>Function C(n,k)\n"],["counter_clockwise","Silicium::Geometry","Silicium/Geometry.html#method-i-counter_clockwise","(a, b, c)","<p>Determines if a counter-clockwise crawl is performed for defined order of points\n"],["csides","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-i-csides","()",""],["cut_by_eq","Silicium::Geometry","Silicium/Geometry.html#method-i-cut_by_eq","(line_equation)",""],["delete_edge!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-delete_edge-21","(from, to)",""],["delete_edge!","Silicium::Graphs::UnorientedGraph","Silicium/Graphs/UnorientedGraph.html#method-i-delete_edge-21","(from, to)",""],["delete_vertex!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-delete_vertex-21","(vertex)",""],["dijkstra_algorythm","Silicium::Graphs","Silicium/Graphs.html#method-i-dijkstra_algorythm","(graph, starting_vertex)",""],["directing_vector3d","Silicium::Geometry","Silicium/Geometry.html#method-i-directing_vector3d","(line_equation)","<p>Creates an array- directing vector in three-dimensional space . The equation is specified in the canonical …\n"],["distance_point_line2d","Silicium::Geometry","Silicium/Geometry.html#method-i-distance_point_line2d","(p1, p2, a)","<p>The distance from a point to a line on a plane The line is defined by two points en.wikipedia.org/wiki/Distance_from_a_point_to_a_line …\n"],["distance_point_line_equation2d","Silicium::Geometry","Silicium/Geometry.html#method-i-distance_point_line_equation2d","(a, b, c, p)","<p>The distance from a point to a line on a plane Line defined by an equation return 0 if the equation does …\n"],["distance_point_to_point2d","Silicium::Geometry","Silicium/Geometry.html#method-i-distance_point_to_point2d","(a, b)","<p>Calculates the distance from given points in two-dimensional space\n"],["distance_point_to_point3d","Silicium::Geometry","Silicium/Geometry.html#method-i-distance_point_to_point3d","(a, b)","<p>Calculates the distance from given points in three-dimensional space\n"],["edge_label_number","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-edge_label_number","()",""],["edge_number","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-edge_number","()",""],["edge_number","Silicium::Graphs::UnorientedGraph","Silicium/Graphs/UnorientedGraph.html#method-i-edge_number","()",""],["export","Silicium::Plotter::Image","Silicium/Plotter/Image.html#method-i-export","(filename)","<p>Exports plotted image to file <code>filename</code>\n"],["fact","Silicium::Combinatorics","Silicium/Combinatorics.html#method-i-fact","(n, k)","<p>Factorial for counting 3 parameters in one run\n"],["factorial","Silicium::Combinatorics","Silicium/Combinatorics.html#method-i-factorial","(n)",""],["get_edge_label","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-get_edge_label","(from, to)",""],["get_vertex_label","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-get_vertex_label","(vertex)",""],["half_division","Silicium::Optimization","Silicium/Optimization.html#method-i-half_division","(a, b, eps = 0.001, &block)","<p>find root in [a, b], if he exist, if number of iterations &gt; iters -&gt; error\n"],["half_division_step","Silicium::Optimization","Silicium/Optimization.html#method-i-half_division_step","(a, b, c, &block)","<p>do one half division step\n"],["has_edge?","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-has_edge-3F","(from, to)",""],["has_vertex?","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-has_vertex-3F","(vertex)",""],["height_point_3d","Silicium::Geometry","Silicium/Geometry.html#method-i-height_point_3d","(line_equation)","<p>Creates an array of coordinates of the point ([x, y, z] on the line given by the equation in the canonical …\n"],["hook_jeeves","Silicium::Optimization","Silicium/Optimization.html#method-i-hook_jeeves","(x, step, eps = 0.1, &block)","<p>Hook - Jeeves method for find minimum point (x - array of start variables, step - step of one iteration, …\n"],["hook_jeeves_step","Silicium::Optimization","Silicium/Optimization.html#method-i-hook_jeeves_step","(x, i, step, &block)","<p>do one Hook - Jeeves step\n"],["insert_eq","Silicium::Geometry","Silicium/Geometry.html#method-i-insert_eq","(line_equation)",""],["integrating_Monte_Carlo_base","Silicium::Optimization","Silicium/Optimization.html#method-i-integrating_Monte_Carlo_base","(a, b, n = 100000, &block)","<p>integrating using method Monte Carlo (f - function, a, b - integrating limits, n - amount of random numbers) …\n"],["label_edge!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-label_edge-21","(from, to, label)",""],["label_edge!","Silicium::Graphs::UnorientedGraph","Silicium/Graphs/UnorientedGraph.html#method-i-label_edge-21","(from, to, label)",""],["label_vertex!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-label_vertex-21","(vertex, label)",""],["left_rect_integration","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-left_rect_integration","(left_p, right_p, eps = 0.0001, &block)","<p>Left Rectangle Method and Right Rectangle Method\n"],["left_rect_integration_n","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-left_rect_integration_n","(left_p, right_p, splits, &block)","<p>Left Rectangle Auxiliary Method and Right Rectangle Auxiliary Method\n"],["make_graph_by_plotter","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-i-make_graph_by_plotter","(x = percentage.size * 10, y = percentage.size * 10)","<p>creating a graph representing chances of getting points\n"],["middle","Silicium::Optimization","Silicium/Optimization.html#method-i-middle","(a, b)","<p>find centr of interval\n"],["middle_rectangles","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-middle_rectangles","(a, b, eps = 0.0001, &block)","<p>Middle Rectangles Method with specified accuracy\n"],["middle_rectangles_with_a_segment","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-middle_rectangles_with_a_segment","(a, b, n, &block)","<p>Middle Rectangles Method with a segment\n"],["minimal_convex_hull_2d","Silicium::Geometry","Silicium/Geometry.html#method-i-minimal_convex_hull_2d","(points)","<p>Returns an array containing points that are included in the minimal convex hull for a given array of …\n"],["needed_variables_order?","Silicium::Geometry","Silicium/Geometry.html#method-i-needed_variables_order-3F","(before, after)",""],["new","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-c-new","(sides)","<p>initializing polyhedron&#39;s variables there are two ways how to create it 1: by number (6) - creates …\n"],["new","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-c-new","(arr)",""],["new","Silicium::Geometry::Line2dCanon","Silicium/Geometry/Line2dCanon.html#method-c-new","(p1, p2)",""],["new","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-c-new","(initializer = [])",""],["new","Silicium::Plotter::Image","Silicium/Plotter/Image.html#method-c-new","(width, height, bg_color = ChunkyPNG::Color::TRANSPARENT)","<p>Creates a new plot with chosen <code>width</code> and <code>height</code> parameters with background colored <code>bg_color</code>\n"],["not_polygon?","Silicium::Geometry","Silicium/Geometry.html#method-i-not_polygon-3F","(points)",""],["oriented_area","Silicium::Geometry","Silicium/Geometry.html#method-i-oriented_area","(a, b, c)",""],["percentage","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-i-percentage","()",""],["point_is_on_line?","Silicium::Geometry::Line2dCanon","Silicium/Geometry/Line2dCanon.html#method-i-point_is_on_line-3F","(p1)","<p>Checks the point lies on the line or not\n"],["point_to_line_distance_3d","Silicium::Geometry","Silicium/Geometry.html#method-i-point_to_line_distance_3d","(point, line_eq)","<p>Calculates the distance from a point given by a Point3d structure to a straight line given by a canonical …\n"],["process_cf","Silicium::Geometry","Silicium/Geometry.html#method-i-process_cf","(line_equation, variable)",""],["process_free_member","Silicium::Geometry","Silicium/Geometry.html#method-i-process_free_member","(line_equation, variable)",""],["process_line_by_coordinates","Silicium::Geometry","Silicium/Geometry.html#method-i-process_line_by_coordinates","(line_equation, func)",""],["put_point_in_part","Silicium::Geometry","Silicium/Geometry.html#method-i-put_point_in_part","(part, point, direction)",""],["re_lu","Silicium::Optimization","Silicium/Optimization.html#method-i-re_lu","(x)","<p>reflector function\n"],["rectangle","Silicium::Plotter::Image","Silicium/Plotter/Image.html#method-i-rectangle","(x, y, width, height, color)",""],["sides","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-i-sides","()",""],["sigmoid","Silicium::Optimization","Silicium/Optimization.html#method-i-sigmoid","(x)","<p>sigmoid function\n"],["simpson_integration","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-simpson_integration","(a, b, eps = 0.0001, &block)","<p>Simpson integration with specified accuracy\n"],["simpson_integration_with_a_segment","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-simpson_integration_with_a_segment","(a, b, n, &block)","<p>Simpson integration with a segment\n"],["sorted?","Silicium::Optimization","Silicium/Optimization.html#method-i-sorted-3F","(a)","<p>return true if array is sorted\n"],["switch_step","Silicium::Optimization","Silicium/Optimization.html#method-i-switch_step","(cur_f, prev_f, step, i)","<p>switch step if current func value &gt; previous func value\n"],["three_eights_integration","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-three_eights_integration","(a, b, eps = 0.0001, &block)","<p>Computes integral from <code>a</code> to <code>b</code> of <code>block</code> with accuracy <code>eps</code>\n"],["three_eights_integration_n","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-three_eights_integration_n","(a, b, n, &block)","<p>Computes integral from <code>a</code> to <code>b</code> of <code>block</code> with <code>n</code> segmentations\n"],["throw","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-i-throw","()","<p>ability to throw a polyhedron\n"],["throw","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-i-throw","()","<p>ability to throw a polyhedron&#39;s set using hash of chances\n"],["to_s","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-i-to_s","()",""],["to_s","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-i-to_s","()","<p>returns array of polyhedrons\n"],["trapezoid","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-trapezoid","(a, b, eps = 0.0001, &block)","<p>Trapezoid Method with specified accuracy\n"],["trapezoid_with_a_segment","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-trapezoid_with_a_segment","(a, b, n, &block)","<p>Trapezoid Method with a segment\n"],["vector_length","Silicium::Geometry","Silicium/Geometry.html#method-i-vector_length","(vector)",""],["vectors_product","Silicium::Geometry","Silicium/Geometry.html#method-i-vectors_product","(v1, v2)",""],["vertex_label_number","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-vertex_label_number","()",""],["vertex_number","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-vertex_number","()",""],["README","","README_md.html","","<p><img src=\"https://travis-ci.org/mmcs-ruby/silicium.svg?branch=master\">\n<img src=\"https://api.codeclimate.com/v1/badges/b0ec4b3029f90d4273a1/maintainability\"> ...\n"]]}}
1
+ var search_data = {"index":{"searchIndex":["object","silicium","combinatorics","dice","polyhedron","polyhedronset","error","geometry","line2dcanon","variablesorderexception","graphs","grapherror","orientedgraph","unorientedgraph","integraldoesntexisterror","numericalintegration","optimization","plotter","image","accuracy()","add_edge!()","add_edge!()","add_to_queue()","add_vertex!()","adjacted_with()","arrangement()","bar_chart()","bogosort()","bogosort!()","breadth_first_search?()","clockwise()","color()","combination()","connected?()","counter_clockwise()","csides()","cut_by_eq()","delete_edge!()","delete_edge!()","delete_vertex!()","dfu()","dijkstra_algorythm()","directing_vector3d()","distance_point_line2d()","distance_point_line_equation2d()","distance_point_to_point2d()","distance_point_to_point3d()","edge_label_number()","edge_number()","export()","fact()","factorial()","get_edge_label()","get_vertex_label()","half_division()","half_division_step()","has_edge?()","has_vertex?()","height_point_3d()","hook_jeeves()","hook_jeeves_step()","insert_eq()","integrating_monte_carlo_base()","label_edge!()","label_edge!()","label_vertex!()","left_rect_integration()","left_rect_integration_n()","make_graph_by_plotter()","middle()","middle_rectangles()","middle_rectangles_with_a_segment()","minimal_convex_hull_2d()","needed_variables_order?()","new()","new()","new()","new()","new()","not_polygon?()","number_of_connected()","oriented_area()","percentage()","point_is_on_line?()","point_to_line_distance_3d()","process_cf()","process_free_member()","process_line_by_coordinates()","protected_add_edge!()","protected_delete_edge!()","put_point_in_part()","re_lu()","rectangle()","reverse!()","sides()","sigmoid()","simpson_integration()","simpson_integration_with_a_segment()","sorted?()","switch_step()","three_eights_integration()","three_eights_integration_n()","throw()","throw()","to_s()","to_s()","trapezoid()","trapezoid_with_a_segment()","vector_length()","vectors_product()","vertex_label_number()","vertex_number()","vertices()","readme"],"longSearchIndex":["object","silicium","silicium::combinatorics","silicium::dice","silicium::dice::polyhedron","silicium::dice::polyhedronset","silicium::error","silicium::geometry","silicium::geometry::line2dcanon","silicium::geometry::variablesorderexception","silicium::graphs","silicium::graphs::grapherror","silicium::graphs::orientedgraph","silicium::graphs::unorientedgraph","silicium::integraldoesntexisterror","silicium::numericalintegration","silicium::optimization","silicium::plotter","silicium::plotter::image","silicium::optimization#accuracy()","silicium::graphs::orientedgraph#add_edge!()","silicium::graphs::unorientedgraph#add_edge!()","silicium::graphs#add_to_queue()","silicium::graphs::orientedgraph#add_vertex!()","silicium::graphs::orientedgraph#adjacted_with()","silicium::combinatorics#arrangement()","silicium::plotter::image#bar_chart()","silicium::optimization#bogosort()","silicium::optimization#bogosort!()","silicium::graphs#breadth_first_search?()","silicium::geometry#clockwise()","silicium::plotter#color()","silicium::combinatorics#combination()","silicium::graphs#connected?()","silicium::geometry#counter_clockwise()","silicium::dice::polyhedron#csides()","silicium::geometry#cut_by_eq()","silicium::graphs::orientedgraph#delete_edge!()","silicium::graphs::unorientedgraph#delete_edge!()","silicium::graphs::orientedgraph#delete_vertex!()","silicium::graphs#dfu()","silicium::graphs#dijkstra_algorythm()","silicium::geometry#directing_vector3d()","silicium::geometry#distance_point_line2d()","silicium::geometry#distance_point_line_equation2d()","silicium::geometry#distance_point_to_point2d()","silicium::geometry#distance_point_to_point3d()","silicium::graphs::orientedgraph#edge_label_number()","silicium::graphs::orientedgraph#edge_number()","silicium::plotter::image#export()","silicium::combinatorics#fact()","silicium::combinatorics#factorial()","silicium::graphs::orientedgraph#get_edge_label()","silicium::graphs::orientedgraph#get_vertex_label()","silicium::optimization#half_division()","silicium::optimization#half_division_step()","silicium::graphs::orientedgraph#has_edge?()","silicium::graphs::orientedgraph#has_vertex?()","silicium::geometry#height_point_3d()","silicium::optimization#hook_jeeves()","silicium::optimization#hook_jeeves_step()","silicium::geometry#insert_eq()","silicium::optimization#integrating_monte_carlo_base()","silicium::graphs::orientedgraph#label_edge!()","silicium::graphs::unorientedgraph#label_edge!()","silicium::graphs::orientedgraph#label_vertex!()","silicium::numericalintegration::left_rect_integration()","silicium::numericalintegration::left_rect_integration_n()","silicium::dice::polyhedronset#make_graph_by_plotter()","silicium::optimization#middle()","silicium::numericalintegration::middle_rectangles()","silicium::numericalintegration::middle_rectangles_with_a_segment()","silicium::geometry#minimal_convex_hull_2d()","silicium::geometry#needed_variables_order?()","silicium::dice::polyhedron::new()","silicium::dice::polyhedronset::new()","silicium::geometry::line2dcanon::new()","silicium::graphs::orientedgraph::new()","silicium::plotter::image::new()","silicium::geometry#not_polygon?()","silicium::graphs#number_of_connected()","silicium::geometry#oriented_area()","silicium::dice::polyhedronset#percentage()","silicium::geometry::line2dcanon#point_is_on_line?()","silicium::geometry#point_to_line_distance_3d()","silicium::geometry#process_cf()","silicium::geometry#process_free_member()","silicium::geometry#process_line_by_coordinates()","silicium::graphs::orientedgraph#protected_add_edge!()","silicium::graphs::orientedgraph#protected_delete_edge!()","silicium::geometry#put_point_in_part()","silicium::optimization#re_lu()","silicium::plotter::image#rectangle()","silicium::graphs::orientedgraph#reverse!()","silicium::dice::polyhedron#sides()","silicium::optimization#sigmoid()","silicium::numericalintegration::simpson_integration()","silicium::numericalintegration::simpson_integration_with_a_segment()","silicium::optimization#sorted?()","silicium::optimization#switch_step()","silicium::numericalintegration::three_eights_integration()","silicium::numericalintegration::three_eights_integration_n()","silicium::dice::polyhedron#throw()","silicium::dice::polyhedronset#throw()","silicium::dice::polyhedron#to_s()","silicium::dice::polyhedronset#to_s()","silicium::numericalintegration::trapezoid()","silicium::numericalintegration::trapezoid_with_a_segment()","silicium::geometry#vector_length()","silicium::geometry#vectors_product()","silicium::graphs::orientedgraph#vertex_label_number()","silicium::graphs::orientedgraph#vertex_number()","silicium::graphs::orientedgraph#vertices()",""],"info":[["Object","","Object.html","",""],["Silicium","","Silicium.html","","<p>require &#39;set&#39; require &#39;silicium&#39;\n"],["Silicium::Combinatorics","","Silicium/Combinatorics.html","",""],["Silicium::Dice","","Silicium/Dice.html","",""],["Silicium::Dice::Polyhedron","","Silicium/Dice/Polyhedron.html","","<p>Class represents a polyhedron csides - number or sides sides - array of sides(unusual for custom polyhedrons) …\n"],["Silicium::Dice::PolyhedronSet","","Silicium/Dice/PolyhedronSet.html","","<p>Class represents a PolyhedronsSet percentage - hash with chances of getting definite score\n"],["Silicium::Error","","Silicium/Error.html","",""],["Silicium::Geometry","","Silicium/Geometry.html","",""],["Silicium::Geometry::Line2dCanon","","Silicium/Geometry/Line2dCanon.html","","<p>Class represents a line as equation y = k*x +b k - slope b - free_term in two-dimensional space\n"],["Silicium::Geometry::VariablesOrderException","","Silicium/Geometry/VariablesOrderException.html","",""],["Silicium::Graphs","","Silicium/Graphs.html","",""],["Silicium::Graphs::GraphError","","Silicium/Graphs/GraphError.html","",""],["Silicium::Graphs::OrientedGraph","","Silicium/Graphs/OrientedGraph.html","",""],["Silicium::Graphs::UnorientedGraph","","Silicium/Graphs/UnorientedGraph.html","",""],["Silicium::IntegralDoesntExistError","","Silicium/IntegralDoesntExistError.html","",""],["Silicium::NumericalIntegration","","Silicium/NumericalIntegration.html","","<p>A class providing numerical integration methods\n"],["Silicium::Optimization","","Silicium/Optimization.html","",""],["Silicium::Plotter","","Silicium/Plotter.html","",""],["Silicium::Plotter::Image","","Silicium/Plotter/Image.html","","<p>A class representing canvas for plotting bar charts and function graphs\n"],["accuracy","Silicium::Optimization","Silicium/Optimization.html#method-i-accuracy","(step)","<p>calculate current accuracy in Hook - Jeeves method\n"],["add_edge!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-add_edge-21","(from, to)",""],["add_edge!","Silicium::Graphs::UnorientedGraph","Silicium/Graphs/UnorientedGraph.html#method-i-add_edge-21","(from, to)",""],["add_to_queue","Silicium::Graphs","Silicium/Graphs.html#method-i-add_to_queue","(graph, queue, node, visited)",""],["add_vertex!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-add_vertex-21","(vertex_id)",""],["adjacted_with","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-adjacted_with","(vertex)",""],["arrangement","Silicium::Combinatorics","Silicium/Combinatorics.html#method-i-arrangement","(n, k)","<p>Function A(n,k)\n"],["bar_chart","Silicium::Plotter::Image","Silicium/Plotter/Image.html#method-i-bar_chart","(bars, bar_width, bars_color = ChunkyPNG::Color('red @ 1.0'), axis_color = ChunkyPNG::Color::BLACK)","<p>Draws a bar chart in the plot using provided <code>bars</code>, each of them has width of <code>bar_width</code> and colored <code>bars_color</code> …\n"],["bogosort","Silicium::Optimization","Silicium/Optimization.html#method-i-bogosort","(a)","<p>fastest(but it is not exactly) sort\n"],["bogosort!","Silicium::Optimization","Silicium/Optimization.html#method-i-bogosort-21","(a)","<p>fastest(but it is not exactly) sort, modify sequance\n"],["breadth_first_search?","Silicium::Graphs","Silicium/Graphs.html#method-i-breadth_first_search-3F","(graph, start, goal)",""],["clockwise","Silicium::Geometry","Silicium/Geometry.html#method-i-clockwise","(a, b, c)","<p>Determines if a clockwise crawl is performed for defined order of points\n"],["color","Silicium::Plotter","Silicium/Plotter.html#method-i-color","(*args)","<p>Factory method to return a color value, based on the arguments given.\n<p>@overload Color(r, g, b, a)\n\n<pre class=\"ruby\"><span class=\"ruby-ivar\">@param</span> <span class=\"ruby-operator\">...</span>\n</pre>\n"],["combination","Silicium::Combinatorics","Silicium/Combinatorics.html#method-i-combination","(n, k)","<p>Function C(n,k)\n"],["connected?","Silicium::Graphs","Silicium/Graphs.html#method-i-connected-3F","(graph)",""],["counter_clockwise","Silicium::Geometry","Silicium/Geometry.html#method-i-counter_clockwise","(a, b, c)","<p>Determines if a counter-clockwise crawl is performed for defined order of points\n"],["csides","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-i-csides","()",""],["cut_by_eq","Silicium::Geometry","Silicium/Geometry.html#method-i-cut_by_eq","(line_equation)",""],["delete_edge!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-delete_edge-21","(from, to)",""],["delete_edge!","Silicium::Graphs::UnorientedGraph","Silicium/Graphs/UnorientedGraph.html#method-i-delete_edge-21","(from, to)",""],["delete_vertex!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-delete_vertex-21","(vertex)",""],["dfu","Silicium::Graphs","Silicium/Graphs.html#method-i-dfu","(graph, vertice, visited)",""],["dijkstra_algorythm","Silicium::Graphs","Silicium/Graphs.html#method-i-dijkstra_algorythm","(graph, starting_vertex)",""],["directing_vector3d","Silicium::Geometry","Silicium/Geometry.html#method-i-directing_vector3d","(line_equation)","<p>Creates an array- directing vector in three-dimensional space . The equation is specified in the canonical …\n"],["distance_point_line2d","Silicium::Geometry","Silicium/Geometry.html#method-i-distance_point_line2d","(p1, p2, a)","<p>The distance from a point to a line on a plane The line is defined by two points en.wikipedia.org/wiki/Distance_from_a_point_to_a_line …\n"],["distance_point_line_equation2d","Silicium::Geometry","Silicium/Geometry.html#method-i-distance_point_line_equation2d","(a, b, c, p)","<p>The distance from a point to a line on a plane Line defined by an equation return 0 if the equation does …\n"],["distance_point_to_point2d","Silicium::Geometry","Silicium/Geometry.html#method-i-distance_point_to_point2d","(a, b)","<p>Calculates the distance from given points in two-dimensional space\n"],["distance_point_to_point3d","Silicium::Geometry","Silicium/Geometry.html#method-i-distance_point_to_point3d","(a, b)","<p>Calculates the distance from given points in three-dimensional space\n"],["edge_label_number","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-edge_label_number","()",""],["edge_number","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-edge_number","()",""],["export","Silicium::Plotter::Image","Silicium/Plotter/Image.html#method-i-export","(filename)","<p>Exports plotted image to file <code>filename</code>\n"],["fact","Silicium::Combinatorics","Silicium/Combinatorics.html#method-i-fact","(n, k)","<p>Factorial for counting 3 parameters in one run\n"],["factorial","Silicium::Combinatorics","Silicium/Combinatorics.html#method-i-factorial","(n)",""],["get_edge_label","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-get_edge_label","(from, to)",""],["get_vertex_label","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-get_vertex_label","(vertex)",""],["half_division","Silicium::Optimization","Silicium/Optimization.html#method-i-half_division","(a, b, eps = 0.001, &block)","<p>find root in [a, b], if he exist, if number of iterations &gt; iters -&gt; error\n"],["half_division_step","Silicium::Optimization","Silicium/Optimization.html#method-i-half_division_step","(a, b, c, &block)","<p>do one half division step\n"],["has_edge?","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-has_edge-3F","(from, to)",""],["has_vertex?","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-has_vertex-3F","(vertex)",""],["height_point_3d","Silicium::Geometry","Silicium/Geometry.html#method-i-height_point_3d","(line_equation)","<p>Creates an array of coordinates of the point ([x, y, z] on the line given by the equation in the canonical …\n"],["hook_jeeves","Silicium::Optimization","Silicium/Optimization.html#method-i-hook_jeeves","(x, step, eps = 0.1, &block)","<p>Hook - Jeeves method for find minimum point (x - array of start variables, step - step of one iteration, …\n"],["hook_jeeves_step","Silicium::Optimization","Silicium/Optimization.html#method-i-hook_jeeves_step","(x, i, step, &block)","<p>do one Hook - Jeeves step\n"],["insert_eq","Silicium::Geometry","Silicium/Geometry.html#method-i-insert_eq","(line_equation)",""],["integrating_Monte_Carlo_base","Silicium::Optimization","Silicium/Optimization.html#method-i-integrating_Monte_Carlo_base","(a, b, n = 100000, &block)","<p>integrating using method Monte Carlo (f - function, a, b - integrating limits, n - amount of random numbers) …\n"],["label_edge!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-label_edge-21","(from, to, label)",""],["label_edge!","Silicium::Graphs::UnorientedGraph","Silicium/Graphs/UnorientedGraph.html#method-i-label_edge-21","(from, to, label)",""],["label_vertex!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-label_vertex-21","(vertex, label)",""],["left_rect_integration","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-left_rect_integration","(left_p, right_p, eps = 0.0001, &block)","<p>Left Rectangle Method and Right Rectangle Method\n"],["left_rect_integration_n","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-left_rect_integration_n","(left_p, right_p, splits, &block)","<p>Left Rectangle Auxiliary Method and Right Rectangle Auxiliary Method\n"],["make_graph_by_plotter","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-i-make_graph_by_plotter","(x = percentage.size * 10, y = percentage.size * 10)","<p>creating a graph representing chances of getting points\n"],["middle","Silicium::Optimization","Silicium/Optimization.html#method-i-middle","(a, b)","<p>find centr of interval\n"],["middle_rectangles","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-middle_rectangles","(a, b, eps = 0.0001, &block)","<p>Middle Rectangles Method with specified accuracy\n"],["middle_rectangles_with_a_segment","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-middle_rectangles_with_a_segment","(a, b, n, &block)","<p>Middle Rectangles Method with a segment\n"],["minimal_convex_hull_2d","Silicium::Geometry","Silicium/Geometry.html#method-i-minimal_convex_hull_2d","(points)","<p>Returns an array containing points that are included in the minimal convex hull for a given array of …\n"],["needed_variables_order?","Silicium::Geometry","Silicium/Geometry.html#method-i-needed_variables_order-3F","(before, after)",""],["new","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-c-new","(sides)","<p>initializing polyhedron&#39;s variables there are two ways how to create it 1: by number (6) - creates …\n"],["new","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-c-new","(arr)",""],["new","Silicium::Geometry::Line2dCanon","Silicium/Geometry/Line2dCanon.html#method-c-new","(p1, p2)",""],["new","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-c-new","(initializer = [])",""],["new","Silicium::Plotter::Image","Silicium/Plotter/Image.html#method-c-new","(width, height, bg_color = ChunkyPNG::Color::TRANSPARENT)","<p>Creates a new plot with chosen <code>width</code> and <code>height</code> parameters with background colored <code>bg_color</code>\n"],["not_polygon?","Silicium::Geometry","Silicium/Geometry.html#method-i-not_polygon-3F","(points)",""],["number_of_connected","Silicium::Graphs","Silicium/Graphs.html#method-i-number_of_connected","(graph)",""],["oriented_area","Silicium::Geometry","Silicium/Geometry.html#method-i-oriented_area","(a, b, c)",""],["percentage","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-i-percentage","()",""],["point_is_on_line?","Silicium::Geometry::Line2dCanon","Silicium/Geometry/Line2dCanon.html#method-i-point_is_on_line-3F","(p1)","<p>Checks the point lies on the line or not\n"],["point_to_line_distance_3d","Silicium::Geometry","Silicium/Geometry.html#method-i-point_to_line_distance_3d","(point, line_eq)","<p>Calculates the distance from a point given by a Point3d structure to a straight line given by a canonical …\n"],["process_cf","Silicium::Geometry","Silicium/Geometry.html#method-i-process_cf","(line_equation, variable)",""],["process_free_member","Silicium::Geometry","Silicium/Geometry.html#method-i-process_free_member","(line_equation, variable)",""],["process_line_by_coordinates","Silicium::Geometry","Silicium/Geometry.html#method-i-process_line_by_coordinates","(line_equation, func)",""],["protected_add_edge!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-protected_add_edge-21","(from, to)",""],["protected_delete_edge!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-protected_delete_edge-21","(from, to)",""],["put_point_in_part","Silicium::Geometry","Silicium/Geometry.html#method-i-put_point_in_part","(part, point, direction)",""],["re_lu","Silicium::Optimization","Silicium/Optimization.html#method-i-re_lu","(x)","<p>reflector function\n"],["rectangle","Silicium::Plotter::Image","Silicium/Plotter/Image.html#method-i-rectangle","(x, y, width, height, color)",""],["reverse!","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-reverse-21","()",""],["sides","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-i-sides","()",""],["sigmoid","Silicium::Optimization","Silicium/Optimization.html#method-i-sigmoid","(x)","<p>sigmoid function\n"],["simpson_integration","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-simpson_integration","(a, b, eps = 0.0001, &block)","<p>Simpson integration with specified accuracy\n"],["simpson_integration_with_a_segment","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-simpson_integration_with_a_segment","(a, b, n, &block)","<p>Simpson integration with a segment\n"],["sorted?","Silicium::Optimization","Silicium/Optimization.html#method-i-sorted-3F","(a)","<p>return true if array is sorted\n"],["switch_step","Silicium::Optimization","Silicium/Optimization.html#method-i-switch_step","(cur_f, prev_f, step, i)","<p>switch step if current func value &gt; previous func value\n"],["three_eights_integration","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-three_eights_integration","(a, b, eps = 0.0001, &block)","<p>Computes integral from <code>a</code> to <code>b</code> of <code>block</code> with accuracy <code>eps</code>\n"],["three_eights_integration_n","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-three_eights_integration_n","(a, b, n, &block)","<p>Computes integral from <code>a</code> to <code>b</code> of <code>block</code> with <code>n</code> segmentations\n"],["throw","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-i-throw","()","<p>ability to throw a polyhedron\n"],["throw","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-i-throw","()","<p>ability to throw a polyhedron&#39;s set using hash of chances\n"],["to_s","Silicium::Dice::Polyhedron","Silicium/Dice/Polyhedron.html#method-i-to_s","()",""],["to_s","Silicium::Dice::PolyhedronSet","Silicium/Dice/PolyhedronSet.html#method-i-to_s","()","<p>returns array of polyhedrons\n"],["trapezoid","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-trapezoid","(a, b, eps = 0.0001, &block)","<p>Trapezoid Method with specified accuracy\n"],["trapezoid_with_a_segment","Silicium::NumericalIntegration","Silicium/NumericalIntegration.html#method-c-trapezoid_with_a_segment","(a, b, n, &block)","<p>Trapezoid Method with a segment\n"],["vector_length","Silicium::Geometry","Silicium/Geometry.html#method-i-vector_length","(vector)",""],["vectors_product","Silicium::Geometry","Silicium/Geometry.html#method-i-vectors_product","(v1, v2)",""],["vertex_label_number","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-vertex_label_number","()",""],["vertex_number","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-vertex_number","()",""],["vertices","Silicium::Graphs::OrientedGraph","Silicium/Graphs/OrientedGraph.html#method-i-vertices","()",""],["README","","README_md.html","","<p><img src=\"https://badge.fury.io/rb/silicium.svg\">\n<img src=\"https://travis-ci.org/mmcs-ruby/silicium.svg?branch=master\"> ...\n"]]}}
Binary file
data/docs/js/searcher.js CHANGED
@@ -1,229 +1,229 @@
1
- Searcher = function(data) {
2
- this.data = data;
3
- this.handlers = [];
4
- }
5
-
6
- Searcher.prototype = new function() {
7
- // search is performed in chunks of 1000 for non-blocking user input
8
- var CHUNK_SIZE = 1000;
9
- // do not try to find more than 100 results
10
- var MAX_RESULTS = 100;
11
- var huid = 1;
12
- var suid = 1;
13
- var runs = 0;
14
-
15
- this.find = function(query) {
16
- var queries = splitQuery(query);
17
- var regexps = buildRegexps(queries);
18
- var highlighters = buildHilighters(queries);
19
- var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
20
- var _this = this;
21
-
22
- this.currentSuid = state.n;
23
-
24
- if (!query) return;
25
-
26
- var run = function() {
27
- // stop current search thread if new search started
28
- if (state.n != _this.currentSuid) return;
29
-
30
- var results =
31
- performSearch(_this.data, regexps, queries, highlighters, state);
32
- var hasMore = (state.limit > 0 && state.pass < 4);
33
-
34
- triggerResults.call(_this, results, !hasMore);
35
- if (hasMore) {
36
- setTimeout(run, 2);
37
- }
38
- runs++;
39
- };
40
- runs = 0;
41
-
42
- // start search thread
43
- run();
44
- }
45
-
46
- /* ----- Events ------ */
47
- this.ready = function(fn) {
48
- fn.huid = huid;
49
- this.handlers.push(fn);
50
- }
51
-
52
- /* ----- Utilities ------ */
53
- function splitQuery(query) {
54
- return query.split(/(\s+|::?|\(\)?)/).filter(function(string) {
55
- return string.match(/\S/);
56
- });
57
- }
58
-
59
- function buildRegexps(queries) {
60
- return queries.map(function(query) {
61
- return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
62
- });
63
- }
64
-
65
- function buildHilighters(queries) {
66
- return queries.map(function(query) {
67
- return query.split('').map(function(l, i) {
68
- return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
69
- }).join('');
70
- });
71
- }
72
-
73
- // function longMatchRegexp(index, longIndex, regexps) {
74
- // for (var i = regexps.length - 1; i >= 0; i--){
75
- // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
76
- // };
77
- // return true;
78
- // }
79
-
80
-
81
- /* ----- Mathchers ------ */
82
-
83
- /*
84
- * This record matches if the index starts with queries[0] and the record
85
- * matches all of the regexps
86
- */
87
- function matchPassBeginning(index, longIndex, queries, regexps) {
88
- if (index.indexOf(queries[0]) != 0) return false;
89
- for (var i=1, l = regexps.length; i < l; i++) {
90
- if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
91
- return false;
92
- };
93
- return true;
94
- }
95
-
96
- /*
97
- * This record matches if the longIndex starts with queries[0] and the
98
- * longIndex matches all of the regexps
99
- */
100
- function matchPassLongIndex(index, longIndex, queries, regexps) {
101
- if (longIndex.indexOf(queries[0]) != 0) return false;
102
- for (var i=1, l = regexps.length; i < l; i++) {
103
- if (!longIndex.match(regexps[i]))
104
- return false;
105
- };
106
- return true;
107
- }
108
-
109
- /*
110
- * This record matches if the index contains queries[0] and the record
111
- * matches all of the regexps
112
- */
113
- function matchPassContains(index, longIndex, queries, regexps) {
114
- if (index.indexOf(queries[0]) == -1) return false;
115
- for (var i=1, l = regexps.length; i < l; i++) {
116
- if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
117
- return false;
118
- };
119
- return true;
120
- }
121
-
122
- /*
123
- * This record matches if regexps[0] matches the index and the record
124
- * matches all of the regexps
125
- */
126
- function matchPassRegexp(index, longIndex, queries, regexps) {
127
- if (!index.match(regexps[0])) return false;
128
- for (var i=1, l = regexps.length; i < l; i++) {
129
- if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
130
- return false;
131
- };
132
- return true;
133
- }
134
-
135
-
136
- /* ----- Highlighters ------ */
137
- function highlightRegexp(info, queries, regexps, highlighters) {
138
- var result = createResult(info);
139
- for (var i=0, l = regexps.length; i < l; i++) {
140
- result.title = result.title.replace(regexps[i], highlighters[i]);
141
- result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
142
- };
143
- return result;
144
- }
145
-
146
- function hltSubstring(string, pos, length) {
147
- return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
148
- }
149
-
150
- function highlightQuery(info, queries, regexps, highlighters) {
151
- var result = createResult(info);
152
- var pos = 0;
153
- var lcTitle = result.title.toLowerCase();
154
-
155
- pos = lcTitle.indexOf(queries[0]);
156
- if (pos != -1) {
157
- result.title = hltSubstring(result.title, pos, queries[0].length);
158
- }
159
-
160
- result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
161
- for (var i=1, l = regexps.length; i < l; i++) {
162
- result.title = result.title.replace(regexps[i], highlighters[i]);
163
- result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
164
- };
165
- return result;
166
- }
167
-
168
- function createResult(info) {
169
- var result = {};
170
- result.title = info[0];
171
- result.namespace = info[1];
172
- result.path = info[2];
173
- result.params = info[3];
174
- result.snippet = info[4];
175
- result.badge = info[6];
176
- return result;
177
- }
178
-
179
- /* ----- Searching ------ */
180
- function performSearch(data, regexps, queries, highlighters, state) {
181
- var searchIndex = data.searchIndex;
182
- var longSearchIndex = data.longSearchIndex;
183
- var info = data.info;
184
- var result = [];
185
- var i = state.from;
186
- var l = searchIndex.length;
187
- var togo = CHUNK_SIZE;
188
- var matchFunc, hltFunc;
189
-
190
- while (state.pass < 4 && state.limit > 0 && togo > 0) {
191
- if (state.pass == 0) {
192
- matchFunc = matchPassBeginning;
193
- hltFunc = highlightQuery;
194
- } else if (state.pass == 1) {
195
- matchFunc = matchPassLongIndex;
196
- hltFunc = highlightQuery;
197
- } else if (state.pass == 2) {
198
- matchFunc = matchPassContains;
199
- hltFunc = highlightQuery;
200
- } else if (state.pass == 3) {
201
- matchFunc = matchPassRegexp;
202
- hltFunc = highlightRegexp;
203
- }
204
-
205
- for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
206
- if (info[i].n == state.n) continue;
207
- if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
208
- info[i].n = state.n;
209
- result.push(hltFunc(info[i], queries, regexps, highlighters));
210
- state.limit--;
211
- }
212
- };
213
- if (searchIndex.length <= i) {
214
- state.pass++;
215
- i = state.from = 0;
216
- } else {
217
- state.from = i;
218
- }
219
- }
220
- return result;
221
- }
222
-
223
- function triggerResults(results, isLast) {
224
- this.handlers.forEach(function(fn) {
225
- fn.call(this, results, isLast)
226
- });
227
- }
228
- }
229
-
1
+ Searcher = function(data) {
2
+ this.data = data;
3
+ this.handlers = [];
4
+ }
5
+
6
+ Searcher.prototype = new function() {
7
+ // search is performed in chunks of 1000 for non-blocking user input
8
+ var CHUNK_SIZE = 1000;
9
+ // do not try to find more than 100 results
10
+ var MAX_RESULTS = 100;
11
+ var huid = 1;
12
+ var suid = 1;
13
+ var runs = 0;
14
+
15
+ this.find = function(query) {
16
+ var queries = splitQuery(query);
17
+ var regexps = buildRegexps(queries);
18
+ var highlighters = buildHilighters(queries);
19
+ var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
20
+ var _this = this;
21
+
22
+ this.currentSuid = state.n;
23
+
24
+ if (!query) return;
25
+
26
+ var run = function() {
27
+ // stop current search thread if new search started
28
+ if (state.n != _this.currentSuid) return;
29
+
30
+ var results =
31
+ performSearch(_this.data, regexps, queries, highlighters, state);
32
+ var hasMore = (state.limit > 0 && state.pass < 4);
33
+
34
+ triggerResults.call(_this, results, !hasMore);
35
+ if (hasMore) {
36
+ setTimeout(run, 2);
37
+ }
38
+ runs++;
39
+ };
40
+ runs = 0;
41
+
42
+ // start search thread
43
+ run();
44
+ }
45
+
46
+ /* ----- Events ------ */
47
+ this.ready = function(fn) {
48
+ fn.huid = huid;
49
+ this.handlers.push(fn);
50
+ }
51
+
52
+ /* ----- Utilities ------ */
53
+ function splitQuery(query) {
54
+ return query.split(/(\s+|::?|\(\)?)/).filter(function(string) {
55
+ return string.match(/\S/);
56
+ });
57
+ }
58
+
59
+ function buildRegexps(queries) {
60
+ return queries.map(function(query) {
61
+ return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
62
+ });
63
+ }
64
+
65
+ function buildHilighters(queries) {
66
+ return queries.map(function(query) {
67
+ return query.split('').map(function(l, i) {
68
+ return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
69
+ }).join('');
70
+ });
71
+ }
72
+
73
+ // function longMatchRegexp(index, longIndex, regexps) {
74
+ // for (var i = regexps.length - 1; i >= 0; i--){
75
+ // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
76
+ // };
77
+ // return true;
78
+ // }
79
+
80
+
81
+ /* ----- Mathchers ------ */
82
+
83
+ /*
84
+ * This record matches if the index starts with queries[0] and the record
85
+ * matches all of the regexps
86
+ */
87
+ function matchPassBeginning(index, longIndex, queries, regexps) {
88
+ if (index.indexOf(queries[0]) != 0) return false;
89
+ for (var i=1, l = regexps.length; i < l; i++) {
90
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
91
+ return false;
92
+ };
93
+ return true;
94
+ }
95
+
96
+ /*
97
+ * This record matches if the longIndex starts with queries[0] and the
98
+ * longIndex matches all of the regexps
99
+ */
100
+ function matchPassLongIndex(index, longIndex, queries, regexps) {
101
+ if (longIndex.indexOf(queries[0]) != 0) return false;
102
+ for (var i=1, l = regexps.length; i < l; i++) {
103
+ if (!longIndex.match(regexps[i]))
104
+ return false;
105
+ };
106
+ return true;
107
+ }
108
+
109
+ /*
110
+ * This record matches if the index contains queries[0] and the record
111
+ * matches all of the regexps
112
+ */
113
+ function matchPassContains(index, longIndex, queries, regexps) {
114
+ if (index.indexOf(queries[0]) == -1) return false;
115
+ for (var i=1, l = regexps.length; i < l; i++) {
116
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
117
+ return false;
118
+ };
119
+ return true;
120
+ }
121
+
122
+ /*
123
+ * This record matches if regexps[0] matches the index and the record
124
+ * matches all of the regexps
125
+ */
126
+ function matchPassRegexp(index, longIndex, queries, regexps) {
127
+ if (!index.match(regexps[0])) return false;
128
+ for (var i=1, l = regexps.length; i < l; i++) {
129
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
130
+ return false;
131
+ };
132
+ return true;
133
+ }
134
+
135
+
136
+ /* ----- Highlighters ------ */
137
+ function highlightRegexp(info, queries, regexps, highlighters) {
138
+ var result = createResult(info);
139
+ for (var i=0, l = regexps.length; i < l; i++) {
140
+ result.title = result.title.replace(regexps[i], highlighters[i]);
141
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
142
+ };
143
+ return result;
144
+ }
145
+
146
+ function hltSubstring(string, pos, length) {
147
+ return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
148
+ }
149
+
150
+ function highlightQuery(info, queries, regexps, highlighters) {
151
+ var result = createResult(info);
152
+ var pos = 0;
153
+ var lcTitle = result.title.toLowerCase();
154
+
155
+ pos = lcTitle.indexOf(queries[0]);
156
+ if (pos != -1) {
157
+ result.title = hltSubstring(result.title, pos, queries[0].length);
158
+ }
159
+
160
+ result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
161
+ for (var i=1, l = regexps.length; i < l; i++) {
162
+ result.title = result.title.replace(regexps[i], highlighters[i]);
163
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
164
+ };
165
+ return result;
166
+ }
167
+
168
+ function createResult(info) {
169
+ var result = {};
170
+ result.title = info[0];
171
+ result.namespace = info[1];
172
+ result.path = info[2];
173
+ result.params = info[3];
174
+ result.snippet = info[4];
175
+ result.badge = info[6];
176
+ return result;
177
+ }
178
+
179
+ /* ----- Searching ------ */
180
+ function performSearch(data, regexps, queries, highlighters, state) {
181
+ var searchIndex = data.searchIndex;
182
+ var longSearchIndex = data.longSearchIndex;
183
+ var info = data.info;
184
+ var result = [];
185
+ var i = state.from;
186
+ var l = searchIndex.length;
187
+ var togo = CHUNK_SIZE;
188
+ var matchFunc, hltFunc;
189
+
190
+ while (state.pass < 4 && state.limit > 0 && togo > 0) {
191
+ if (state.pass == 0) {
192
+ matchFunc = matchPassBeginning;
193
+ hltFunc = highlightQuery;
194
+ } else if (state.pass == 1) {
195
+ matchFunc = matchPassLongIndex;
196
+ hltFunc = highlightQuery;
197
+ } else if (state.pass == 2) {
198
+ matchFunc = matchPassContains;
199
+ hltFunc = highlightQuery;
200
+ } else if (state.pass == 3) {
201
+ matchFunc = matchPassRegexp;
202
+ hltFunc = highlightRegexp;
203
+ }
204
+
205
+ for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
206
+ if (info[i].n == state.n) continue;
207
+ if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
208
+ info[i].n = state.n;
209
+ result.push(hltFunc(info[i], queries, regexps, highlighters));
210
+ state.limit--;
211
+ }
212
+ };
213
+ if (searchIndex.length <= i) {
214
+ state.pass++;
215
+ i = state.from = 0;
216
+ } else {
217
+ state.from = i;
218
+ }
219
+ }
220
+ return result;
221
+ }
222
+
223
+ function triggerResults(results, isLast) {
224
+ this.handlers.forEach(function(fn) {
225
+ fn.call(this, results, isLast)
226
+ });
227
+ }
228
+ }
229
+