RubMat 2.1.6 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Rakefile +2 -2
- data/bin/{rubmat.rb → rubmat} +0 -0
- data/doc/apple-touch-icon.png +0 -0
- data/doc/classes/Fixnum.html +394 -0
- data/doc/classes/Fixnum.src/M000019.html +18 -0
- data/doc/classes/Fixnum.src/M000020.html +18 -0
- data/doc/classes/Fixnum.src/M000021.html +18 -0
- data/doc/classes/Fixnum.src/M000022.html +18 -0
- data/doc/classes/Fixnum.src/M000023.html +18 -0
- data/doc/classes/GetOpt.html +135 -0
- data/doc/classes/Object.html +2636 -0
- data/doc/created.rid +1 -0
- data/doc/css/main.css +278 -0
- data/doc/css/panel.css +383 -0
- data/doc/css/reset.css +53 -0
- data/doc/favicon.ico +0 -0
- data/doc/files/LICENSE.html +74 -0
- data/doc/files/README.html +73 -0
- data/doc/files/README_md.html +73 -0
- data/doc/files/Rakefile.html +116 -0
- data/doc/files/bin/librbdiscrete_rb.html +93 -0
- data/doc/files/lib/fixnumexpand_rb.html +59 -0
- data/doc/files/lib/help_rb.html +52 -0
- data/doc/files/lib/librbdiscrete_rb.html +93 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000001.html +22 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000002.html +29 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000003.html +21 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000004.html +28 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000005.html +22 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000006.html +31 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000007.html +18 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000008.html +22 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000009.html +18 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000010.html +22 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000011.html +28 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000012.html +28 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000013.html +18 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000014.html +18 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000015.html +18 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000016.html +32 -0
- data/doc/files/lib/librbdiscrete_rb.src/M000017.html +22 -0
- data/doc/files/lib/main_rb.html +76 -0
- data/doc/files/lib/statics_yml.html +63 -0
- data/doc/files/nbproject/private/private_xml.html +67 -0
- data/doc/files/nbproject/private/rake-d_txt.html +62 -0
- data/doc/files/nbproject/project_properties.html +60 -0
- data/doc/files/nbproject/project_xml.html +79 -0
- data/doc/files/pkg/RubMat-2_1_5/LICENSE.html +74 -0
- data/doc/files/pkg/RubMat-2_1_5/README.html +73 -0
- data/doc/files/pkg/RubMat-2_1_5/Rakefile.html +116 -0
- data/doc/files/pkg/RubMat-2_1_5/bin/librbdiscrete_rb.html +86 -0
- data/doc/files/pkg/RubMat-2_1_5/lib/fixnumexpand_rb.html +59 -0
- data/doc/files/pkg/RubMat-2_1_5/lib/librbdiscrete_rb.html +86 -0
- data/doc/files/pkg/RubMat-2_1_5/lib/main_rb.html +77 -0
- data/doc/files/pkg/RubMat-2_1_5/lib/statics_yml.html +63 -0
- data/doc/files/test/testprocedure_rb.html +59 -0
- data/doc/files/test/testprocedure_rb.src/M000018.html +18 -0
- data/doc/fr_class_index.html +27 -0
- data/doc/fr_file_index.html +30 -0
- data/doc/fr_method_index.html +49 -0
- data/doc/i/arrows.png +0 -0
- data/doc/i/results_bg.png +0 -0
- data/doc/i/tree_bg.png +0 -0
- data/doc/index.html +14 -0
- data/doc/js/jquery-1.3.2.min.js +19 -0
- data/doc/js/jquery-effect.js +593 -0
- data/doc/js/main.js +22 -0
- data/doc/js/searchdoc.js +628 -0
- data/doc/panel/index.html +71 -0
- data/doc/panel/search_index.js +1 -0
- data/doc/panel/tree.js +1 -0
- data/doc/rdoc-style.css +208 -0
- data/pkg/RubMat-2.1.5.gem +0 -0
- data/pkg/RubMat-2.1.5/LICENSE +17 -0
- data/pkg/RubMat-2.1.5/README +11 -0
- data/pkg/RubMat-2.1.5/Rakefile +42 -0
- data/pkg/RubMat-2.1.5/RubMat.png +0 -0
- data/pkg/RubMat-2.1.5/gplv3.png +0 -0
- data/pkg/RubMat-2.1.5/lib/fixnumexpand.rb +35 -0
- data/pkg/RubMat-2.1.5/lib/librbdiscrete.rb +412 -0
- data/pkg/RubMat-2.1.5/lib/main.rb +13 -0
- data/pkg/RubMat-2.1.5/lib/statics.yml +4 -0
- data/rubmat.gemspec +22 -0
- data/test/testprocedure.rb +8 -0
- metadata +110 -16
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>hours (Fixnum)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/fixnumexpand.rb, line 26</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hours</span>
|
15
|
+
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>days (Fixnum)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/fixnumexpand.rb, line 29</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">days</span>
|
15
|
+
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">24</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>weeks (Fixnum)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/fixnumexpand.rb, line 32</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weeks</span>
|
15
|
+
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">24</span> <span class="ruby-operator">*</span> <span class="ruby-value">7</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,135 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>GetOpt</title>
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
|
9
|
+
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
|
10
|
+
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
+
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
+
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<div class="banner">
|
17
|
+
<h1>
|
18
|
+
<span class="type">Class</span>
|
19
|
+
GetOpt
|
20
|
+
|
21
|
+
<span class="parent"><
|
22
|
+
|
23
|
+
<a href="Object.html">Object</a>
|
24
|
+
|
25
|
+
</span>
|
26
|
+
|
27
|
+
</h1>
|
28
|
+
<ul class="files">
|
29
|
+
|
30
|
+
<li><a href="../files/pkg/RubMat-2_1_5/lib/main_rb.html">pkg/RubMat-2.1.5/lib/main.rb</a></li>
|
31
|
+
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<div id="bodyContent">
|
35
|
+
<div id="content">
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
<div class="sectiontitle">Methods</div>
|
46
|
+
<dl class="methods">
|
47
|
+
|
48
|
+
<dt>C</dt>
|
49
|
+
<dd>
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li><a href="#M000082">clearscr</a>,</li>
|
53
|
+
|
54
|
+
<li><a href="#M000081">command_line</a></li>
|
55
|
+
|
56
|
+
</ul>
|
57
|
+
</dd>
|
58
|
+
|
59
|
+
</dl>
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div class="sectiontitle">Instance Public methods</div>
|
74
|
+
|
75
|
+
<div class="method">
|
76
|
+
<div class="title" id="M000082">
|
77
|
+
|
78
|
+
<a name="M000082"></a><b>clearscr</b>()
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<div class="sourcecode">
|
86
|
+
<p class="source-link">
|
87
|
+
Source: <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">show</a>
|
88
|
+
|
89
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/main.rb#L31" target="_blank" class="github_url">on GitHub</a>
|
90
|
+
|
91
|
+
</p>
|
92
|
+
<div id="M000082_source" class="dyn-source">
|
93
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/main.rb, line 31</span>
|
94
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clearscr</span>
|
95
|
+
<span class="ruby-comment cmt"># Clears screen</span>
|
96
|
+
<span class="ruby-keyword kw">end</span></pre>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div class="method">
|
103
|
+
<div class="title" id="M000081">
|
104
|
+
|
105
|
+
<a name="M000081"></a><b>command_line</b>()
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<div class="sourcecode">
|
113
|
+
<p class="source-link">
|
114
|
+
Source: <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">show</a>
|
115
|
+
|
116
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/main.rb#L25" target="_blank" class="github_url">on GitHub</a>
|
117
|
+
|
118
|
+
</p>
|
119
|
+
<div id="M000081_source" class="dyn-source">
|
120
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/main.rb, line 25</span>
|
121
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">command_line</span>
|
122
|
+
<span class="ruby-identifier">print</span> <span class="ruby-value str">">=> "</span>
|
123
|
+
<span class="ruby-identifier">comm</span> = <span class="ruby-identifier">gets</span>
|
124
|
+
<span class="ruby-identifier">commnd</span> = <span class="ruby-identifier">comm</span>.<span class="ruby-identifier">chomp</span>
|
125
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">""</span>
|
126
|
+
<span class="ruby-keyword kw">end</span></pre>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</div>
|
131
|
+
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
</body>
|
135
|
+
</html>
|
@@ -0,0 +1,2636 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>Object</title>
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
|
9
|
+
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
|
10
|
+
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
+
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
+
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<div class="banner">
|
17
|
+
<h1>
|
18
|
+
<span class="type">Class</span>
|
19
|
+
Object
|
20
|
+
|
21
|
+
<span class="parent"><
|
22
|
+
|
23
|
+
<a href="Object.html">Object</a>
|
24
|
+
|
25
|
+
</span>
|
26
|
+
|
27
|
+
</h1>
|
28
|
+
<ul class="files">
|
29
|
+
|
30
|
+
</ul>
|
31
|
+
</div>
|
32
|
+
<div id="bodyContent">
|
33
|
+
<div id="content">
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
<div class="sectiontitle">Methods</div>
|
44
|
+
<dl class="methods">
|
45
|
+
|
46
|
+
<dt>B</dt>
|
47
|
+
<dd>
|
48
|
+
<ul>
|
49
|
+
|
50
|
+
<li><a href="#M000017">binary_search</a>,</li>
|
51
|
+
|
52
|
+
<li><a href="#M000074">binary_search</a>,</li>
|
53
|
+
|
54
|
+
<li><a href="#M000059">binary_search</a>,</li>
|
55
|
+
|
56
|
+
<li><a href="#M000034">binary_search</a>,</li>
|
57
|
+
|
58
|
+
<li><a href="#M000035">birds_eye</a>,</li>
|
59
|
+
|
60
|
+
<li><a href="#M000062">birds_eye</a>,</li>
|
61
|
+
|
62
|
+
<li><a href="#M000075">birds_eye</a>,</li>
|
63
|
+
|
64
|
+
<li><a href="#M000018">birds_eye</a></li>
|
65
|
+
|
66
|
+
</ul>
|
67
|
+
</dd>
|
68
|
+
|
69
|
+
<dt>C</dt>
|
70
|
+
<dd>
|
71
|
+
<ul>
|
72
|
+
|
73
|
+
<li><a href="#M000066">combinatorial</a>,</li>
|
74
|
+
|
75
|
+
<li><a href="#M000027">combinatorial</a>,</li>
|
76
|
+
|
77
|
+
<li><a href="#M000009">combinatorial</a>,</li>
|
78
|
+
|
79
|
+
<li><a href="#M000050">combinatorial</a>,</li>
|
80
|
+
|
81
|
+
<li><a href="#M000080">commfail</a>,</li>
|
82
|
+
|
83
|
+
<li><a href="#M000079">commsuccss</a></li>
|
84
|
+
|
85
|
+
</ul>
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
<dt>D</dt>
|
89
|
+
<dd>
|
90
|
+
<ul>
|
91
|
+
|
92
|
+
<li><a href="#M000054">dist_pres</a>,</li>
|
93
|
+
|
94
|
+
<li><a href="#M000071">dist_pres</a>,</li>
|
95
|
+
|
96
|
+
<li><a href="#M000013">dist_pres</a>,</li>
|
97
|
+
|
98
|
+
<li><a href="#M000031">dist_pres</a></li>
|
99
|
+
|
100
|
+
</ul>
|
101
|
+
</dd>
|
102
|
+
|
103
|
+
<dt>E</dt>
|
104
|
+
<dd>
|
105
|
+
<ul>
|
106
|
+
|
107
|
+
<li><a href="#M000019">eagle_view</a>,</li>
|
108
|
+
|
109
|
+
<li><a href="#M000063">eagle_view</a>,</li>
|
110
|
+
|
111
|
+
<li><a href="#M000076">eagle_view</a>,</li>
|
112
|
+
|
113
|
+
<li><a href="#M000036">eagle_view</a></li>
|
114
|
+
|
115
|
+
</ul>
|
116
|
+
</dd>
|
117
|
+
|
118
|
+
<dt>F</dt>
|
119
|
+
<dd>
|
120
|
+
<ul>
|
121
|
+
|
122
|
+
<li><a href="#M000057">factorial</a>,</li>
|
123
|
+
|
124
|
+
<li><a href="#M000046">factorial</a>,</li>
|
125
|
+
|
126
|
+
<li><a href="#M000023">factorial</a>,</li>
|
127
|
+
|
128
|
+
<li><a href="#M000000">factorial</a>,</li>
|
129
|
+
|
130
|
+
<li><a href="#M000068">fermat_little</a>,</li>
|
131
|
+
|
132
|
+
<li><a href="#M000083">fermat_little</a>,</li>
|
133
|
+
|
134
|
+
<li><a href="#M000022">fermat_little</a>,</li>
|
135
|
+
|
136
|
+
<li><a href="#M000039">fermat_little</a>,</li>
|
137
|
+
|
138
|
+
<li><a href="#M000032">fib</a>,</li>
|
139
|
+
|
140
|
+
<li><a href="#M000014">fib</a>,</li>
|
141
|
+
|
142
|
+
<li><a href="#M000055">fib</a>,</li>
|
143
|
+
|
144
|
+
<li><a href="#M000072">fib</a></li>
|
145
|
+
|
146
|
+
</ul>
|
147
|
+
</dd>
|
148
|
+
|
149
|
+
<dt>H</dt>
|
150
|
+
<dd>
|
151
|
+
<ul>
|
152
|
+
|
153
|
+
<li><a href="#M000015">help</a></li>
|
154
|
+
|
155
|
+
</ul>
|
156
|
+
</dd>
|
157
|
+
|
158
|
+
<dt>I</dt>
|
159
|
+
<dd>
|
160
|
+
<ul>
|
161
|
+
|
162
|
+
<li><a href="#M000084">inspect</a>,</li>
|
163
|
+
|
164
|
+
<li><a href="#M000038">is_prime</a>,</li>
|
165
|
+
|
166
|
+
<li><a href="#M000021">is_prime</a>,</li>
|
167
|
+
|
168
|
+
<li><a href="#M000078">is_prime</a>,</li>
|
169
|
+
|
170
|
+
<li><a href="#M000065">is_prime</a>,</li>
|
171
|
+
|
172
|
+
<li><a href="#M000048">iterative_fact</a>,</li>
|
173
|
+
|
174
|
+
<li><a href="#M000060">iterative_fact</a>,</li>
|
175
|
+
|
176
|
+
<li><a href="#M000025">iterative_fact</a>,</li>
|
177
|
+
|
178
|
+
<li><a href="#M000002">iterative_fact</a></li>
|
179
|
+
|
180
|
+
</ul>
|
181
|
+
</dd>
|
182
|
+
|
183
|
+
<dt>P</dt>
|
184
|
+
<dd>
|
185
|
+
<ul>
|
186
|
+
|
187
|
+
<li><a href="#M000056">print_row</a>,</li>
|
188
|
+
|
189
|
+
<li><a href="#M000033">print_row</a>,</li>
|
190
|
+
|
191
|
+
<li><a href="#M000073">print_row</a>,</li>
|
192
|
+
|
193
|
+
<li><a href="#M000016">print_row</a></li>
|
194
|
+
|
195
|
+
</ul>
|
196
|
+
</dd>
|
197
|
+
|
198
|
+
<dt>S</dt>
|
199
|
+
<dd>
|
200
|
+
<ul>
|
201
|
+
|
202
|
+
<li><a href="#M000067">sigma</a>,</li>
|
203
|
+
|
204
|
+
<li><a href="#M000051">sigma</a>,</li>
|
205
|
+
|
206
|
+
<li><a href="#M000010">sigma</a>,</li>
|
207
|
+
|
208
|
+
<li><a href="#M000028">sigma</a>,</li>
|
209
|
+
|
210
|
+
<li><a href="#M000011">stirling</a>,</li>
|
211
|
+
|
212
|
+
<li><a href="#M000069">stirling</a>,</li>
|
213
|
+
|
214
|
+
<li><a href="#M000052">stirling</a>,</li>
|
215
|
+
|
216
|
+
<li><a href="#M000029">stirling</a>,</li>
|
217
|
+
|
218
|
+
<li><a href="#M000085">stirling</a>,</li>
|
219
|
+
|
220
|
+
<li><a href="#M000049">subset</a>,</li>
|
221
|
+
|
222
|
+
<li><a href="#M000026">subset</a>,</li>
|
223
|
+
|
224
|
+
<li><a href="#M000008">subset</a>,</li>
|
225
|
+
|
226
|
+
<li><a href="#M000061">subset</a>,</li>
|
227
|
+
|
228
|
+
<li><a href="#M000077">sum_of_fib</a>,</li>
|
229
|
+
|
230
|
+
<li><a href="#M000020">sum_of_fib</a>,</li>
|
231
|
+
|
232
|
+
<li><a href="#M000037">sum_of_fib</a>,</li>
|
233
|
+
|
234
|
+
<li><a href="#M000064">sum_of_fib</a></li>
|
235
|
+
|
236
|
+
</ul>
|
237
|
+
</dd>
|
238
|
+
|
239
|
+
<dt>T</dt>
|
240
|
+
<dd>
|
241
|
+
<ul>
|
242
|
+
|
243
|
+
<li><a href="#M000040">to_bool</a>,</li>
|
244
|
+
|
245
|
+
<li><a href="#M000070">twin_prdx</a>,</li>
|
246
|
+
|
247
|
+
<li><a href="#M000053">twin_prdx</a>,</li>
|
248
|
+
|
249
|
+
<li><a href="#M000012">twin_prdx</a>,</li>
|
250
|
+
|
251
|
+
<li><a href="#M000030">twin_prdx</a></li>
|
252
|
+
|
253
|
+
</ul>
|
254
|
+
</dd>
|
255
|
+
|
256
|
+
<dt>U</dt>
|
257
|
+
<dd>
|
258
|
+
<ul>
|
259
|
+
|
260
|
+
<li><a href="#M000047">ui_pow</a>,</li>
|
261
|
+
|
262
|
+
<li><a href="#M000024">ui_pow</a>,</li>
|
263
|
+
|
264
|
+
<li><a href="#M000001">ui_pow</a>,</li>
|
265
|
+
|
266
|
+
<li><a href="#M000058">ui_pow</a></li>
|
267
|
+
|
268
|
+
</ul>
|
269
|
+
</dd>
|
270
|
+
|
271
|
+
</dl>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<div class="sectiontitle">Instance Public methods</div>
|
286
|
+
|
287
|
+
<div class="method">
|
288
|
+
<div class="title" id="M000017">
|
289
|
+
|
290
|
+
<a name="M000017"></a><b>binary_search</b>(binary, size, searchKey, low, middle, high)
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
<div class="sourcecode">
|
298
|
+
<p class="source-link">
|
299
|
+
Source: <a href="javascript:toggleSource('M000017_source')" id="l_M000017_source">show</a>
|
300
|
+
|
301
|
+
</p>
|
302
|
+
<div id="M000017_source" class="dyn-source">
|
303
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 302</span>
|
304
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">binary_search</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">searchKey</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">high</span>)
|
305
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">low</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">high</span>)
|
306
|
+
<span class="ruby-identifier">middle</span>=(<span class="ruby-identifier">low</span><span class="ruby-operator">+</span><span class="ruby-identifier">high</span>)<span class="ruby-operator">/</span><span class="ruby-value">2</span>;
|
307
|
+
<span class="ruby-identifier">print_row</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">high</span>);
|
308
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">searchKey</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">middle</span>])
|
309
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">middle</span>;
|
310
|
+
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">searchKey</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">middle</span>])
|
311
|
+
<span class="ruby-identifier">high</span>=<span class="ruby-identifier">middle</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
312
|
+
<span class="ruby-keyword kw">else</span>
|
313
|
+
<span class="ruby-identifier">low</span>=<span class="ruby-identifier">middle</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>
|
314
|
+
<span class="ruby-keyword kw">end</span>
|
315
|
+
<span class="ruby-keyword kw">end</span>
|
316
|
+
<span class="ruby-keyword kw">end</span></pre>
|
317
|
+
</div>
|
318
|
+
</div>
|
319
|
+
|
320
|
+
</div>
|
321
|
+
|
322
|
+
<div class="method">
|
323
|
+
<div class="title" id="M000074">
|
324
|
+
|
325
|
+
<a name="M000074"></a><b>binary_search</b>(binary, size, searchKey, low, middle, high)
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
<div class="sourcecode">
|
333
|
+
<p class="source-link">
|
334
|
+
Source: <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show</a>
|
335
|
+
|
336
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L302" target="_blank" class="github_url">on GitHub</a>
|
337
|
+
|
338
|
+
</p>
|
339
|
+
<div id="M000074_source" class="dyn-source">
|
340
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 302</span>
|
341
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">binary_search</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">searchKey</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">high</span>)
|
342
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">low</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">high</span>)
|
343
|
+
<span class="ruby-identifier">middle</span>=(<span class="ruby-identifier">low</span><span class="ruby-operator">+</span><span class="ruby-identifier">high</span>)<span class="ruby-operator">/</span><span class="ruby-value">2</span>;
|
344
|
+
<span class="ruby-identifier">print_row</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">high</span>);
|
345
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">searchKey</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">middle</span>])
|
346
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">middle</span>;
|
347
|
+
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">searchKey</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">middle</span>])
|
348
|
+
<span class="ruby-identifier">high</span>=<span class="ruby-identifier">middle</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
349
|
+
<span class="ruby-keyword kw">else</span>
|
350
|
+
<span class="ruby-identifier">low</span>=<span class="ruby-identifier">middle</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>
|
351
|
+
<span class="ruby-keyword kw">end</span>
|
352
|
+
<span class="ruby-keyword kw">end</span>
|
353
|
+
<span class="ruby-keyword kw">end</span></pre>
|
354
|
+
</div>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div class="method">
|
360
|
+
<div class="title" id="M000059">
|
361
|
+
|
362
|
+
<a name="M000059"></a><b>binary_search</b>(binary, size, searchKey, low, middle, high)
|
363
|
+
|
364
|
+
</div>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
<div class="sourcecode">
|
370
|
+
<p class="source-link">
|
371
|
+
Source: <a href="javascript:toggleSource('M000059_source')" id="l_M000059_source">show</a>
|
372
|
+
|
373
|
+
</p>
|
374
|
+
<div id="M000059_source" class="dyn-source">
|
375
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 302</span>
|
376
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">binary_search</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">searchKey</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">high</span>)
|
377
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">low</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">high</span>)
|
378
|
+
<span class="ruby-identifier">middle</span>=(<span class="ruby-identifier">low</span><span class="ruby-operator">+</span><span class="ruby-identifier">high</span>)<span class="ruby-operator">/</span><span class="ruby-value">2</span>;
|
379
|
+
<span class="ruby-identifier">print_row</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">high</span>);
|
380
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">searchKey</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">middle</span>])
|
381
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">middle</span>;
|
382
|
+
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">searchKey</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">middle</span>])
|
383
|
+
<span class="ruby-identifier">high</span>=<span class="ruby-identifier">middle</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
384
|
+
<span class="ruby-keyword kw">else</span>
|
385
|
+
<span class="ruby-identifier">low</span>=<span class="ruby-identifier">middle</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>
|
386
|
+
<span class="ruby-keyword kw">end</span>
|
387
|
+
<span class="ruby-keyword kw">end</span>
|
388
|
+
<span class="ruby-keyword kw">end</span></pre>
|
389
|
+
</div>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
</div>
|
393
|
+
|
394
|
+
<div class="method">
|
395
|
+
<div class="title" id="M000034">
|
396
|
+
|
397
|
+
<a name="M000034"></a><b>binary_search</b>(binary, size, search_key, low, middle, high)
|
398
|
+
|
399
|
+
</div>
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
<div class="sourcecode">
|
405
|
+
<p class="source-link">
|
406
|
+
Source: <a href="javascript:toggleSource('M000034_source')" id="l_M000034_source">show</a>
|
407
|
+
|
408
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L301" target="_blank" class="github_url">on GitHub</a>
|
409
|
+
|
410
|
+
</p>
|
411
|
+
<div id="M000034_source" class="dyn-source">
|
412
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 301</span>
|
413
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">binary_search</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">search_key</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">high</span>)
|
414
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">low</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">high</span>)
|
415
|
+
<span class="ruby-identifier">middle</span>=(<span class="ruby-identifier">low</span><span class="ruby-operator">+</span><span class="ruby-identifier">high</span>)<span class="ruby-operator">/</span><span class="ruby-value">2</span>;
|
416
|
+
<span class="ruby-identifier">print_row</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">high</span>);
|
417
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">search_key</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">middle</span>])
|
418
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">middle</span>;
|
419
|
+
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">search_key</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">middle</span>])
|
420
|
+
<span class="ruby-identifier">high</span>=<span class="ruby-identifier">middle</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
421
|
+
<span class="ruby-keyword kw">else</span>
|
422
|
+
<span class="ruby-identifier">low</span>=<span class="ruby-identifier">middle</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>
|
423
|
+
<span class="ruby-keyword kw">end</span>
|
424
|
+
<span class="ruby-keyword kw">end</span>
|
425
|
+
<span class="ruby-keyword kw">end</span></pre>
|
426
|
+
</div>
|
427
|
+
</div>
|
428
|
+
|
429
|
+
</div>
|
430
|
+
|
431
|
+
<div class="method">
|
432
|
+
<div class="title" id="M000035">
|
433
|
+
|
434
|
+
<a name="M000035"></a><b>birds_eye</b>(n, k)
|
435
|
+
|
436
|
+
</div>
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
<div class="sourcecode">
|
442
|
+
<p class="source-link">
|
443
|
+
Source: <a href="javascript:toggleSource('M000035_source')" id="l_M000035_source">show</a>
|
444
|
+
|
445
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L325" target="_blank" class="github_url">on GitHub</a>
|
446
|
+
|
447
|
+
</p>
|
448
|
+
<div id="M000035_source" class="dyn-source">
|
449
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 325</span>
|
450
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">birds_eye</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
|
451
|
+
<span class="ruby-keyword kw">return</span> ((<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-identifier">k</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">k</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>));
|
452
|
+
<span class="ruby-keyword kw">end</span></pre>
|
453
|
+
</div>
|
454
|
+
</div>
|
455
|
+
|
456
|
+
</div>
|
457
|
+
|
458
|
+
<div class="method">
|
459
|
+
<div class="title" id="M000062">
|
460
|
+
|
461
|
+
<a name="M000062"></a><b>birds_eye</b>(n, k)
|
462
|
+
|
463
|
+
</div>
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
<div class="sourcecode">
|
469
|
+
<p class="source-link">
|
470
|
+
Source: <a href="javascript:toggleSource('M000062_source')" id="l_M000062_source">show</a>
|
471
|
+
|
472
|
+
</p>
|
473
|
+
<div id="M000062_source" class="dyn-source">
|
474
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 326</span>
|
475
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">birds_eye</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
|
476
|
+
<span class="ruby-keyword kw">return</span> ((<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-identifier">k</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">k</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>));
|
477
|
+
<span class="ruby-keyword kw">end</span></pre>
|
478
|
+
</div>
|
479
|
+
</div>
|
480
|
+
|
481
|
+
</div>
|
482
|
+
|
483
|
+
<div class="method">
|
484
|
+
<div class="title" id="M000075">
|
485
|
+
|
486
|
+
<a name="M000075"></a><b>birds_eye</b>(n, k)
|
487
|
+
|
488
|
+
</div>
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
<div class="sourcecode">
|
494
|
+
<p class="source-link">
|
495
|
+
Source: <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">show</a>
|
496
|
+
|
497
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L326" target="_blank" class="github_url">on GitHub</a>
|
498
|
+
|
499
|
+
</p>
|
500
|
+
<div id="M000075_source" class="dyn-source">
|
501
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 326</span>
|
502
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">birds_eye</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
|
503
|
+
<span class="ruby-keyword kw">return</span> ((<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-identifier">k</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">k</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>));
|
504
|
+
<span class="ruby-keyword kw">end</span></pre>
|
505
|
+
</div>
|
506
|
+
</div>
|
507
|
+
|
508
|
+
</div>
|
509
|
+
|
510
|
+
<div class="method">
|
511
|
+
<div class="title" id="M000018">
|
512
|
+
|
513
|
+
<a name="M000018"></a><b>birds_eye</b>(n, k)
|
514
|
+
|
515
|
+
</div>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
<div class="sourcecode">
|
521
|
+
<p class="source-link">
|
522
|
+
Source: <a href="javascript:toggleSource('M000018_source')" id="l_M000018_source">show</a>
|
523
|
+
|
524
|
+
</p>
|
525
|
+
<div id="M000018_source" class="dyn-source">
|
526
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 326</span>
|
527
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">birds_eye</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
|
528
|
+
<span class="ruby-keyword kw">return</span> ((<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-identifier">k</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">k</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>));
|
529
|
+
<span class="ruby-keyword kw">end</span></pre>
|
530
|
+
</div>
|
531
|
+
</div>
|
532
|
+
|
533
|
+
</div>
|
534
|
+
|
535
|
+
<div class="method">
|
536
|
+
<div class="title" id="M000066">
|
537
|
+
|
538
|
+
<a name="M000066"></a><b>combinatorial</b>(glb, ksb)
|
539
|
+
|
540
|
+
</div>
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
<div class="sourcecode">
|
546
|
+
<p class="source-link">
|
547
|
+
Source: <a href="javascript:toggleSource('M000066_source')" id="l_M000066_source">show</a>
|
548
|
+
|
549
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L145" target="_blank" class="github_url">on GitHub</a>
|
550
|
+
|
551
|
+
</p>
|
552
|
+
<div id="M000066_source" class="dyn-source">
|
553
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 145</span>
|
554
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">combinatorial</span>(<span class="ruby-identifier">glb</span>, <span class="ruby-identifier">ksb</span>)
|
555
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">glb</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">ksb</span>)
|
556
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"Global set cannot be greater than k-subsets"</span>)
|
557
|
+
<span class="ruby-keyword kw">end</span>
|
558
|
+
<span class="ruby-identifier">sbst_given_size</span> = <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">glb</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">ksb</span>)<span class="ruby-operator">*</span><span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">glb</span><span class="ruby-operator">-</span><span class="ruby-identifier">ksb</span>)).<span class="ruby-identifier">to_f</span>
|
559
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sbst_given_size</span>
|
560
|
+
<span class="ruby-keyword kw">end</span></pre>
|
561
|
+
</div>
|
562
|
+
</div>
|
563
|
+
|
564
|
+
</div>
|
565
|
+
|
566
|
+
<div class="method">
|
567
|
+
<div class="title" id="M000027">
|
568
|
+
|
569
|
+
<a name="M000027"></a><b>combinatorial</b>(glb, ksb)
|
570
|
+
|
571
|
+
</div>
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
<div class="sourcecode">
|
577
|
+
<p class="source-link">
|
578
|
+
Source: <a href="javascript:toggleSource('M000027_source')" id="l_M000027_source">show</a>
|
579
|
+
|
580
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L144" target="_blank" class="github_url">on GitHub</a>
|
581
|
+
|
582
|
+
</p>
|
583
|
+
<div id="M000027_source" class="dyn-source">
|
584
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 144</span>
|
585
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">combinatorial</span>(<span class="ruby-identifier">glb</span>, <span class="ruby-identifier">ksb</span>)
|
586
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">glb</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">ksb</span>)
|
587
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"Global set cannot be greater than k-subsets"</span>)
|
588
|
+
<span class="ruby-keyword kw">end</span>
|
589
|
+
<span class="ruby-identifier">sbst_given_size</span> = <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">glb</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">ksb</span>)<span class="ruby-operator">*</span><span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">glb</span><span class="ruby-operator">-</span><span class="ruby-identifier">ksb</span>)).<span class="ruby-identifier">to_f</span>
|
590
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sbst_given_size</span>
|
591
|
+
<span class="ruby-keyword kw">end</span></pre>
|
592
|
+
</div>
|
593
|
+
</div>
|
594
|
+
|
595
|
+
</div>
|
596
|
+
|
597
|
+
<div class="method">
|
598
|
+
<div class="title" id="M000009">
|
599
|
+
|
600
|
+
<a name="M000009"></a><b>combinatorial</b>(glb, ksb)
|
601
|
+
|
602
|
+
</div>
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
<div class="sourcecode">
|
608
|
+
<p class="source-link">
|
609
|
+
Source: <a href="javascript:toggleSource('M000009_source')" id="l_M000009_source">show</a>
|
610
|
+
|
611
|
+
</p>
|
612
|
+
<div id="M000009_source" class="dyn-source">
|
613
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 145</span>
|
614
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">combinatorial</span>(<span class="ruby-identifier">glb</span>, <span class="ruby-identifier">ksb</span>)
|
615
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">glb</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">ksb</span>)
|
616
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"Global set cannot be greater than k-subsets"</span>)
|
617
|
+
<span class="ruby-keyword kw">end</span>
|
618
|
+
<span class="ruby-identifier">sbst_given_size</span> = <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">glb</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">ksb</span>)<span class="ruby-operator">*</span><span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">glb</span><span class="ruby-operator">-</span><span class="ruby-identifier">ksb</span>)).<span class="ruby-identifier">to_f</span>
|
619
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sbst_given_size</span>
|
620
|
+
<span class="ruby-keyword kw">end</span></pre>
|
621
|
+
</div>
|
622
|
+
</div>
|
623
|
+
|
624
|
+
</div>
|
625
|
+
|
626
|
+
<div class="method">
|
627
|
+
<div class="title" id="M000050">
|
628
|
+
|
629
|
+
<a name="M000050"></a><b>combinatorial</b>(glb, ksb)
|
630
|
+
|
631
|
+
</div>
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
<div class="sourcecode">
|
637
|
+
<p class="source-link">
|
638
|
+
Source: <a href="javascript:toggleSource('M000050_source')" id="l_M000050_source">show</a>
|
639
|
+
|
640
|
+
</p>
|
641
|
+
<div id="M000050_source" class="dyn-source">
|
642
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 145</span>
|
643
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">combinatorial</span>(<span class="ruby-identifier">glb</span>, <span class="ruby-identifier">ksb</span>)
|
644
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">glb</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">ksb</span>)
|
645
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"Global set cannot be greater than k-subsets"</span>)
|
646
|
+
<span class="ruby-keyword kw">end</span>
|
647
|
+
<span class="ruby-identifier">sbst_given_size</span> = <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">glb</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">ksb</span>)<span class="ruby-operator">*</span><span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">glb</span><span class="ruby-operator">-</span><span class="ruby-identifier">ksb</span>)).<span class="ruby-identifier">to_f</span>
|
648
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sbst_given_size</span>
|
649
|
+
<span class="ruby-keyword kw">end</span></pre>
|
650
|
+
</div>
|
651
|
+
</div>
|
652
|
+
|
653
|
+
</div>
|
654
|
+
|
655
|
+
<div class="method">
|
656
|
+
<div class="title" id="M000080">
|
657
|
+
|
658
|
+
<a name="M000080"></a><b>commfail</b>()
|
659
|
+
|
660
|
+
</div>
|
661
|
+
|
662
|
+
|
663
|
+
|
664
|
+
|
665
|
+
<div class="sourcecode">
|
666
|
+
<p class="source-link">
|
667
|
+
Source: <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">show</a>
|
668
|
+
|
669
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/main.rb#L20" target="_blank" class="github_url">on GitHub</a>
|
670
|
+
|
671
|
+
</p>
|
672
|
+
<div id="M000080_source" class="dyn-source">
|
673
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/main.rb, line 20</span>
|
674
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">commfail</span>
|
675
|
+
<span class="ruby-comment cmt"># Raise exceptions from fail situation and gives new command_line</span>
|
676
|
+
<span class="ruby-keyword kw">end</span></pre>
|
677
|
+
</div>
|
678
|
+
</div>
|
679
|
+
|
680
|
+
</div>
|
681
|
+
|
682
|
+
<div class="method">
|
683
|
+
<div class="title" id="M000079">
|
684
|
+
|
685
|
+
<a name="M000079"></a><b>commsuccss</b>()
|
686
|
+
|
687
|
+
</div>
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
<div class="sourcecode">
|
693
|
+
<p class="source-link">
|
694
|
+
Source: <a href="javascript:toggleSource('M000079_source')" id="l_M000079_source">show</a>
|
695
|
+
|
696
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/main.rb#L16" target="_blank" class="github_url">on GitHub</a>
|
697
|
+
|
698
|
+
</p>
|
699
|
+
<div id="M000079_source" class="dyn-source">
|
700
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/main.rb, line 16</span>
|
701
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">commsuccss</span>
|
702
|
+
<span class="ruby-comment cmt"># Return success statement and new command_line</span>
|
703
|
+
<span class="ruby-keyword kw">end</span></pre>
|
704
|
+
</div>
|
705
|
+
</div>
|
706
|
+
|
707
|
+
</div>
|
708
|
+
|
709
|
+
<div class="method">
|
710
|
+
<div class="title" id="M000054">
|
711
|
+
|
712
|
+
<a name="M000054"></a><b>dist_pres</b>(presnum)
|
713
|
+
|
714
|
+
</div>
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
<div class="sourcecode">
|
720
|
+
<p class="source-link">
|
721
|
+
Source: <a href="javascript:toggleSource('M000054_source')" id="l_M000054_source">show</a>
|
722
|
+
|
723
|
+
</p>
|
724
|
+
<div id="M000054_source" class="dyn-source">
|
725
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 232</span>
|
726
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dist_pres</span>(<span class="ruby-identifier">presnum</span>)
|
727
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">presnum</span>)<span class="ruby-operator">/</span><span class="ruby-identifier">iterative_fact</span>(<span class="ruby-identifier">presnum</span>);
|
728
|
+
<span class="ruby-keyword kw">end</span></pre>
|
729
|
+
</div>
|
730
|
+
</div>
|
731
|
+
|
732
|
+
</div>
|
733
|
+
|
734
|
+
<div class="method">
|
735
|
+
<div class="title" id="M000071">
|
736
|
+
|
737
|
+
<a name="M000071"></a><b>dist_pres</b>(presnum)
|
738
|
+
|
739
|
+
</div>
|
740
|
+
|
741
|
+
|
742
|
+
|
743
|
+
|
744
|
+
<div class="sourcecode">
|
745
|
+
<p class="source-link">
|
746
|
+
Source: <a href="javascript:toggleSource('M000071_source')" id="l_M000071_source">show</a>
|
747
|
+
|
748
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L232" target="_blank" class="github_url">on GitHub</a>
|
749
|
+
|
750
|
+
</p>
|
751
|
+
<div id="M000071_source" class="dyn-source">
|
752
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 232</span>
|
753
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dist_pres</span>(<span class="ruby-identifier">presnum</span>)
|
754
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">presnum</span>)<span class="ruby-operator">/</span><span class="ruby-identifier">iterative_fact</span>(<span class="ruby-identifier">presnum</span>);
|
755
|
+
<span class="ruby-keyword kw">end</span></pre>
|
756
|
+
</div>
|
757
|
+
</div>
|
758
|
+
|
759
|
+
</div>
|
760
|
+
|
761
|
+
<div class="method">
|
762
|
+
<div class="title" id="M000013">
|
763
|
+
|
764
|
+
<a name="M000013"></a><b>dist_pres</b>(presnum)
|
765
|
+
|
766
|
+
</div>
|
767
|
+
|
768
|
+
|
769
|
+
|
770
|
+
|
771
|
+
<div class="sourcecode">
|
772
|
+
<p class="source-link">
|
773
|
+
Source: <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show</a>
|
774
|
+
|
775
|
+
</p>
|
776
|
+
<div id="M000013_source" class="dyn-source">
|
777
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 232</span>
|
778
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dist_pres</span>(<span class="ruby-identifier">presnum</span>)
|
779
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">presnum</span>)<span class="ruby-operator">/</span><span class="ruby-identifier">iterative_fact</span>(<span class="ruby-identifier">presnum</span>);
|
780
|
+
<span class="ruby-keyword kw">end</span></pre>
|
781
|
+
</div>
|
782
|
+
</div>
|
783
|
+
|
784
|
+
</div>
|
785
|
+
|
786
|
+
<div class="method">
|
787
|
+
<div class="title" id="M000031">
|
788
|
+
|
789
|
+
<a name="M000031"></a><b>dist_pres</b>(presnum)
|
790
|
+
|
791
|
+
</div>
|
792
|
+
|
793
|
+
|
794
|
+
|
795
|
+
|
796
|
+
<div class="sourcecode">
|
797
|
+
<p class="source-link">
|
798
|
+
Source: <a href="javascript:toggleSource('M000031_source')" id="l_M000031_source">show</a>
|
799
|
+
|
800
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L231" target="_blank" class="github_url">on GitHub</a>
|
801
|
+
|
802
|
+
</p>
|
803
|
+
<div id="M000031_source" class="dyn-source">
|
804
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 231</span>
|
805
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dist_pres</span>(<span class="ruby-identifier">presnum</span>)
|
806
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">presnum</span>)<span class="ruby-operator">/</span><span class="ruby-identifier">iterative_fact</span>(<span class="ruby-identifier">presnum</span>);
|
807
|
+
<span class="ruby-keyword kw">end</span></pre>
|
808
|
+
</div>
|
809
|
+
</div>
|
810
|
+
|
811
|
+
</div>
|
812
|
+
|
813
|
+
<div class="method">
|
814
|
+
<div class="title" id="M000019">
|
815
|
+
|
816
|
+
<a name="M000019"></a><b>eagle_view</b>(m, t)
|
817
|
+
|
818
|
+
</div>
|
819
|
+
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
<div class="sourcecode">
|
824
|
+
<p class="source-link">
|
825
|
+
Source: <a href="javascript:toggleSource('M000019_source')" id="l_M000019_source">show</a>
|
826
|
+
|
827
|
+
</p>
|
828
|
+
<div id="M000019_source" class="dyn-source">
|
829
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 340</span>
|
830
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eagle_view</span>(<span class="ruby-identifier">m</span>, <span class="ruby-identifier">t</span>)
|
831
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span>((<span class="ruby-identifier">t</span><span class="ruby-operator">*</span><span class="ruby-identifier">t</span>)<span class="ruby-operator">/</span><span class="ruby-identifier">m</span>));
|
832
|
+
<span class="ruby-keyword kw">end</span></pre>
|
833
|
+
</div>
|
834
|
+
</div>
|
835
|
+
|
836
|
+
</div>
|
837
|
+
|
838
|
+
<div class="method">
|
839
|
+
<div class="title" id="M000063">
|
840
|
+
|
841
|
+
<a name="M000063"></a><b>eagle_view</b>(m, t)
|
842
|
+
|
843
|
+
</div>
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
|
848
|
+
<div class="sourcecode">
|
849
|
+
<p class="source-link">
|
850
|
+
Source: <a href="javascript:toggleSource('M000063_source')" id="l_M000063_source">show</a>
|
851
|
+
|
852
|
+
</p>
|
853
|
+
<div id="M000063_source" class="dyn-source">
|
854
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 340</span>
|
855
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eagle_view</span>(<span class="ruby-identifier">m</span>, <span class="ruby-identifier">t</span>)
|
856
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span>((<span class="ruby-identifier">t</span><span class="ruby-operator">*</span><span class="ruby-identifier">t</span>)<span class="ruby-operator">/</span><span class="ruby-identifier">m</span>));
|
857
|
+
<span class="ruby-keyword kw">end</span></pre>
|
858
|
+
</div>
|
859
|
+
</div>
|
860
|
+
|
861
|
+
</div>
|
862
|
+
|
863
|
+
<div class="method">
|
864
|
+
<div class="title" id="M000076">
|
865
|
+
|
866
|
+
<a name="M000076"></a><b>eagle_view</b>(m, t)
|
867
|
+
|
868
|
+
</div>
|
869
|
+
|
870
|
+
|
871
|
+
|
872
|
+
|
873
|
+
<div class="sourcecode">
|
874
|
+
<p class="source-link">
|
875
|
+
Source: <a href="javascript:toggleSource('M000076_source')" id="l_M000076_source">show</a>
|
876
|
+
|
877
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L340" target="_blank" class="github_url">on GitHub</a>
|
878
|
+
|
879
|
+
</p>
|
880
|
+
<div id="M000076_source" class="dyn-source">
|
881
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 340</span>
|
882
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eagle_view</span>(<span class="ruby-identifier">m</span>, <span class="ruby-identifier">t</span>)
|
883
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span>((<span class="ruby-identifier">t</span><span class="ruby-operator">*</span><span class="ruby-identifier">t</span>)<span class="ruby-operator">/</span><span class="ruby-identifier">m</span>));
|
884
|
+
<span class="ruby-keyword kw">end</span></pre>
|
885
|
+
</div>
|
886
|
+
</div>
|
887
|
+
|
888
|
+
</div>
|
889
|
+
|
890
|
+
<div class="method">
|
891
|
+
<div class="title" id="M000036">
|
892
|
+
|
893
|
+
<a name="M000036"></a><b>eagle_view</b>(m, t)
|
894
|
+
|
895
|
+
</div>
|
896
|
+
|
897
|
+
|
898
|
+
|
899
|
+
|
900
|
+
<div class="sourcecode">
|
901
|
+
<p class="source-link">
|
902
|
+
Source: <a href="javascript:toggleSource('M000036_source')" id="l_M000036_source">show</a>
|
903
|
+
|
904
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L339" target="_blank" class="github_url">on GitHub</a>
|
905
|
+
|
906
|
+
</p>
|
907
|
+
<div id="M000036_source" class="dyn-source">
|
908
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 339</span>
|
909
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eagle_view</span>(<span class="ruby-identifier">m</span>, <span class="ruby-identifier">t</span>)
|
910
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span>((<span class="ruby-identifier">t</span><span class="ruby-operator">*</span><span class="ruby-identifier">t</span>)<span class="ruby-operator">/</span><span class="ruby-identifier">m</span>));
|
911
|
+
<span class="ruby-keyword kw">end</span></pre>
|
912
|
+
</div>
|
913
|
+
</div>
|
914
|
+
|
915
|
+
</div>
|
916
|
+
|
917
|
+
<div class="method">
|
918
|
+
<div class="title" id="M000057">
|
919
|
+
|
920
|
+
<a name="M000057"></a><b>factorial</b>( n )
|
921
|
+
|
922
|
+
</div>
|
923
|
+
|
924
|
+
|
925
|
+
|
926
|
+
|
927
|
+
<div class="sourcecode">
|
928
|
+
<p class="source-link">
|
929
|
+
Source: <a href="javascript:toggleSource('M000057_source')" id="l_M000057_source">show</a>
|
930
|
+
|
931
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L22" target="_blank" class="github_url">on GitHub</a>
|
932
|
+
|
933
|
+
</p>
|
934
|
+
<div id="M000057_source" class="dyn-source">
|
935
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 22</span>
|
936
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">factorial</span>( <span class="ruby-identifier">n</span> )
|
937
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
|
938
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
939
|
+
<span class="ruby-keyword kw">else</span>
|
940
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">n</span><span class="ruby-operator">*</span><span class="ruby-identifier">factorial</span>( <span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> ).<span class="ruby-identifier">to_i</span>
|
941
|
+
<span class="ruby-keyword kw">end</span>
|
942
|
+
<span class="ruby-keyword kw">end</span></pre>
|
943
|
+
</div>
|
944
|
+
</div>
|
945
|
+
|
946
|
+
</div>
|
947
|
+
|
948
|
+
<div class="method">
|
949
|
+
<div class="title" id="M000046">
|
950
|
+
|
951
|
+
<a name="M000046"></a><b>factorial</b>( n )
|
952
|
+
|
953
|
+
</div>
|
954
|
+
|
955
|
+
|
956
|
+
|
957
|
+
|
958
|
+
<div class="sourcecode">
|
959
|
+
<p class="source-link">
|
960
|
+
Source: <a href="javascript:toggleSource('M000046_source')" id="l_M000046_source">show</a>
|
961
|
+
|
962
|
+
</p>
|
963
|
+
<div id="M000046_source" class="dyn-source">
|
964
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 22</span>
|
965
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">factorial</span>( <span class="ruby-identifier">n</span> )
|
966
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
|
967
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
968
|
+
<span class="ruby-keyword kw">else</span>
|
969
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">n</span><span class="ruby-operator">*</span><span class="ruby-identifier">factorial</span>( <span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> ).<span class="ruby-identifier">to_i</span>
|
970
|
+
<span class="ruby-keyword kw">end</span>
|
971
|
+
<span class="ruby-keyword kw">end</span></pre>
|
972
|
+
</div>
|
973
|
+
</div>
|
974
|
+
|
975
|
+
</div>
|
976
|
+
|
977
|
+
<div class="method">
|
978
|
+
<div class="title" id="M000023">
|
979
|
+
|
980
|
+
<a name="M000023"></a><b>factorial</b>( n )
|
981
|
+
|
982
|
+
</div>
|
983
|
+
|
984
|
+
|
985
|
+
|
986
|
+
|
987
|
+
<div class="sourcecode">
|
988
|
+
<p class="source-link">
|
989
|
+
Source: <a href="javascript:toggleSource('M000023_source')" id="l_M000023_source">show</a>
|
990
|
+
|
991
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L23" target="_blank" class="github_url">on GitHub</a>
|
992
|
+
|
993
|
+
</p>
|
994
|
+
<div id="M000023_source" class="dyn-source">
|
995
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 23</span>
|
996
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">factorial</span>( <span class="ruby-identifier">n</span> )
|
997
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">n</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>)
|
998
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
999
|
+
<span class="ruby-keyword kw">else</span>
|
1000
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">n</span><span class="ruby-operator">*</span><span class="ruby-identifier">factorial</span>( <span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> ).<span class="ruby-identifier">to_i</span>
|
1001
|
+
<span class="ruby-keyword kw">end</span>
|
1002
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1003
|
+
</div>
|
1004
|
+
</div>
|
1005
|
+
|
1006
|
+
</div>
|
1007
|
+
|
1008
|
+
<div class="method">
|
1009
|
+
<div class="title" id="M000000">
|
1010
|
+
|
1011
|
+
<a name="M000000"></a><b>factorial</b>( n )
|
1012
|
+
|
1013
|
+
</div>
|
1014
|
+
|
1015
|
+
|
1016
|
+
|
1017
|
+
|
1018
|
+
<div class="sourcecode">
|
1019
|
+
<p class="source-link">
|
1020
|
+
Source: <a href="javascript:toggleSource('M000000_source')" id="l_M000000_source">show</a>
|
1021
|
+
|
1022
|
+
</p>
|
1023
|
+
<div id="M000000_source" class="dyn-source">
|
1024
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 22</span>
|
1025
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">factorial</span>( <span class="ruby-identifier">n</span> )
|
1026
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
|
1027
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1028
|
+
<span class="ruby-keyword kw">else</span>
|
1029
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">n</span><span class="ruby-operator">*</span><span class="ruby-identifier">factorial</span>( <span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> ).<span class="ruby-identifier">to_i</span>
|
1030
|
+
<span class="ruby-keyword kw">end</span>
|
1031
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1032
|
+
</div>
|
1033
|
+
</div>
|
1034
|
+
|
1035
|
+
</div>
|
1036
|
+
|
1037
|
+
<div class="method">
|
1038
|
+
<div class="title" id="M000068">
|
1039
|
+
|
1040
|
+
<a name="M000068"></a><b>fermat_little</b>(p, a)
|
1041
|
+
|
1042
|
+
</div>
|
1043
|
+
|
1044
|
+
|
1045
|
+
|
1046
|
+
|
1047
|
+
<div class="sourcecode">
|
1048
|
+
<p class="source-link">
|
1049
|
+
Source: <a href="javascript:toggleSource('M000068_source')" id="l_M000068_source">show</a>
|
1050
|
+
|
1051
|
+
</p>
|
1052
|
+
<div id="M000068_source" class="dyn-source">
|
1053
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 406</span>
|
1054
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fermat_little</span>(<span class="ruby-identifier">p</span>, <span class="ruby-identifier">a</span>)
|
1055
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">p</span><span class="ruby-operator">%</span>(<span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">a</span>, (<span class="ruby-identifier">p</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>))<span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1056
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1057
|
+
<span class="ruby-keyword kw">elsif</span>
|
1058
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1059
|
+
<span class="ruby-keyword kw">end</span>
|
1060
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1061
|
+
</div>
|
1062
|
+
</div>
|
1063
|
+
|
1064
|
+
</div>
|
1065
|
+
|
1066
|
+
<div class="method">
|
1067
|
+
<div class="title" id="M000083">
|
1068
|
+
|
1069
|
+
<a name="M000083"></a><b>fermat_little</b>(p, a)
|
1070
|
+
|
1071
|
+
</div>
|
1072
|
+
|
1073
|
+
|
1074
|
+
|
1075
|
+
|
1076
|
+
<div class="sourcecode">
|
1077
|
+
<p class="source-link">
|
1078
|
+
Source: <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">show</a>
|
1079
|
+
|
1080
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L406" target="_blank" class="github_url">on GitHub</a>
|
1081
|
+
|
1082
|
+
</p>
|
1083
|
+
<div id="M000083_source" class="dyn-source">
|
1084
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 406</span>
|
1085
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fermat_little</span>(<span class="ruby-identifier">p</span>, <span class="ruby-identifier">a</span>)
|
1086
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">p</span><span class="ruby-operator">%</span>(<span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">a</span>, (<span class="ruby-identifier">p</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>))<span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1087
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1088
|
+
<span class="ruby-keyword kw">elsif</span>
|
1089
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1090
|
+
<span class="ruby-keyword kw">end</span>
|
1091
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1092
|
+
</div>
|
1093
|
+
</div>
|
1094
|
+
|
1095
|
+
</div>
|
1096
|
+
|
1097
|
+
<div class="method">
|
1098
|
+
<div class="title" id="M000022">
|
1099
|
+
|
1100
|
+
<a name="M000022"></a><b>fermat_little</b>(p, a)
|
1101
|
+
|
1102
|
+
</div>
|
1103
|
+
|
1104
|
+
|
1105
|
+
|
1106
|
+
|
1107
|
+
<div class="sourcecode">
|
1108
|
+
<p class="source-link">
|
1109
|
+
Source: <a href="javascript:toggleSource('M000022_source')" id="l_M000022_source">show</a>
|
1110
|
+
|
1111
|
+
</p>
|
1112
|
+
<div id="M000022_source" class="dyn-source">
|
1113
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 406</span>
|
1114
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fermat_little</span>(<span class="ruby-identifier">p</span>, <span class="ruby-identifier">a</span>)
|
1115
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">p</span><span class="ruby-operator">%</span>(<span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">a</span>, (<span class="ruby-identifier">p</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>))<span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1116
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1117
|
+
<span class="ruby-keyword kw">elsif</span>
|
1118
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1119
|
+
<span class="ruby-keyword kw">end</span>
|
1120
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1121
|
+
</div>
|
1122
|
+
</div>
|
1123
|
+
|
1124
|
+
</div>
|
1125
|
+
|
1126
|
+
<div class="method">
|
1127
|
+
<div class="title" id="M000039">
|
1128
|
+
|
1129
|
+
<a name="M000039"></a><b>fermat_little</b>(p, a)
|
1130
|
+
|
1131
|
+
</div>
|
1132
|
+
|
1133
|
+
|
1134
|
+
|
1135
|
+
|
1136
|
+
<div class="sourcecode">
|
1137
|
+
<p class="source-link">
|
1138
|
+
Source: <a href="javascript:toggleSource('M000039_source')" id="l_M000039_source">show</a>
|
1139
|
+
|
1140
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L405" target="_blank" class="github_url">on GitHub</a>
|
1141
|
+
|
1142
|
+
</p>
|
1143
|
+
<div id="M000039_source" class="dyn-source">
|
1144
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 405</span>
|
1145
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fermat_little</span>(<span class="ruby-identifier">p</span>, <span class="ruby-identifier">a</span>)
|
1146
|
+
<span class="ruby-keyword kw">begin</span>
|
1147
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">p</span><span class="ruby-operator">%</span>(<span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">a</span>, (<span class="ruby-identifier">p</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>))<span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1148
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1149
|
+
<span class="ruby-keyword kw">else</span>
|
1150
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1151
|
+
<span class="ruby-keyword kw">end</span>
|
1152
|
+
<span class="ruby-keyword kw">end</span>
|
1153
|
+
<span class="ruby-keyword kw">rescue</span>
|
1154
|
+
<span class="ruby-keyword kw">begin</span>
|
1155
|
+
<span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"High load. Terminated."</span>)
|
1156
|
+
<span class="ruby-keyword kw">end</span>
|
1157
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1158
|
+
</div>
|
1159
|
+
</div>
|
1160
|
+
|
1161
|
+
</div>
|
1162
|
+
|
1163
|
+
<div class="method">
|
1164
|
+
<div class="title" id="M000032">
|
1165
|
+
|
1166
|
+
<a name="M000032"></a><b>fib</b>(n)
|
1167
|
+
|
1168
|
+
</div>
|
1169
|
+
|
1170
|
+
|
1171
|
+
|
1172
|
+
|
1173
|
+
<div class="sourcecode">
|
1174
|
+
<p class="source-link">
|
1175
|
+
Source: <a href="javascript:toggleSource('M000032_source')" id="l_M000032_source">show</a>
|
1176
|
+
|
1177
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L246" target="_blank" class="github_url">on GitHub</a>
|
1178
|
+
|
1179
|
+
</p>
|
1180
|
+
<div id="M000032_source" class="dyn-source">
|
1181
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 246</span>
|
1182
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span>)
|
1183
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">n</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>)
|
1184
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">n</span>;
|
1185
|
+
<span class="ruby-keyword kw">else</span>
|
1186
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">2</span>);
|
1187
|
+
<span class="ruby-keyword kw">end</span>
|
1188
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1189
|
+
</div>
|
1190
|
+
</div>
|
1191
|
+
|
1192
|
+
</div>
|
1193
|
+
|
1194
|
+
<div class="method">
|
1195
|
+
<div class="title" id="M000014">
|
1196
|
+
|
1197
|
+
<a name="M000014"></a><b>fib</b>(n)
|
1198
|
+
|
1199
|
+
</div>
|
1200
|
+
|
1201
|
+
|
1202
|
+
|
1203
|
+
|
1204
|
+
<div class="sourcecode">
|
1205
|
+
<p class="source-link">
|
1206
|
+
Source: <a href="javascript:toggleSource('M000014_source')" id="l_M000014_source">show</a>
|
1207
|
+
|
1208
|
+
</p>
|
1209
|
+
<div id="M000014_source" class="dyn-source">
|
1210
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 247</span>
|
1211
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span>)
|
1212
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">n</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>)
|
1213
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">n</span>;
|
1214
|
+
<span class="ruby-keyword kw">elsif</span>
|
1215
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">2</span>);
|
1216
|
+
<span class="ruby-keyword kw">end</span>
|
1217
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1218
|
+
</div>
|
1219
|
+
</div>
|
1220
|
+
|
1221
|
+
</div>
|
1222
|
+
|
1223
|
+
<div class="method">
|
1224
|
+
<div class="title" id="M000055">
|
1225
|
+
|
1226
|
+
<a name="M000055"></a><b>fib</b>(n)
|
1227
|
+
|
1228
|
+
</div>
|
1229
|
+
|
1230
|
+
|
1231
|
+
|
1232
|
+
|
1233
|
+
<div class="sourcecode">
|
1234
|
+
<p class="source-link">
|
1235
|
+
Source: <a href="javascript:toggleSource('M000055_source')" id="l_M000055_source">show</a>
|
1236
|
+
|
1237
|
+
</p>
|
1238
|
+
<div id="M000055_source" class="dyn-source">
|
1239
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 247</span>
|
1240
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span>)
|
1241
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">n</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>)
|
1242
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">n</span>;
|
1243
|
+
<span class="ruby-keyword kw">elsif</span>
|
1244
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">2</span>);
|
1245
|
+
<span class="ruby-keyword kw">end</span>
|
1246
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1247
|
+
</div>
|
1248
|
+
</div>
|
1249
|
+
|
1250
|
+
</div>
|
1251
|
+
|
1252
|
+
<div class="method">
|
1253
|
+
<div class="title" id="M000072">
|
1254
|
+
|
1255
|
+
<a name="M000072"></a><b>fib</b>(n)
|
1256
|
+
|
1257
|
+
</div>
|
1258
|
+
|
1259
|
+
|
1260
|
+
|
1261
|
+
|
1262
|
+
<div class="sourcecode">
|
1263
|
+
<p class="source-link">
|
1264
|
+
Source: <a href="javascript:toggleSource('M000072_source')" id="l_M000072_source">show</a>
|
1265
|
+
|
1266
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L247" target="_blank" class="github_url">on GitHub</a>
|
1267
|
+
|
1268
|
+
</p>
|
1269
|
+
<div id="M000072_source" class="dyn-source">
|
1270
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 247</span>
|
1271
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span>)
|
1272
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">n</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>)
|
1273
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">n</span>;
|
1274
|
+
<span class="ruby-keyword kw">elsif</span>
|
1275
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">2</span>);
|
1276
|
+
<span class="ruby-keyword kw">end</span>
|
1277
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1278
|
+
</div>
|
1279
|
+
</div>
|
1280
|
+
|
1281
|
+
</div>
|
1282
|
+
|
1283
|
+
<div class="method">
|
1284
|
+
<div class="title" id="M000015">
|
1285
|
+
|
1286
|
+
<a name="M000015"></a><b>help</b>()
|
1287
|
+
|
1288
|
+
</div>
|
1289
|
+
|
1290
|
+
|
1291
|
+
|
1292
|
+
|
1293
|
+
<div class="sourcecode">
|
1294
|
+
<p class="source-link">
|
1295
|
+
Source: <a href="javascript:toggleSource('M000015_source')" id="l_M000015_source">show</a>
|
1296
|
+
|
1297
|
+
</p>
|
1298
|
+
<div id="M000015_source" class="dyn-source">
|
1299
|
+
<pre><span class="ruby-comment cmt"># File lib/help.rb, line 2</span>
|
1300
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">help</span>
|
1301
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"
|
1302
|
+
Valid Commands
|
1303
|
+
===============
|
1304
|
+
help Show this manpage
|
1305
|
+
certain Show certain conditions page
|
1306
|
+
factorial Recursive definition of factorial
|
1307
|
+
'n' is the number which will calculated in procedure
|
1308
|
+
binsearch *binary => array
|
1309
|
+
*size => binary array's size
|
1310
|
+
*search_key => Compare string
|
1311
|
+
*General values
|
1312
|
+
*low => low value representation
|
1313
|
+
*middle => middle value representation
|
1314
|
+
*high => high value representation
|
1315
|
+
birdseye Bird's Eye View Procedure
|
1316
|
+
combinatorial 'glb' represents is General mass of combinatorial approach
|
1317
|
+
'klb' represents is Selection mass of combinatorial approach
|
1318
|
+
distpres 'presnum' value represents Present count.
|
1319
|
+
eagleview Eagle View Procedure
|
1320
|
+
fermatlittle Fermat Little Theorem's Procedural Representation
|
1321
|
+
fib Additive recursive definition of Fibonacci
|
1322
|
+
isprime Is Prime Procedure
|
1323
|
+
'nb' is the input argument number of procedure
|
1324
|
+
iterativefact Iterative factorial of procedural representation
|
1325
|
+
sigma Sigma procedure's simple procedure is rely on '(ax+b)^pw'
|
1326
|
+
a represented by inta;
|
1327
|
+
b represented by intb;
|
1328
|
+
x represented by intx;
|
1329
|
+
power represented by pw.
|
1330
|
+
stirling 'strln' is the stirling number in stirling formula
|
1331
|
+
subset 'zerosbst' variable, decision mechanism of zero subset is included or not included
|
1332
|
+
'gen' is the general mass elements(objects) number
|
1333
|
+
fibsum Fibonacci Sum Procedure
|
1334
|
+
twinprdx Twin Paradox Lemma Solution Procedure
|
1335
|
+
Selection mass represented by 'mass' value
|
1336
|
+
uipow Non-balanced power calculation procedure
|
1337
|
+
"</span>
|
1338
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1339
|
+
</div>
|
1340
|
+
</div>
|
1341
|
+
|
1342
|
+
</div>
|
1343
|
+
|
1344
|
+
<div class="method">
|
1345
|
+
<div class="title" id="M000084">
|
1346
|
+
|
1347
|
+
<a name="M000084"></a><b>inspect</b>()
|
1348
|
+
|
1349
|
+
</div>
|
1350
|
+
|
1351
|
+
|
1352
|
+
|
1353
|
+
|
1354
|
+
<div class="sourcecode">
|
1355
|
+
<p class="source-link">
|
1356
|
+
Source: <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">show</a>
|
1357
|
+
|
1358
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/main.rb#L38" target="_blank" class="github_url">on GitHub</a>
|
1359
|
+
|
1360
|
+
</p>
|
1361
|
+
<div id="M000084_source" class="dyn-source">
|
1362
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/main.rb, line 38</span>
|
1363
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
1364
|
+
<span class="ruby-comment cmt"># Read arguments and defines commands</span>
|
1365
|
+
<span class="ruby-comment cmt"># Will handle command line whitespaces</span>
|
1366
|
+
|
1367
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">commnd</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'help'</span>)
|
1368
|
+
<span class="ruby-comment cmt"># Help of commands and usages</span>
|
1369
|
+
<span class="ruby-keyword kw">end</span>
|
1370
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">commnd</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'certain'</span>)
|
1371
|
+
<span class="ruby-comment cmt"># Certain conditions</span>
|
1372
|
+
<span class="ruby-keyword kw">end</span>
|
1373
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1374
|
+
</div>
|
1375
|
+
</div>
|
1376
|
+
|
1377
|
+
</div>
|
1378
|
+
|
1379
|
+
<div class="method">
|
1380
|
+
<div class="title" id="M000038">
|
1381
|
+
|
1382
|
+
<a name="M000038"></a><b>is_prime</b>(nb)
|
1383
|
+
|
1384
|
+
</div>
|
1385
|
+
|
1386
|
+
|
1387
|
+
|
1388
|
+
|
1389
|
+
<div class="sourcecode">
|
1390
|
+
<p class="source-link">
|
1391
|
+
Source: <a href="javascript:toggleSource('M000038_source')" id="l_M000038_source">show</a>
|
1392
|
+
|
1393
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L375" target="_blank" class="github_url">on GitHub</a>
|
1394
|
+
|
1395
|
+
</p>
|
1396
|
+
<div id="M000038_source" class="dyn-source">
|
1397
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 375</span>
|
1398
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_prime</span>(<span class="ruby-identifier">nb</span>)
|
1399
|
+
<span class="ruby-identifier">test</span> = <span class="ruby-identifier">count</span> = <span class="ruby-value">0</span>
|
1400
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">nb</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
|
1401
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
|
1402
|
+
<span class="ruby-keyword kw">end</span>
|
1403
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-identifier">nb</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1404
|
+
<span class="ruby-identifier">count</span><span class="ruby-operator">+</span><span class="ruby-operator">+</span>
|
1405
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">nb</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1406
|
+
<span class="ruby-identifier">test</span> = <span class="ruby-keyword kw">false</span>
|
1407
|
+
<span class="ruby-keyword kw">end</span>
|
1408
|
+
<span class="ruby-keyword kw">end</span>
|
1409
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">test</span>)
|
1410
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1411
|
+
<span class="ruby-keyword kw">else</span>
|
1412
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1413
|
+
<span class="ruby-keyword kw">end</span>
|
1414
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1415
|
+
</div>
|
1416
|
+
</div>
|
1417
|
+
|
1418
|
+
</div>
|
1419
|
+
|
1420
|
+
<div class="method">
|
1421
|
+
<div class="title" id="M000021">
|
1422
|
+
|
1423
|
+
<a name="M000021"></a><b>is_prime</b>(nb)
|
1424
|
+
|
1425
|
+
</div>
|
1426
|
+
|
1427
|
+
|
1428
|
+
|
1429
|
+
|
1430
|
+
<div class="sourcecode">
|
1431
|
+
<p class="source-link">
|
1432
|
+
Source: <a href="javascript:toggleSource('M000021_source')" id="l_M000021_source">show</a>
|
1433
|
+
|
1434
|
+
</p>
|
1435
|
+
<div id="M000021_source" class="dyn-source">
|
1436
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 376</span>
|
1437
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_prime</span>(<span class="ruby-identifier">nb</span>)
|
1438
|
+
<span class="ruby-identifier">test</span> = <span class="ruby-identifier">count</span> = <span class="ruby-value">0</span>
|
1439
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">nb</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>)
|
1440
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
|
1441
|
+
<span class="ruby-keyword kw">end</span>
|
1442
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-identifier">nb</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1443
|
+
<span class="ruby-identifier">count</span><span class="ruby-operator">+</span><span class="ruby-operator">+</span>
|
1444
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">nb</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1445
|
+
<span class="ruby-identifier">test</span> = <span class="ruby-value">1</span>
|
1446
|
+
<span class="ruby-keyword kw">end</span>
|
1447
|
+
<span class="ruby-keyword kw">end</span>
|
1448
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">test</span>)
|
1449
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1450
|
+
<span class="ruby-keyword kw">elsif</span>
|
1451
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1452
|
+
<span class="ruby-keyword kw">end</span>
|
1453
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1454
|
+
</div>
|
1455
|
+
</div>
|
1456
|
+
|
1457
|
+
</div>
|
1458
|
+
|
1459
|
+
<div class="method">
|
1460
|
+
<div class="title" id="M000078">
|
1461
|
+
|
1462
|
+
<a name="M000078"></a><b>is_prime</b>(nb)
|
1463
|
+
|
1464
|
+
</div>
|
1465
|
+
|
1466
|
+
|
1467
|
+
|
1468
|
+
|
1469
|
+
<div class="sourcecode">
|
1470
|
+
<p class="source-link">
|
1471
|
+
Source: <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">show</a>
|
1472
|
+
|
1473
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L376" target="_blank" class="github_url">on GitHub</a>
|
1474
|
+
|
1475
|
+
</p>
|
1476
|
+
<div id="M000078_source" class="dyn-source">
|
1477
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 376</span>
|
1478
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_prime</span>(<span class="ruby-identifier">nb</span>)
|
1479
|
+
<span class="ruby-identifier">test</span> = <span class="ruby-identifier">count</span> = <span class="ruby-value">0</span>
|
1480
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">nb</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>)
|
1481
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
|
1482
|
+
<span class="ruby-keyword kw">end</span>
|
1483
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-identifier">nb</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1484
|
+
<span class="ruby-identifier">count</span><span class="ruby-operator">+</span><span class="ruby-operator">+</span>
|
1485
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">nb</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1486
|
+
<span class="ruby-identifier">test</span> = <span class="ruby-value">1</span>
|
1487
|
+
<span class="ruby-keyword kw">end</span>
|
1488
|
+
<span class="ruby-keyword kw">end</span>
|
1489
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">test</span>)
|
1490
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1491
|
+
<span class="ruby-keyword kw">elsif</span>
|
1492
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1493
|
+
<span class="ruby-keyword kw">end</span>
|
1494
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1495
|
+
</div>
|
1496
|
+
</div>
|
1497
|
+
|
1498
|
+
</div>
|
1499
|
+
|
1500
|
+
<div class="method">
|
1501
|
+
<div class="title" id="M000065">
|
1502
|
+
|
1503
|
+
<a name="M000065"></a><b>is_prime</b>(nb)
|
1504
|
+
|
1505
|
+
</div>
|
1506
|
+
|
1507
|
+
|
1508
|
+
|
1509
|
+
|
1510
|
+
<div class="sourcecode">
|
1511
|
+
<p class="source-link">
|
1512
|
+
Source: <a href="javascript:toggleSource('M000065_source')" id="l_M000065_source">show</a>
|
1513
|
+
|
1514
|
+
</p>
|
1515
|
+
<div id="M000065_source" class="dyn-source">
|
1516
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 376</span>
|
1517
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_prime</span>(<span class="ruby-identifier">nb</span>)
|
1518
|
+
<span class="ruby-identifier">test</span> = <span class="ruby-identifier">count</span> = <span class="ruby-value">0</span>
|
1519
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">nb</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>)
|
1520
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
|
1521
|
+
<span class="ruby-keyword kw">end</span>
|
1522
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-identifier">nb</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1523
|
+
<span class="ruby-identifier">count</span><span class="ruby-operator">+</span><span class="ruby-operator">+</span>
|
1524
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">nb</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1525
|
+
<span class="ruby-identifier">test</span> = <span class="ruby-value">1</span>
|
1526
|
+
<span class="ruby-keyword kw">end</span>
|
1527
|
+
<span class="ruby-keyword kw">end</span>
|
1528
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">test</span>)
|
1529
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1530
|
+
<span class="ruby-keyword kw">elsif</span>
|
1531
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1532
|
+
<span class="ruby-keyword kw">end</span>
|
1533
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1534
|
+
</div>
|
1535
|
+
</div>
|
1536
|
+
|
1537
|
+
</div>
|
1538
|
+
|
1539
|
+
<div class="method">
|
1540
|
+
<div class="title" id="M000048">
|
1541
|
+
|
1542
|
+
<a name="M000048"></a><b>iterative_fact</b>(itrtnum)
|
1543
|
+
|
1544
|
+
</div>
|
1545
|
+
|
1546
|
+
|
1547
|
+
|
1548
|
+
|
1549
|
+
<div class="sourcecode">
|
1550
|
+
<p class="source-link">
|
1551
|
+
Source: <a href="javascript:toggleSource('M000048_source')" id="l_M000048_source">show</a>
|
1552
|
+
|
1553
|
+
</p>
|
1554
|
+
<div id="M000048_source" class="dyn-source">
|
1555
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 67</span>
|
1556
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">iterative_fact</span>(<span class="ruby-identifier">itrtnum</span>)
|
1557
|
+
<span class="ruby-identifier">itrtnum</span>.<span class="ruby-identifier">downto</span>(<span class="ruby-value">1</span>) <span class="ruby-keyword kw">do</span>
|
1558
|
+
<span class="ruby-identifier">total</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">itrtnum</span>)
|
1559
|
+
<span class="ruby-keyword kw">end</span>
|
1560
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">total</span>
|
1561
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1562
|
+
</div>
|
1563
|
+
</div>
|
1564
|
+
|
1565
|
+
</div>
|
1566
|
+
|
1567
|
+
<div class="method">
|
1568
|
+
<div class="title" id="M000060">
|
1569
|
+
|
1570
|
+
<a name="M000060"></a><b>iterative_fact</b>(itrtnum)
|
1571
|
+
|
1572
|
+
</div>
|
1573
|
+
|
1574
|
+
|
1575
|
+
|
1576
|
+
|
1577
|
+
<div class="sourcecode">
|
1578
|
+
<p class="source-link">
|
1579
|
+
Source: <a href="javascript:toggleSource('M000060_source')" id="l_M000060_source">show</a>
|
1580
|
+
|
1581
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L67" target="_blank" class="github_url">on GitHub</a>
|
1582
|
+
|
1583
|
+
</p>
|
1584
|
+
<div id="M000060_source" class="dyn-source">
|
1585
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 67</span>
|
1586
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">iterative_fact</span>(<span class="ruby-identifier">itrtnum</span>)
|
1587
|
+
<span class="ruby-identifier">itrtnum</span>.<span class="ruby-identifier">downto</span>(<span class="ruby-value">1</span>) <span class="ruby-keyword kw">do</span>
|
1588
|
+
<span class="ruby-identifier">total</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">itrtnum</span>)
|
1589
|
+
<span class="ruby-keyword kw">end</span>
|
1590
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">total</span>
|
1591
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1592
|
+
</div>
|
1593
|
+
</div>
|
1594
|
+
|
1595
|
+
</div>
|
1596
|
+
|
1597
|
+
<div class="method">
|
1598
|
+
<div class="title" id="M000025">
|
1599
|
+
|
1600
|
+
<a name="M000025"></a><b>iterative_fact</b>(itrtnum)
|
1601
|
+
|
1602
|
+
</div>
|
1603
|
+
|
1604
|
+
|
1605
|
+
|
1606
|
+
|
1607
|
+
<div class="sourcecode">
|
1608
|
+
<p class="source-link">
|
1609
|
+
Source: <a href="javascript:toggleSource('M000025_source')" id="l_M000025_source">show</a>
|
1610
|
+
|
1611
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L68" target="_blank" class="github_url">on GitHub</a>
|
1612
|
+
|
1613
|
+
</p>
|
1614
|
+
<div id="M000025_source" class="dyn-source">
|
1615
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 68</span>
|
1616
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">iterative_fact</span>(<span class="ruby-identifier">itrtnum</span>)
|
1617
|
+
<span class="ruby-identifier">itrtnum</span>.<span class="ruby-identifier">downto</span>(<span class="ruby-value">1</span>) <span class="ruby-keyword kw">do</span>
|
1618
|
+
<span class="ruby-identifier">total</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">itrtnum</span>)
|
1619
|
+
<span class="ruby-keyword kw">end</span>
|
1620
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">total</span>
|
1621
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1622
|
+
</div>
|
1623
|
+
</div>
|
1624
|
+
|
1625
|
+
</div>
|
1626
|
+
|
1627
|
+
<div class="method">
|
1628
|
+
<div class="title" id="M000002">
|
1629
|
+
|
1630
|
+
<a name="M000002"></a><b>iterative_fact</b>(itrtnum)
|
1631
|
+
|
1632
|
+
</div>
|
1633
|
+
|
1634
|
+
|
1635
|
+
|
1636
|
+
|
1637
|
+
<div class="sourcecode">
|
1638
|
+
<p class="source-link">
|
1639
|
+
Source: <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show</a>
|
1640
|
+
|
1641
|
+
</p>
|
1642
|
+
<div id="M000002_source" class="dyn-source">
|
1643
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 67</span>
|
1644
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">iterative_fact</span>(<span class="ruby-identifier">itrtnum</span>)
|
1645
|
+
<span class="ruby-identifier">itrtnum</span>.<span class="ruby-identifier">downto</span>(<span class="ruby-value">1</span>) <span class="ruby-keyword kw">do</span>
|
1646
|
+
<span class="ruby-identifier">total</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">factorial</span>(<span class="ruby-identifier">itrtnum</span>)
|
1647
|
+
<span class="ruby-keyword kw">end</span>
|
1648
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">total</span>
|
1649
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1650
|
+
</div>
|
1651
|
+
</div>
|
1652
|
+
|
1653
|
+
</div>
|
1654
|
+
|
1655
|
+
<div class="method">
|
1656
|
+
<div class="title" id="M000056">
|
1657
|
+
|
1658
|
+
<a name="M000056"></a><b>print_row</b>(binary, size, low, mid, high)
|
1659
|
+
|
1660
|
+
</div>
|
1661
|
+
|
1662
|
+
|
1663
|
+
|
1664
|
+
|
1665
|
+
<div class="sourcecode">
|
1666
|
+
<p class="source-link">
|
1667
|
+
Source: <a href="javascript:toggleSource('M000056_source')" id="l_M000056_source">show</a>
|
1668
|
+
|
1669
|
+
</p>
|
1670
|
+
<div id="M000056_source" class="dyn-source">
|
1671
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 270</span>
|
1672
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_row</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">high</span>)
|
1673
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1674
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator"><</span><span class="ruby-identifier">low</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">></span> <span class="ruby-identifier">high</span>)
|
1675
|
+
<span class="ruby-identifier">print</span> (<span class="ruby-value str">" "</span>)
|
1676
|
+
<span class="ruby-keyword kw">end</span>
|
1677
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">mid</span>)
|
1678
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span>]
|
1679
|
+
<span class="ruby-keyword kw">end</span>
|
1680
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-keyword kw">nil</span>)
|
1681
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span>]
|
1682
|
+
<span class="ruby-keyword kw">end</span>
|
1683
|
+
<span class="ruby-keyword kw">end</span>
|
1684
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1685
|
+
</div>
|
1686
|
+
</div>
|
1687
|
+
|
1688
|
+
</div>
|
1689
|
+
|
1690
|
+
<div class="method">
|
1691
|
+
<div class="title" id="M000033">
|
1692
|
+
|
1693
|
+
<a name="M000033"></a><b>print_row</b>(binary, size, low, mid, high)
|
1694
|
+
|
1695
|
+
</div>
|
1696
|
+
|
1697
|
+
|
1698
|
+
|
1699
|
+
|
1700
|
+
<div class="sourcecode">
|
1701
|
+
<p class="source-link">
|
1702
|
+
Source: <a href="javascript:toggleSource('M000033_source')" id="l_M000033_source">show</a>
|
1703
|
+
|
1704
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L269" target="_blank" class="github_url">on GitHub</a>
|
1705
|
+
|
1706
|
+
</p>
|
1707
|
+
<div id="M000033_source" class="dyn-source">
|
1708
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 269</span>
|
1709
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_row</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">high</span>)
|
1710
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1711
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator"><</span><span class="ruby-identifier">low</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">></span> <span class="ruby-identifier">high</span>)
|
1712
|
+
<span class="ruby-identifier">print</span> (<span class="ruby-value str">" "</span>)
|
1713
|
+
<span class="ruby-keyword kw">end</span>
|
1714
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">mid</span>)
|
1715
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span>]
|
1716
|
+
<span class="ruby-keyword kw">end</span>
|
1717
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-keyword kw">nil</span>)
|
1718
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span>]
|
1719
|
+
<span class="ruby-keyword kw">end</span>
|
1720
|
+
<span class="ruby-keyword kw">end</span>
|
1721
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1722
|
+
</div>
|
1723
|
+
</div>
|
1724
|
+
|
1725
|
+
</div>
|
1726
|
+
|
1727
|
+
<div class="method">
|
1728
|
+
<div class="title" id="M000073">
|
1729
|
+
|
1730
|
+
<a name="M000073"></a><b>print_row</b>(binary, size, low, mid, high)
|
1731
|
+
|
1732
|
+
</div>
|
1733
|
+
|
1734
|
+
|
1735
|
+
|
1736
|
+
|
1737
|
+
<div class="sourcecode">
|
1738
|
+
<p class="source-link">
|
1739
|
+
Source: <a href="javascript:toggleSource('M000073_source')" id="l_M000073_source">show</a>
|
1740
|
+
|
1741
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L270" target="_blank" class="github_url">on GitHub</a>
|
1742
|
+
|
1743
|
+
</p>
|
1744
|
+
<div id="M000073_source" class="dyn-source">
|
1745
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 270</span>
|
1746
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_row</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">high</span>)
|
1747
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1748
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator"><</span><span class="ruby-identifier">low</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">></span> <span class="ruby-identifier">high</span>)
|
1749
|
+
<span class="ruby-identifier">print</span> (<span class="ruby-value str">" "</span>)
|
1750
|
+
<span class="ruby-keyword kw">end</span>
|
1751
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">mid</span>)
|
1752
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span>]
|
1753
|
+
<span class="ruby-keyword kw">end</span>
|
1754
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-keyword kw">nil</span>)
|
1755
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span>]
|
1756
|
+
<span class="ruby-keyword kw">end</span>
|
1757
|
+
<span class="ruby-keyword kw">end</span>
|
1758
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1759
|
+
</div>
|
1760
|
+
</div>
|
1761
|
+
|
1762
|
+
</div>
|
1763
|
+
|
1764
|
+
<div class="method">
|
1765
|
+
<div class="title" id="M000016">
|
1766
|
+
|
1767
|
+
<a name="M000016"></a><b>print_row</b>(binary, size, low, mid, high)
|
1768
|
+
|
1769
|
+
</div>
|
1770
|
+
|
1771
|
+
|
1772
|
+
|
1773
|
+
|
1774
|
+
<div class="sourcecode">
|
1775
|
+
<p class="source-link">
|
1776
|
+
Source: <a href="javascript:toggleSource('M000016_source')" id="l_M000016_source">show</a>
|
1777
|
+
|
1778
|
+
</p>
|
1779
|
+
<div id="M000016_source" class="dyn-source">
|
1780
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 270</span>
|
1781
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_row</span>(<span class="ruby-identifier">binary</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">low</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">high</span>)
|
1782
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1783
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator"><</span><span class="ruby-identifier">low</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">></span> <span class="ruby-identifier">high</span>)
|
1784
|
+
<span class="ruby-identifier">print</span> (<span class="ruby-value str">" "</span>)
|
1785
|
+
<span class="ruby-keyword kw">end</span>
|
1786
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">mid</span>)
|
1787
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span>]
|
1788
|
+
<span class="ruby-keyword kw">end</span>
|
1789
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-keyword kw">nil</span>)
|
1790
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span>]
|
1791
|
+
<span class="ruby-keyword kw">end</span>
|
1792
|
+
<span class="ruby-keyword kw">end</span>
|
1793
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1794
|
+
</div>
|
1795
|
+
</div>
|
1796
|
+
|
1797
|
+
</div>
|
1798
|
+
|
1799
|
+
<div class="method">
|
1800
|
+
<div class="title" id="M000067">
|
1801
|
+
|
1802
|
+
<a name="M000067"></a><b>sigma</b>(inta, intx, intb, pw)
|
1803
|
+
|
1804
|
+
</div>
|
1805
|
+
|
1806
|
+
|
1807
|
+
|
1808
|
+
|
1809
|
+
<div class="sourcecode">
|
1810
|
+
<p class="source-link">
|
1811
|
+
Source: <a href="javascript:toggleSource('M000067_source')" id="l_M000067_source">show</a>
|
1812
|
+
|
1813
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L169" target="_blank" class="github_url">on GitHub</a>
|
1814
|
+
|
1815
|
+
</p>
|
1816
|
+
<div id="M000067_source" class="dyn-source">
|
1817
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 169</span>
|
1818
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sigma</span>(<span class="ruby-identifier">inta</span>, <span class="ruby-identifier">intx</span>, <span class="ruby-identifier">intb</span>, <span class="ruby-identifier">pw</span>)
|
1819
|
+
<span class="ruby-identifier">ttl</span> = <span class="ruby-value">0</span>
|
1820
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">intx</span>
|
1821
|
+
<span class="ruby-identifier">ttl</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">inta</span><span class="ruby-operator">*</span><span class="ruby-identifier">intx</span><span class="ruby-operator">+</span><span class="ruby-identifier">intb</span>)
|
1822
|
+
<span class="ruby-keyword kw">end</span>
|
1823
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
|
1824
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ttl</span>
|
1825
|
+
<span class="ruby-keyword kw">end</span>
|
1826
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>)
|
1827
|
+
<span class="ruby-identifier">ttl</span>=<span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">ttl</span>, <span class="ruby-identifier">pw</span>)
|
1828
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ttl</span>
|
1829
|
+
<span class="ruby-keyword kw">end</span>
|
1830
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1831
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1832
|
+
<span class="ruby-keyword kw">end</span>
|
1833
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1834
|
+
</div>
|
1835
|
+
</div>
|
1836
|
+
|
1837
|
+
</div>
|
1838
|
+
|
1839
|
+
<div class="method">
|
1840
|
+
<div class="title" id="M000051">
|
1841
|
+
|
1842
|
+
<a name="M000051"></a><b>sigma</b>(inta, intx, intb, pw)
|
1843
|
+
|
1844
|
+
</div>
|
1845
|
+
|
1846
|
+
|
1847
|
+
|
1848
|
+
|
1849
|
+
<div class="sourcecode">
|
1850
|
+
<p class="source-link">
|
1851
|
+
Source: <a href="javascript:toggleSource('M000051_source')" id="l_M000051_source">show</a>
|
1852
|
+
|
1853
|
+
</p>
|
1854
|
+
<div id="M000051_source" class="dyn-source">
|
1855
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 169</span>
|
1856
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sigma</span>(<span class="ruby-identifier">inta</span>, <span class="ruby-identifier">intx</span>, <span class="ruby-identifier">intb</span>, <span class="ruby-identifier">pw</span>)
|
1857
|
+
<span class="ruby-identifier">ttl</span> = <span class="ruby-value">0</span>
|
1858
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">intx</span>
|
1859
|
+
<span class="ruby-identifier">ttl</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">inta</span><span class="ruby-operator">*</span><span class="ruby-identifier">intx</span><span class="ruby-operator">+</span><span class="ruby-identifier">intb</span>)
|
1860
|
+
<span class="ruby-keyword kw">end</span>
|
1861
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
|
1862
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ttl</span>
|
1863
|
+
<span class="ruby-keyword kw">end</span>
|
1864
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>)
|
1865
|
+
<span class="ruby-identifier">ttl</span>=<span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">ttl</span>, <span class="ruby-identifier">pw</span>)
|
1866
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ttl</span>
|
1867
|
+
<span class="ruby-keyword kw">end</span>
|
1868
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1869
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1870
|
+
<span class="ruby-keyword kw">end</span>
|
1871
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1872
|
+
</div>
|
1873
|
+
</div>
|
1874
|
+
|
1875
|
+
</div>
|
1876
|
+
|
1877
|
+
<div class="method">
|
1878
|
+
<div class="title" id="M000010">
|
1879
|
+
|
1880
|
+
<a name="M000010"></a><b>sigma</b>(inta, intx, intb, pw)
|
1881
|
+
|
1882
|
+
</div>
|
1883
|
+
|
1884
|
+
|
1885
|
+
|
1886
|
+
|
1887
|
+
<div class="sourcecode">
|
1888
|
+
<p class="source-link">
|
1889
|
+
Source: <a href="javascript:toggleSource('M000010_source')" id="l_M000010_source">show</a>
|
1890
|
+
|
1891
|
+
</p>
|
1892
|
+
<div id="M000010_source" class="dyn-source">
|
1893
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 169</span>
|
1894
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sigma</span>(<span class="ruby-identifier">inta</span>, <span class="ruby-identifier">intx</span>, <span class="ruby-identifier">intb</span>, <span class="ruby-identifier">pw</span>)
|
1895
|
+
<span class="ruby-identifier">ttl</span> = <span class="ruby-value">0</span>
|
1896
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">intx</span>
|
1897
|
+
<span class="ruby-identifier">ttl</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">inta</span><span class="ruby-operator">*</span><span class="ruby-identifier">intx</span><span class="ruby-operator">+</span><span class="ruby-identifier">intb</span>)
|
1898
|
+
<span class="ruby-keyword kw">end</span>
|
1899
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
|
1900
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ttl</span>
|
1901
|
+
<span class="ruby-keyword kw">end</span>
|
1902
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>)
|
1903
|
+
<span class="ruby-identifier">ttl</span>=<span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">ttl</span>, <span class="ruby-identifier">pw</span>)
|
1904
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ttl</span>
|
1905
|
+
<span class="ruby-keyword kw">end</span>
|
1906
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1907
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1908
|
+
<span class="ruby-keyword kw">end</span>
|
1909
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1910
|
+
</div>
|
1911
|
+
</div>
|
1912
|
+
|
1913
|
+
</div>
|
1914
|
+
|
1915
|
+
<div class="method">
|
1916
|
+
<div class="title" id="M000028">
|
1917
|
+
|
1918
|
+
<a name="M000028"></a><b>sigma</b>(inta, intx, intb, pw)
|
1919
|
+
|
1920
|
+
</div>
|
1921
|
+
|
1922
|
+
|
1923
|
+
|
1924
|
+
|
1925
|
+
<div class="sourcecode">
|
1926
|
+
<p class="source-link">
|
1927
|
+
Source: <a href="javascript:toggleSource('M000028_source')" id="l_M000028_source">show</a>
|
1928
|
+
|
1929
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L168" target="_blank" class="github_url">on GitHub</a>
|
1930
|
+
|
1931
|
+
</p>
|
1932
|
+
<div id="M000028_source" class="dyn-source">
|
1933
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 168</span>
|
1934
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sigma</span>(<span class="ruby-identifier">inta</span>, <span class="ruby-identifier">intx</span>, <span class="ruby-identifier">intb</span>, <span class="ruby-identifier">pw</span>)
|
1935
|
+
<span class="ruby-identifier">ttl</span> = <span class="ruby-value">0</span>
|
1936
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">intx</span>
|
1937
|
+
<span class="ruby-identifier">ttl</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">inta</span><span class="ruby-operator">*</span><span class="ruby-identifier">intx</span><span class="ruby-operator">+</span><span class="ruby-identifier">intb</span>)
|
1938
|
+
<span class="ruby-keyword kw">end</span>
|
1939
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
|
1940
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ttl</span>
|
1941
|
+
<span class="ruby-keyword kw">end</span>
|
1942
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>)
|
1943
|
+
<span class="ruby-identifier">ttl</span>=<span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">ttl</span>, <span class="ruby-identifier">pw</span>)
|
1944
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ttl</span>
|
1945
|
+
<span class="ruby-keyword kw">end</span>
|
1946
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">pw</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
1947
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1948
|
+
<span class="ruby-keyword kw">end</span>
|
1949
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1950
|
+
</div>
|
1951
|
+
</div>
|
1952
|
+
|
1953
|
+
</div>
|
1954
|
+
|
1955
|
+
<div class="method">
|
1956
|
+
<div class="title" id="M000011">
|
1957
|
+
|
1958
|
+
<a name="M000011"></a><b>stirling</b>(strln)
|
1959
|
+
|
1960
|
+
</div>
|
1961
|
+
|
1962
|
+
|
1963
|
+
|
1964
|
+
|
1965
|
+
<div class="sourcecode">
|
1966
|
+
<p class="source-link">
|
1967
|
+
Source: <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show</a>
|
1968
|
+
|
1969
|
+
</p>
|
1970
|
+
<div id="M000011_source" class="dyn-source">
|
1971
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 197</span>
|
1972
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stirling</span>(<span class="ruby-identifier">strln</span>)
|
1973
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">strln</span><span class="ruby-operator">/</span><span class="ruby-identifier">constants1</span>.<span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span><span class="ruby-identifier">strln</span>)<span class="ruby-operator">*</span><span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-value">2</span><span class="ruby-operator">*</span><span class="ruby-identifier">constants1</span>.<span class="ruby-constant">PIVALUE</span><span class="ruby-operator">*</span><span class="ruby-identifier">strln</span>);
|
1974
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1975
|
+
</div>
|
1976
|
+
</div>
|
1977
|
+
|
1978
|
+
</div>
|
1979
|
+
|
1980
|
+
<div class="method">
|
1981
|
+
<div class="title" id="M000069">
|
1982
|
+
|
1983
|
+
<a name="M000069"></a><b>stirling</b>(strln)
|
1984
|
+
|
1985
|
+
</div>
|
1986
|
+
|
1987
|
+
|
1988
|
+
|
1989
|
+
|
1990
|
+
<div class="sourcecode">
|
1991
|
+
<p class="source-link">
|
1992
|
+
Source: <a href="javascript:toggleSource('M000069_source')" id="l_M000069_source">show</a>
|
1993
|
+
|
1994
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L197" target="_blank" class="github_url">on GitHub</a>
|
1995
|
+
|
1996
|
+
</p>
|
1997
|
+
<div id="M000069_source" class="dyn-source">
|
1998
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 197</span>
|
1999
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stirling</span>(<span class="ruby-identifier">strln</span>)
|
2000
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">strln</span><span class="ruby-operator">/</span><span class="ruby-identifier">constants1</span>.<span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span><span class="ruby-identifier">strln</span>)<span class="ruby-operator">*</span><span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-value">2</span><span class="ruby-operator">*</span><span class="ruby-identifier">constants1</span>.<span class="ruby-constant">PIVALUE</span><span class="ruby-operator">*</span><span class="ruby-identifier">strln</span>);
|
2001
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2002
|
+
</div>
|
2003
|
+
</div>
|
2004
|
+
|
2005
|
+
</div>
|
2006
|
+
|
2007
|
+
<div class="method">
|
2008
|
+
<div class="title" id="M000052">
|
2009
|
+
|
2010
|
+
<a name="M000052"></a><b>stirling</b>(strln)
|
2011
|
+
|
2012
|
+
</div>
|
2013
|
+
|
2014
|
+
|
2015
|
+
|
2016
|
+
|
2017
|
+
<div class="sourcecode">
|
2018
|
+
<p class="source-link">
|
2019
|
+
Source: <a href="javascript:toggleSource('M000052_source')" id="l_M000052_source">show</a>
|
2020
|
+
|
2021
|
+
</p>
|
2022
|
+
<div id="M000052_source" class="dyn-source">
|
2023
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 197</span>
|
2024
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stirling</span>(<span class="ruby-identifier">strln</span>)
|
2025
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">strln</span><span class="ruby-operator">/</span><span class="ruby-identifier">constants1</span>.<span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span><span class="ruby-identifier">strln</span>)<span class="ruby-operator">*</span><span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-value">2</span><span class="ruby-operator">*</span><span class="ruby-identifier">constants1</span>.<span class="ruby-constant">PIVALUE</span><span class="ruby-operator">*</span><span class="ruby-identifier">strln</span>);
|
2026
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2027
|
+
</div>
|
2028
|
+
</div>
|
2029
|
+
|
2030
|
+
</div>
|
2031
|
+
|
2032
|
+
<div class="method">
|
2033
|
+
<div class="title" id="M000029">
|
2034
|
+
|
2035
|
+
<a name="M000029"></a><b>stirling</b>(strln)
|
2036
|
+
|
2037
|
+
</div>
|
2038
|
+
|
2039
|
+
|
2040
|
+
|
2041
|
+
|
2042
|
+
<div class="sourcecode">
|
2043
|
+
<p class="source-link">
|
2044
|
+
Source: <a href="javascript:toggleSource('M000029_source')" id="l_M000029_source">show</a>
|
2045
|
+
|
2046
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L196" target="_blank" class="github_url">on GitHub</a>
|
2047
|
+
|
2048
|
+
</p>
|
2049
|
+
<div id="M000029_source" class="dyn-source">
|
2050
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 196</span>
|
2051
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stirling</span>(<span class="ruby-identifier">strln</span>)
|
2052
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">strln</span><span class="ruby-operator">/</span><span class="ruby-identifier">constants1</span>.<span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span><span class="ruby-identifier">strln</span>)<span class="ruby-operator">*</span><span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-value">2</span><span class="ruby-operator">*</span><span class="ruby-identifier">constants1</span>.<span class="ruby-constant">PIVALUE</span><span class="ruby-operator">*</span><span class="ruby-identifier">strln</span>);
|
2053
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2054
|
+
</div>
|
2055
|
+
</div>
|
2056
|
+
|
2057
|
+
</div>
|
2058
|
+
|
2059
|
+
<div class="method">
|
2060
|
+
<div class="title" id="M000085">
|
2061
|
+
|
2062
|
+
<a name="M000085"></a><b>stirling</b>(strln)
|
2063
|
+
|
2064
|
+
</div>
|
2065
|
+
|
2066
|
+
|
2067
|
+
|
2068
|
+
|
2069
|
+
<div class="sourcecode">
|
2070
|
+
<p class="source-link">
|
2071
|
+
Source: <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">show</a>
|
2072
|
+
|
2073
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/test/testprocedure.rb#L4" target="_blank" class="github_url">on GitHub</a>
|
2074
|
+
|
2075
|
+
</p>
|
2076
|
+
<div id="M000085_source" class="dyn-source">
|
2077
|
+
<pre><span class="ruby-comment cmt"># File test/testprocedure.rb, line 4</span>
|
2078
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stirling</span>(<span class="ruby-identifier">strln</span>)
|
2079
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">strln</span><span class="ruby-operator">/</span><span class="ruby-constant">EVALUE</span><span class="ruby-operator">**</span><span class="ruby-identifier">strln</span>)<span class="ruby-operator">*</span><span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-value">2</span><span class="ruby-operator">*</span><span class="ruby-constant">PIVALUE</span><span class="ruby-operator">*</span><span class="ruby-identifier">strln</span>);
|
2080
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2081
|
+
</div>
|
2082
|
+
</div>
|
2083
|
+
|
2084
|
+
</div>
|
2085
|
+
|
2086
|
+
<div class="method">
|
2087
|
+
<div class="title" id="M000049">
|
2088
|
+
|
2089
|
+
<a name="M000049"></a><b>subset</b>(gen, zerosbst)
|
2090
|
+
|
2091
|
+
</div>
|
2092
|
+
|
2093
|
+
|
2094
|
+
|
2095
|
+
|
2096
|
+
<div class="sourcecode">
|
2097
|
+
<p class="source-link">
|
2098
|
+
Source: <a href="javascript:toggleSource('M000049_source')" id="l_M000049_source">show</a>
|
2099
|
+
|
2100
|
+
</p>
|
2101
|
+
<div id="M000049_source" class="dyn-source">
|
2102
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 86</span>
|
2103
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subset</span>(<span class="ruby-identifier">gen</span>, <span class="ruby-identifier">zerosbst</span>)
|
2104
|
+
<span class="ruby-identifier">main</span> = <span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">zerosbst</span>)
|
2105
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">zerosbst</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'y'</span>
|
2106
|
+
<span class="ruby-identifier">rslt</span> = <span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">gen</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
2107
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rslt</span>
|
2108
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">zerosbst</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'n'</span>
|
2109
|
+
<span class="ruby-identifier">rslt</span> = <span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">gen</span>)
|
2110
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rslt</span>
|
2111
|
+
<span class="ruby-keyword kw">else</span>
|
2112
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Enter 'y' or 'n' char"</span>
|
2113
|
+
<span class="ruby-keyword kw">end</span>
|
2114
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">main</span>
|
2115
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2116
|
+
</div>
|
2117
|
+
</div>
|
2118
|
+
|
2119
|
+
</div>
|
2120
|
+
|
2121
|
+
<div class="method">
|
2122
|
+
<div class="title" id="M000026">
|
2123
|
+
|
2124
|
+
<a name="M000026"></a><b>subset</b>(gen, zerosbst)
|
2125
|
+
|
2126
|
+
</div>
|
2127
|
+
|
2128
|
+
|
2129
|
+
|
2130
|
+
|
2131
|
+
<div class="sourcecode">
|
2132
|
+
<p class="source-link">
|
2133
|
+
Source: <a href="javascript:toggleSource('M000026_source')" id="l_M000026_source">show</a>
|
2134
|
+
|
2135
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L87" target="_blank" class="github_url">on GitHub</a>
|
2136
|
+
|
2137
|
+
</p>
|
2138
|
+
<div id="M000026_source" class="dyn-source">
|
2139
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 87</span>
|
2140
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subset</span>(<span class="ruby-identifier">gen</span>, <span class="ruby-identifier">zerosbst</span>)
|
2141
|
+
<span class="ruby-identifier">main</span> = <span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">zerosbst</span>)
|
2142
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">zerosbst</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
|
2143
|
+
<span class="ruby-identifier">rslt</span> = <span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">gen</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
2144
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rslt</span>
|
2145
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">zerosbst</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
|
2146
|
+
<span class="ruby-identifier">rslt</span> = <span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">gen</span>)
|
2147
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rslt</span>
|
2148
|
+
<span class="ruby-keyword kw">end</span>
|
2149
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">main</span>
|
2150
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2151
|
+
</div>
|
2152
|
+
</div>
|
2153
|
+
|
2154
|
+
</div>
|
2155
|
+
|
2156
|
+
<div class="method">
|
2157
|
+
<div class="title" id="M000008">
|
2158
|
+
|
2159
|
+
<a name="M000008"></a><b>subset</b>(gen, zerosbst)
|
2160
|
+
|
2161
|
+
</div>
|
2162
|
+
|
2163
|
+
|
2164
|
+
|
2165
|
+
|
2166
|
+
<div class="sourcecode">
|
2167
|
+
<p class="source-link">
|
2168
|
+
Source: <a href="javascript:toggleSource('M000008_source')" id="l_M000008_source">show</a>
|
2169
|
+
|
2170
|
+
</p>
|
2171
|
+
<div id="M000008_source" class="dyn-source">
|
2172
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 86</span>
|
2173
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subset</span>(<span class="ruby-identifier">gen</span>, <span class="ruby-identifier">zerosbst</span>)
|
2174
|
+
<span class="ruby-identifier">main</span> = <span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">zerosbst</span>)
|
2175
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">zerosbst</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'y'</span>
|
2176
|
+
<span class="ruby-identifier">rslt</span> = <span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">gen</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
2177
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rslt</span>
|
2178
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">zerosbst</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'n'</span>
|
2179
|
+
<span class="ruby-identifier">rslt</span> = <span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">gen</span>)
|
2180
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rslt</span>
|
2181
|
+
<span class="ruby-keyword kw">else</span>
|
2182
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Enter 'y' or 'n' char"</span>
|
2183
|
+
<span class="ruby-keyword kw">end</span>
|
2184
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">main</span>
|
2185
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2186
|
+
</div>
|
2187
|
+
</div>
|
2188
|
+
|
2189
|
+
</div>
|
2190
|
+
|
2191
|
+
<div class="method">
|
2192
|
+
<div class="title" id="M000061">
|
2193
|
+
|
2194
|
+
<a name="M000061"></a><b>subset</b>(gen, zerosbst)
|
2195
|
+
|
2196
|
+
</div>
|
2197
|
+
|
2198
|
+
|
2199
|
+
|
2200
|
+
|
2201
|
+
<div class="sourcecode">
|
2202
|
+
<p class="source-link">
|
2203
|
+
Source: <a href="javascript:toggleSource('M000061_source')" id="l_M000061_source">show</a>
|
2204
|
+
|
2205
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L86" target="_blank" class="github_url">on GitHub</a>
|
2206
|
+
|
2207
|
+
</p>
|
2208
|
+
<div id="M000061_source" class="dyn-source">
|
2209
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 86</span>
|
2210
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subset</span>(<span class="ruby-identifier">gen</span>, <span class="ruby-identifier">zerosbst</span>)
|
2211
|
+
<span class="ruby-identifier">main</span> = <span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">zerosbst</span>)
|
2212
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">zerosbst</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'y'</span>
|
2213
|
+
<span class="ruby-identifier">rslt</span> = <span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">gen</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
2214
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rslt</span>
|
2215
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">zerosbst</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'n'</span>
|
2216
|
+
<span class="ruby-identifier">rslt</span> = <span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">gen</span>)
|
2217
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rslt</span>
|
2218
|
+
<span class="ruby-keyword kw">else</span>
|
2219
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Enter 'y' or 'n' char"</span>
|
2220
|
+
<span class="ruby-keyword kw">end</span>
|
2221
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">main</span>
|
2222
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2223
|
+
</div>
|
2224
|
+
</div>
|
2225
|
+
|
2226
|
+
</div>
|
2227
|
+
|
2228
|
+
<div class="method">
|
2229
|
+
<div class="title" id="M000077">
|
2230
|
+
|
2231
|
+
<a name="M000077"></a><b>sum_of_fib</b>(n)
|
2232
|
+
|
2233
|
+
</div>
|
2234
|
+
|
2235
|
+
|
2236
|
+
|
2237
|
+
|
2238
|
+
<div class="sourcecode">
|
2239
|
+
<p class="source-link">
|
2240
|
+
Source: <a href="javascript:toggleSource('M000077_source')" id="l_M000077_source">show</a>
|
2241
|
+
|
2242
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L356" target="_blank" class="github_url">on GitHub</a>
|
2243
|
+
|
2244
|
+
</p>
|
2245
|
+
<div id="M000077_source" class="dyn-source">
|
2246
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 356</span>
|
2247
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum_of_fib</span>(<span class="ruby-identifier">n</span>)
|
2248
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>)<span class="ruby-operator">-</span><span class="ruby-value">1</span>;
|
2249
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2250
|
+
</div>
|
2251
|
+
</div>
|
2252
|
+
|
2253
|
+
</div>
|
2254
|
+
|
2255
|
+
<div class="method">
|
2256
|
+
<div class="title" id="M000020">
|
2257
|
+
|
2258
|
+
<a name="M000020"></a><b>sum_of_fib</b>(n)
|
2259
|
+
|
2260
|
+
</div>
|
2261
|
+
|
2262
|
+
|
2263
|
+
|
2264
|
+
|
2265
|
+
<div class="sourcecode">
|
2266
|
+
<p class="source-link">
|
2267
|
+
Source: <a href="javascript:toggleSource('M000020_source')" id="l_M000020_source">show</a>
|
2268
|
+
|
2269
|
+
</p>
|
2270
|
+
<div id="M000020_source" class="dyn-source">
|
2271
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 356</span>
|
2272
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum_of_fib</span>(<span class="ruby-identifier">n</span>)
|
2273
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>)<span class="ruby-operator">-</span><span class="ruby-value">1</span>;
|
2274
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2275
|
+
</div>
|
2276
|
+
</div>
|
2277
|
+
|
2278
|
+
</div>
|
2279
|
+
|
2280
|
+
<div class="method">
|
2281
|
+
<div class="title" id="M000037">
|
2282
|
+
|
2283
|
+
<a name="M000037"></a><b>sum_of_fib</b>(n)
|
2284
|
+
|
2285
|
+
</div>
|
2286
|
+
|
2287
|
+
|
2288
|
+
|
2289
|
+
|
2290
|
+
<div class="sourcecode">
|
2291
|
+
<p class="source-link">
|
2292
|
+
Source: <a href="javascript:toggleSource('M000037_source')" id="l_M000037_source">show</a>
|
2293
|
+
|
2294
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L355" target="_blank" class="github_url">on GitHub</a>
|
2295
|
+
|
2296
|
+
</p>
|
2297
|
+
<div id="M000037_source" class="dyn-source">
|
2298
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 355</span>
|
2299
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum_of_fib</span>(<span class="ruby-identifier">n</span>)
|
2300
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>)<span class="ruby-operator">-</span><span class="ruby-value">1</span>;
|
2301
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2302
|
+
</div>
|
2303
|
+
</div>
|
2304
|
+
|
2305
|
+
</div>
|
2306
|
+
|
2307
|
+
<div class="method">
|
2308
|
+
<div class="title" id="M000064">
|
2309
|
+
|
2310
|
+
<a name="M000064"></a><b>sum_of_fib</b>(n)
|
2311
|
+
|
2312
|
+
</div>
|
2313
|
+
|
2314
|
+
|
2315
|
+
|
2316
|
+
|
2317
|
+
<div class="sourcecode">
|
2318
|
+
<p class="source-link">
|
2319
|
+
Source: <a href="javascript:toggleSource('M000064_source')" id="l_M000064_source">show</a>
|
2320
|
+
|
2321
|
+
</p>
|
2322
|
+
<div id="M000064_source" class="dyn-source">
|
2323
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 356</span>
|
2324
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum_of_fib</span>(<span class="ruby-identifier">n</span>)
|
2325
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fib</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>)<span class="ruby-operator">-</span><span class="ruby-value">1</span>;
|
2326
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2327
|
+
</div>
|
2328
|
+
</div>
|
2329
|
+
|
2330
|
+
</div>
|
2331
|
+
|
2332
|
+
<div class="method">
|
2333
|
+
<div class="title" id="M000040">
|
2334
|
+
|
2335
|
+
<a name="M000040"></a><b>to_bool</b>()
|
2336
|
+
|
2337
|
+
</div>
|
2338
|
+
|
2339
|
+
|
2340
|
+
|
2341
|
+
|
2342
|
+
<div class="sourcecode">
|
2343
|
+
<p class="source-link">
|
2344
|
+
Source: <a href="javascript:toggleSource('M000040_source')" id="l_M000040_source">show</a>
|
2345
|
+
|
2346
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L428" target="_blank" class="github_url">on GitHub</a>
|
2347
|
+
|
2348
|
+
</p>
|
2349
|
+
<div id="M000040_source" class="dyn-source">
|
2350
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 428</span>
|
2351
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bool</span>
|
2352
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_bool</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
|
2353
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"TRUE"</span>
|
2354
|
+
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_bool</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)
|
2355
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"FALSE"</span>
|
2356
|
+
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_bool</span> <span class="ruby-operator">==</span> <span class="ruby-value">-1</span>)
|
2357
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"NaN"</span>
|
2358
|
+
<span class="ruby-keyword kw">end</span>
|
2359
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2360
|
+
</div>
|
2361
|
+
</div>
|
2362
|
+
|
2363
|
+
</div>
|
2364
|
+
|
2365
|
+
<div class="method">
|
2366
|
+
<div class="title" id="M000070">
|
2367
|
+
|
2368
|
+
<a name="M000070"></a><b>twin_prdx</b>(mass)
|
2369
|
+
|
2370
|
+
</div>
|
2371
|
+
|
2372
|
+
|
2373
|
+
|
2374
|
+
|
2375
|
+
<div class="sourcecode">
|
2376
|
+
<p class="source-link">
|
2377
|
+
Source: <a href="javascript:toggleSource('M000070_source')" id="l_M000070_source">show</a>
|
2378
|
+
|
2379
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L212" target="_blank" class="github_url">on GitHub</a>
|
2380
|
+
|
2381
|
+
</p>
|
2382
|
+
<div id="M000070_source" class="dyn-source">
|
2383
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 212</span>
|
2384
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">twin_prdx</span>(<span class="ruby-identifier">mass</span>)
|
2385
|
+
<span class="ruby-identifier">top</span>=<span class="ruby-value">1</span>
|
2386
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">366</span><span class="ruby-operator">..</span><span class="ruby-value">366</span><span class="ruby-operator">-</span><span class="ruby-identifier">mass</span>
|
2387
|
+
<span class="ruby-identifier">top</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">i</span>
|
2388
|
+
<span class="ruby-keyword kw">end</span>
|
2389
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">top</span><span class="ruby-operator">/</span><span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">366</span>, <span class="ruby-identifier">mass</span>)
|
2390
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2391
|
+
</div>
|
2392
|
+
</div>
|
2393
|
+
|
2394
|
+
</div>
|
2395
|
+
|
2396
|
+
<div class="method">
|
2397
|
+
<div class="title" id="M000053">
|
2398
|
+
|
2399
|
+
<a name="M000053"></a><b>twin_prdx</b>(mass)
|
2400
|
+
|
2401
|
+
</div>
|
2402
|
+
|
2403
|
+
|
2404
|
+
|
2405
|
+
|
2406
|
+
<div class="sourcecode">
|
2407
|
+
<p class="source-link">
|
2408
|
+
Source: <a href="javascript:toggleSource('M000053_source')" id="l_M000053_source">show</a>
|
2409
|
+
|
2410
|
+
</p>
|
2411
|
+
<div id="M000053_source" class="dyn-source">
|
2412
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 212</span>
|
2413
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">twin_prdx</span>(<span class="ruby-identifier">mass</span>)
|
2414
|
+
<span class="ruby-identifier">top</span>=<span class="ruby-value">1</span>
|
2415
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">366</span><span class="ruby-operator">..</span><span class="ruby-value">366</span><span class="ruby-operator">-</span><span class="ruby-identifier">mass</span>
|
2416
|
+
<span class="ruby-identifier">top</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">i</span>
|
2417
|
+
<span class="ruby-keyword kw">end</span>
|
2418
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">top</span><span class="ruby-operator">/</span><span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">366</span>, <span class="ruby-identifier">mass</span>)
|
2419
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2420
|
+
</div>
|
2421
|
+
</div>
|
2422
|
+
|
2423
|
+
</div>
|
2424
|
+
|
2425
|
+
<div class="method">
|
2426
|
+
<div class="title" id="M000012">
|
2427
|
+
|
2428
|
+
<a name="M000012"></a><b>twin_prdx</b>(mass)
|
2429
|
+
|
2430
|
+
</div>
|
2431
|
+
|
2432
|
+
|
2433
|
+
|
2434
|
+
|
2435
|
+
<div class="sourcecode">
|
2436
|
+
<p class="source-link">
|
2437
|
+
Source: <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show</a>
|
2438
|
+
|
2439
|
+
</p>
|
2440
|
+
<div id="M000012_source" class="dyn-source">
|
2441
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 212</span>
|
2442
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">twin_prdx</span>(<span class="ruby-identifier">mass</span>)
|
2443
|
+
<span class="ruby-identifier">top</span>=<span class="ruby-value">1</span>
|
2444
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">366</span><span class="ruby-operator">..</span><span class="ruby-value">366</span><span class="ruby-operator">-</span><span class="ruby-identifier">mass</span>
|
2445
|
+
<span class="ruby-identifier">top</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">i</span>
|
2446
|
+
<span class="ruby-keyword kw">end</span>
|
2447
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">top</span><span class="ruby-operator">/</span><span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">366</span>, <span class="ruby-identifier">mass</span>)
|
2448
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2449
|
+
</div>
|
2450
|
+
</div>
|
2451
|
+
|
2452
|
+
</div>
|
2453
|
+
|
2454
|
+
<div class="method">
|
2455
|
+
<div class="title" id="M000030">
|
2456
|
+
|
2457
|
+
<a name="M000030"></a><b>twin_prdx</b>(mass)
|
2458
|
+
|
2459
|
+
</div>
|
2460
|
+
|
2461
|
+
|
2462
|
+
|
2463
|
+
|
2464
|
+
<div class="sourcecode">
|
2465
|
+
<p class="source-link">
|
2466
|
+
Source: <a href="javascript:toggleSource('M000030_source')" id="l_M000030_source">show</a>
|
2467
|
+
|
2468
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L211" target="_blank" class="github_url">on GitHub</a>
|
2469
|
+
|
2470
|
+
</p>
|
2471
|
+
<div id="M000030_source" class="dyn-source">
|
2472
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 211</span>
|
2473
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">twin_prdx</span>(<span class="ruby-identifier">mass</span>)
|
2474
|
+
<span class="ruby-identifier">top</span>=<span class="ruby-value">1</span>
|
2475
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">366</span><span class="ruby-operator">..</span><span class="ruby-value">366</span><span class="ruby-operator">-</span><span class="ruby-identifier">mass</span>
|
2476
|
+
<span class="ruby-identifier">top</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">i</span>
|
2477
|
+
<span class="ruby-keyword kw">end</span>
|
2478
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">top</span><span class="ruby-operator">/</span><span class="ruby-identifier">ui_pow</span>(<span class="ruby-value">366</span>, <span class="ruby-identifier">mass</span>)
|
2479
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2480
|
+
</div>
|
2481
|
+
</div>
|
2482
|
+
|
2483
|
+
</div>
|
2484
|
+
|
2485
|
+
<div class="method">
|
2486
|
+
<div class="title" id="M000047">
|
2487
|
+
|
2488
|
+
<a name="M000047"></a><b>ui_pow</b>(base, exp)
|
2489
|
+
|
2490
|
+
</div>
|
2491
|
+
|
2492
|
+
|
2493
|
+
|
2494
|
+
|
2495
|
+
<div class="sourcecode">
|
2496
|
+
<p class="source-link">
|
2497
|
+
Source: <a href="javascript:toggleSource('M000047_source')" id="l_M000047_source">show</a>
|
2498
|
+
|
2499
|
+
</p>
|
2500
|
+
<div id="M000047_source" class="dyn-source">
|
2501
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/bin/librbdiscrete.rb, line 42</span>
|
2502
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">base</span>, <span class="ruby-identifier">exp</span>)
|
2503
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">1</span>;
|
2504
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">exp</span>)
|
2505
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">exp</span> <span class="ruby-operator">&</span> <span class="ruby-value">1</span>)
|
2506
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
|
2507
|
+
<span class="ruby-keyword kw">end</span>
|
2508
|
+
<span class="ruby-identifier">exp</span> <span class="ruby-operator">>>=</span> <span class="ruby-value">1</span>;
|
2509
|
+
<span class="ruby-identifier">base</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
|
2510
|
+
<span class="ruby-keyword kw">end</span>
|
2511
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">exp</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>)
|
2512
|
+
<span class="ruby-identifier">result</span>=<span class="ruby-identifier">base</span>
|
2513
|
+
<span class="ruby-keyword kw">end</span>
|
2514
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
2515
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2516
|
+
</div>
|
2517
|
+
</div>
|
2518
|
+
|
2519
|
+
</div>
|
2520
|
+
|
2521
|
+
<div class="method">
|
2522
|
+
<div class="title" id="M000024">
|
2523
|
+
|
2524
|
+
<a name="M000024"></a><b>ui_pow</b>(base, exp)
|
2525
|
+
|
2526
|
+
</div>
|
2527
|
+
|
2528
|
+
|
2529
|
+
|
2530
|
+
|
2531
|
+
<div class="sourcecode">
|
2532
|
+
<p class="source-link">
|
2533
|
+
Source: <a href="javascript:toggleSource('M000024_source')" id="l_M000024_source">show</a>
|
2534
|
+
|
2535
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/lib/librbdiscrete.rb#L43" target="_blank" class="github_url">on GitHub</a>
|
2536
|
+
|
2537
|
+
</p>
|
2538
|
+
<div id="M000024_source" class="dyn-source">
|
2539
|
+
<pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 43</span>
|
2540
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">base</span>, <span class="ruby-identifier">exp</span>)
|
2541
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">1</span>;
|
2542
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">exp</span>)
|
2543
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">exp</span> <span class="ruby-operator">&</span> <span class="ruby-value">1</span>)
|
2544
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
|
2545
|
+
<span class="ruby-keyword kw">end</span>
|
2546
|
+
<span class="ruby-identifier">exp</span> <span class="ruby-operator">>>=</span> <span class="ruby-value">1</span>;
|
2547
|
+
<span class="ruby-identifier">base</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
|
2548
|
+
<span class="ruby-keyword kw">end</span>
|
2549
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">exp</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>)
|
2550
|
+
<span class="ruby-identifier">result</span>=<span class="ruby-identifier">base</span>
|
2551
|
+
<span class="ruby-keyword kw">end</span>
|
2552
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
2553
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2554
|
+
</div>
|
2555
|
+
</div>
|
2556
|
+
|
2557
|
+
</div>
|
2558
|
+
|
2559
|
+
<div class="method">
|
2560
|
+
<div class="title" id="M000001">
|
2561
|
+
|
2562
|
+
<a name="M000001"></a><b>ui_pow</b>(base, exp)
|
2563
|
+
|
2564
|
+
</div>
|
2565
|
+
|
2566
|
+
|
2567
|
+
|
2568
|
+
|
2569
|
+
<div class="sourcecode">
|
2570
|
+
<p class="source-link">
|
2571
|
+
Source: <a href="javascript:toggleSource('M000001_source')" id="l_M000001_source">show</a>
|
2572
|
+
|
2573
|
+
</p>
|
2574
|
+
<div id="M000001_source" class="dyn-source">
|
2575
|
+
<pre><span class="ruby-comment cmt"># File bin/librbdiscrete.rb, line 42</span>
|
2576
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">base</span>, <span class="ruby-identifier">exp</span>)
|
2577
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">1</span>;
|
2578
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">exp</span>)
|
2579
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">exp</span> <span class="ruby-operator">&</span> <span class="ruby-value">1</span>)
|
2580
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
|
2581
|
+
<span class="ruby-keyword kw">end</span>
|
2582
|
+
<span class="ruby-identifier">exp</span> <span class="ruby-operator">>>=</span> <span class="ruby-value">1</span>;
|
2583
|
+
<span class="ruby-identifier">base</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
|
2584
|
+
<span class="ruby-keyword kw">end</span>
|
2585
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">exp</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>)
|
2586
|
+
<span class="ruby-identifier">result</span>=<span class="ruby-identifier">base</span>
|
2587
|
+
<span class="ruby-keyword kw">end</span>
|
2588
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
2589
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2590
|
+
</div>
|
2591
|
+
</div>
|
2592
|
+
|
2593
|
+
</div>
|
2594
|
+
|
2595
|
+
<div class="method">
|
2596
|
+
<div class="title" id="M000058">
|
2597
|
+
|
2598
|
+
<a name="M000058"></a><b>ui_pow</b>(base, exp)
|
2599
|
+
|
2600
|
+
</div>
|
2601
|
+
|
2602
|
+
|
2603
|
+
|
2604
|
+
|
2605
|
+
<div class="sourcecode">
|
2606
|
+
<p class="source-link">
|
2607
|
+
Source: <a href="javascript:toggleSource('M000058_source')" id="l_M000058_source">show</a>
|
2608
|
+
|
2609
|
+
| <a href="http://github.com/regularlambda/RubMat/blob/800176e0eeead2a668661afd7c8b020ea4c7f766/pkg/RubMat-2.1.5/lib/librbdiscrete.rb#L42" target="_blank" class="github_url">on GitHub</a>
|
2610
|
+
|
2611
|
+
</p>
|
2612
|
+
<div id="M000058_source" class="dyn-source">
|
2613
|
+
<pre><span class="ruby-comment cmt"># File pkg/RubMat-2.1.5/lib/librbdiscrete.rb, line 42</span>
|
2614
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">base</span>, <span class="ruby-identifier">exp</span>)
|
2615
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">1</span>;
|
2616
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">exp</span>)
|
2617
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">exp</span> <span class="ruby-operator">&</span> <span class="ruby-value">1</span>)
|
2618
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
|
2619
|
+
<span class="ruby-keyword kw">end</span>
|
2620
|
+
<span class="ruby-identifier">exp</span> <span class="ruby-operator">>>=</span> <span class="ruby-value">1</span>;
|
2621
|
+
<span class="ruby-identifier">base</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
|
2622
|
+
<span class="ruby-keyword kw">end</span>
|
2623
|
+
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">exp</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>)
|
2624
|
+
<span class="ruby-identifier">result</span>=<span class="ruby-identifier">base</span>
|
2625
|
+
<span class="ruby-keyword kw">end</span>
|
2626
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
2627
|
+
<span class="ruby-keyword kw">end</span></pre>
|
2628
|
+
</div>
|
2629
|
+
</div>
|
2630
|
+
|
2631
|
+
</div>
|
2632
|
+
|
2633
|
+
</div>
|
2634
|
+
</div>
|
2635
|
+
</body>
|
2636
|
+
</html>
|