entropy 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +674 -0
  4. data/README.txt +48 -0
  5. data/Rakefile +22 -0
  6. data/doc/rdocs/Entropy.html +234 -0
  7. data/doc/rdocs/Entropy/Dict.html +311 -0
  8. data/doc/rdocs/Entropy/ProbabilityMetricSpace.html +544 -0
  9. data/doc/rdocs/Entropy/ProbabilitySpace.html +473 -0
  10. data/doc/rdocs/Entropy/Stream.html +281 -0
  11. data/doc/rdocs/LICENSE_txt.html +834 -0
  12. data/doc/rdocs/README_txt.html +138 -0
  13. data/doc/rdocs/created.rid +9 -0
  14. data/doc/rdocs/images/brick.png +0 -0
  15. data/doc/rdocs/images/brick_link.png +0 -0
  16. data/doc/rdocs/images/bug.png +0 -0
  17. data/doc/rdocs/images/bullet_black.png +0 -0
  18. data/doc/rdocs/images/bullet_toggle_minus.png +0 -0
  19. data/doc/rdocs/images/bullet_toggle_plus.png +0 -0
  20. data/doc/rdocs/images/date.png +0 -0
  21. data/doc/rdocs/images/find.png +0 -0
  22. data/doc/rdocs/images/loadingAnimation.gif +0 -0
  23. data/doc/rdocs/images/macFFBgHack.png +0 -0
  24. data/doc/rdocs/images/package.png +0 -0
  25. data/doc/rdocs/images/page_green.png +0 -0
  26. data/doc/rdocs/images/page_white_text.png +0 -0
  27. data/doc/rdocs/images/page_white_width.png +0 -0
  28. data/doc/rdocs/images/plugin.png +0 -0
  29. data/doc/rdocs/images/ruby.png +0 -0
  30. data/doc/rdocs/images/tag_green.png +0 -0
  31. data/doc/rdocs/images/wrench.png +0 -0
  32. data/doc/rdocs/images/wrench_orange.png +0 -0
  33. data/doc/rdocs/images/zoom.png +0 -0
  34. data/doc/rdocs/index.html +155 -0
  35. data/doc/rdocs/js/darkfish.js +116 -0
  36. data/doc/rdocs/js/jquery.js +32 -0
  37. data/doc/rdocs/js/quicksearch.js +114 -0
  38. data/doc/rdocs/js/thickbox-compressed.js +10 -0
  39. data/doc/rdocs/lib/entropy/dict_rb.html +56 -0
  40. data/doc/rdocs/lib/entropy/metric_space_rb.html +54 -0
  41. data/doc/rdocs/lib/entropy/probability_space_rb.html +52 -0
  42. data/doc/rdocs/lib/entropy/stream_rb.html +52 -0
  43. data/doc/rdocs/lib/entropy/version_rb.html +52 -0
  44. data/doc/rdocs/lib/entropy_rb.html +62 -0
  45. data/doc/rdocs/rdoc.css +763 -0
  46. data/entropy.gemspec +24 -0
  47. data/example/metric_prob_space.rb +42 -0
  48. data/example/prob_space.rb +31 -0
  49. data/lib/entropy.rb +13 -0
  50. data/lib/entropy/dict.rb +30 -0
  51. data/lib/entropy/metric_space.rb +116 -0
  52. data/lib/entropy/probability_space.rb +91 -0
  53. data/lib/entropy/stream.rb +37 -0
  54. data/lib/entropy/version.rb +3 -0
  55. data/test/stream0.txt +1 -0
  56. data/test/stream1.txt +1 -0
  57. data/test/stream2.txt +1 -0
  58. data/test/stream_random.bin +2 -0
  59. data/test/test_entropy_def.rb +10 -0
  60. data/test/test_entropy_metr.rb +36 -0
  61. data/test/test_entropy_prob.rb +64 -0
  62. data/test/test_entropy_stream.rb +29 -0
  63. metadata +127 -0
data/README.txt ADDED
@@ -0,0 +1,48 @@
1
+ = entropy-gem
2
+
3
+ This small gem provides methods to calculate the
4
+ entropy (and cardinality and diversity) of a probability
5
+ space and of a probability metric space.
6
+
7
+ A probability space is defined by a probability
8
+ vector [p1, p2, ..., pn]. A probability metric space
9
+ is defined by a probability vector and a metric function.
10
+ The metric function defines the "distance" between the point
11
+ i and the point j along with a distance matrix D where
12
+ D[i, j] = distance between i and j.
13
+
14
+ Most of the code is derived from:
15
+ http://golem.ph.utexas.edu/category/2008/10/entropy_diversity_and_cardinal.html
16
+ and
17
+ http://golem.ph.utexas.edu/category/2008/11/entropy_diversity_and_cardinal_1.html
18
+
19
+ In order to define a probability space, you can use the function add_stream to
20
+ add a stream of chars (or bit). The method compute the probability
21
+ vector using the frequency of each element of the stream. Otherwise
22
+ you could supply directly a probability vector as an array of reals.
23
+
24
+ For a probability metric space you should also define the distance metric,
25
+ either passing your function as a block to define_distance, or passing
26
+ a matrix to the same define_distance.
27
+
28
+ The example files show a basic usage of the classes.
29
+
30
+ NOTE: requires ruby >= 1.9
31
+
32
+ == Copyright
33
+
34
+ Copyright (c) 2011 hiraedd@hiraedd.com. See LICENSE.txt for further details.
35
+
36
+ This program is free software: you can redistribute it and/or modify
37
+ it under the terms of the GNU General Public License as published by
38
+ the Free Software Foundation, either version 3 of the License, or
39
+ (at your option) any later version.
40
+
41
+ This program is distributed in the hope that it will be useful,
42
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
43
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44
+ GNU General Public License for more details.
45
+
46
+ You should have received a copy of the GNU General Public License
47
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
48
+
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+ require 'rdoc/task'
4
+
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ #t.pattern = "test/**/test*.rb"
8
+ t.test_files = Dir.glob("test/**/test*.rb")
9
+ t.verbose = true
10
+ t.warning = true
11
+ end
12
+
13
+ desc 'generate API documentation to doc/rdocs/index.html'
14
+ RDoc::Task.new do |rdoc|
15
+ rdoc.main = 'README.txt'
16
+ rdoc.rdoc_dir = 'doc/rdocs'
17
+ rdoc.rdoc_files.include("README.txt", "LICENSE.txt", "lib/**/*.rb")
18
+ end
19
+
20
+ desc "Run tests"
21
+ task :default => :test
22
+
@@ -0,0 +1,234 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Module: Entropy</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="module">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="./index.html">Home</a>
25
+ <a href="./index.html#classes">Classes</a>
26
+ <a href="./index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="./lib/entropy_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/entropy.rb">lib/entropy.rb</a></li>
39
+
40
+ <li><a href="./lib/entropy/stream_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
41
+ class="thickbox" title="lib/entropy/stream.rb">lib/entropy/stream.rb</a></li>
42
+
43
+ <li><a href="./lib/entropy/probability_space_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
44
+ class="thickbox" title="lib/entropy/probability_space.rb">lib/entropy/probability_space.rb</a></li>
45
+
46
+ <li><a href="./lib/entropy/version_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
47
+ class="thickbox" title="lib/entropy/version.rb">lib/entropy/version.rb</a></li>
48
+
49
+ <li><a href="./lib/entropy/dict_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
50
+ class="thickbox" title="lib/entropy/dict.rb">lib/entropy/dict.rb</a></li>
51
+
52
+ <li><a href="./lib/entropy/metric_space_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
53
+ class="thickbox" title="lib/entropy/metric_space.rb">lib/entropy/metric_space.rb</a></li>
54
+
55
+ </ul>
56
+ </div>
57
+ </div>
58
+
59
+
60
+ </div>
61
+
62
+ <div id="class-metadata">
63
+
64
+
65
+
66
+
67
+
68
+ <!-- Namespace Contents -->
69
+ <div id="namespace-list-section" class="section">
70
+ <h3 class="section-header">Namespace</h3>
71
+ <ul class="link-list">
72
+
73
+ <li><span class="type">CLASS</span> <a href="Entropy/Dict.html">Entropy::Dict</a></li>
74
+
75
+ <li><span class="type">CLASS</span> <a href="Entropy/ProbabilityMetricSpace.html">Entropy::ProbabilityMetricSpace</a></li>
76
+
77
+ <li><span class="type">CLASS</span> <a href="Entropy/ProbabilitySpace.html">Entropy::ProbabilitySpace</a></li>
78
+
79
+ <li><span class="type">CLASS</span> <a href="Entropy/Stream.html">Entropy::Stream</a></li>
80
+
81
+ </ul>
82
+ </div>
83
+
84
+
85
+
86
+ <!-- Method Quickref -->
87
+ <div id="method-list-section" class="section">
88
+ <h3 class="section-header">Methods</h3>
89
+ <ul class="link-list">
90
+
91
+ <li><a href="#method-c-version_string">::version_string</a></li>
92
+
93
+ </ul>
94
+ </div>
95
+
96
+
97
+
98
+ </div>
99
+
100
+ <div id="project-metadata">
101
+
102
+
103
+ <div id="fileindex-section" class="section project-section">
104
+ <h3 class="section-header">Files</h3>
105
+ <ul>
106
+
107
+ <li class="file"><a href="./LICENSE_txt.html">LICENSE.txt</a></li>
108
+
109
+ <li class="file"><a href="./README_txt.html">README.txt</a></li>
110
+
111
+ </ul>
112
+ </div>
113
+
114
+
115
+ <div id="classindex-section" class="section project-section">
116
+ <h3 class="section-header">Class/Module Index
117
+ <span class="search-toggle"><img src="./images/find.png"
118
+ height="16" width="16" alt="[+]"
119
+ title="show/hide quicksearch" /></span></h3>
120
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
121
+ <fieldset>
122
+ <legend>Quicksearch</legend>
123
+ <input type="text" name="quicksearch" value=""
124
+ class="quicksearch-field" />
125
+ </fieldset>
126
+ </form>
127
+
128
+ <ul class="link-list">
129
+
130
+ <li><a href="./Entropy.html">Entropy</a></li>
131
+
132
+ <li><a href="./Entropy/Dict.html">Entropy::Dict</a></li>
133
+
134
+ <li><a href="./Entropy/ProbabilityMetricSpace.html">Entropy::ProbabilityMetricSpace</a></li>
135
+
136
+ <li><a href="./Entropy/ProbabilitySpace.html">Entropy::ProbabilitySpace</a></li>
137
+
138
+ <li><a href="./Entropy/Stream.html">Entropy::Stream</a></li>
139
+
140
+ </ul>
141
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
142
+ </div>
143
+
144
+
145
+ </div>
146
+ </div>
147
+
148
+ <div id="documentation">
149
+ <h1 class="module">Entropy</h1>
150
+
151
+ <div id="description" class="description">
152
+
153
+ </div><!-- description -->
154
+
155
+
156
+
157
+
158
+ <div id="5Buntitled-5D" class="documentation-section">
159
+
160
+
161
+
162
+
163
+
164
+ <!-- Constants -->
165
+ <div id="constants-list" class="section">
166
+ <h3 class="section-header">Constants</h3>
167
+ <dl>
168
+
169
+ <dt><a name="VERSION">VERSION</a></dt>
170
+
171
+ <dd class="description"></dd>
172
+
173
+
174
+ </dl>
175
+ </div>
176
+
177
+
178
+
179
+
180
+ <!-- Methods -->
181
+
182
+ <div id="public-class-method-details" class="method-section section">
183
+ <h3 class="section-header">Public Class Methods</h3>
184
+
185
+
186
+ <div id="version_string-method" class="method-detail ">
187
+ <a name="method-c-version_string"></a>
188
+
189
+
190
+ <div class="method-heading">
191
+ <span class="method-name">version_string</span><span
192
+ class="method-args">()</span>
193
+ <span class="method-click-advice">click to toggle source</span>
194
+ </div>
195
+
196
+
197
+ <div class="method-description">
198
+
199
+
200
+
201
+
202
+
203
+ <div class="method-source-code" id="version_string-source">
204
+ <pre>
205
+ <span class="ruby-comment"># File lib/entropy.rb, line 9</span>
206
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">version_string</span>
207
+ <span class="ruby-node">&quot;Entropy version #{Entropy::VERSION}&quot;</span>
208
+ <span class="ruby-keyword">end</span></pre>
209
+ </div><!-- version_string-source -->
210
+
211
+ </div>
212
+
213
+
214
+
215
+
216
+ </div><!-- version_string-method -->
217
+
218
+
219
+ </div><!-- public-class-method-details -->
220
+
221
+ </div><!-- 5Buntitled-5D -->
222
+
223
+
224
+ </div><!-- documentation -->
225
+
226
+ <div id="validator-badges">
227
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
228
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
229
+ Rdoc Generator</a> 2</small>.</p>
230
+ </div>
231
+
232
+ </body>
233
+ </html>
234
+
@@ -0,0 +1,311 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Entropy::Dict</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="../index.html">Home</a>
25
+ <a href="../index.html#classes">Classes</a>
26
+ <a href="../index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="../lib/entropy/dict_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/entropy/dict.rb">lib/entropy/dict.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link">Object</p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method Quickref -->
64
+ <div id="method-list-section" class="section">
65
+ <h3 class="section-header">Methods</h3>
66
+ <ul class="link-list">
67
+
68
+ <li><a href="#method-c-new">::new</a></li>
69
+
70
+ <li><a href="#method-i-freq">#freq</a></li>
71
+
72
+ <li><a href="#method-i-scan_keys">#scan_keys</a></li>
73
+
74
+ <li><a href="#method-i-upd">#upd</a></li>
75
+
76
+ </ul>
77
+ </div>
78
+
79
+
80
+
81
+ </div>
82
+
83
+ <div id="project-metadata">
84
+
85
+
86
+ <div id="fileindex-section" class="section project-section">
87
+ <h3 class="section-header">Files</h3>
88
+ <ul>
89
+
90
+ <li class="file"><a href="../LICENSE_txt.html">LICENSE.txt</a></li>
91
+
92
+ <li class="file"><a href="../README_txt.html">README.txt</a></li>
93
+
94
+ </ul>
95
+ </div>
96
+
97
+
98
+ <div id="classindex-section" class="section project-section">
99
+ <h3 class="section-header">Class/Module Index
100
+ <span class="search-toggle"><img src="../images/find.png"
101
+ height="16" width="16" alt="[+]"
102
+ title="show/hide quicksearch" /></span></h3>
103
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
104
+ <fieldset>
105
+ <legend>Quicksearch</legend>
106
+ <input type="text" name="quicksearch" value=""
107
+ class="quicksearch-field" />
108
+ </fieldset>
109
+ </form>
110
+
111
+ <ul class="link-list">
112
+
113
+ <li><a href="../Entropy.html">Entropy</a></li>
114
+
115
+ <li><a href="../Entropy/Dict.html">Entropy::Dict</a></li>
116
+
117
+ <li><a href="../Entropy/ProbabilityMetricSpace.html">Entropy::ProbabilityMetricSpace</a></li>
118
+
119
+ <li><a href="../Entropy/ProbabilitySpace.html">Entropy::ProbabilitySpace</a></li>
120
+
121
+ <li><a href="../Entropy/Stream.html">Entropy::Stream</a></li>
122
+
123
+ </ul>
124
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
125
+ </div>
126
+
127
+
128
+ </div>
129
+ </div>
130
+
131
+ <div id="documentation">
132
+ <h1 class="class">Entropy::Dict</h1>
133
+
134
+ <div id="description" class="description">
135
+
136
+ </div><!-- description -->
137
+
138
+
139
+
140
+
141
+ <div id="5Buntitled-5D" class="documentation-section">
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <!-- Methods -->
151
+
152
+ <div id="public-class-method-details" class="method-section section">
153
+ <h3 class="section-header">Public Class Methods</h3>
154
+
155
+
156
+ <div id="new-method" class="method-detail ">
157
+ <a name="method-c-new"></a>
158
+
159
+
160
+ <div class="method-heading">
161
+ <span class="method-name">new</span><span
162
+ class="method-args">()</span>
163
+ <span class="method-click-advice">click to toggle source</span>
164
+ </div>
165
+
166
+
167
+ <div class="method-description">
168
+
169
+
170
+
171
+
172
+
173
+ <div class="method-source-code" id="new-source">
174
+ <pre>
175
+ <span class="ruby-comment"># File lib/entropy/dict.rb, line 8</span>
176
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
177
+ <span class="ruby-ivar">@bucket</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
178
+ <span class="ruby-ivar">@space_size</span> = <span class="ruby-value">0</span>
179
+ <span class="ruby-keyword">end</span></pre>
180
+ </div><!-- new-source -->
181
+
182
+ </div>
183
+
184
+
185
+
186
+
187
+ </div><!-- new-method -->
188
+
189
+
190
+ </div><!-- public-class-method-details -->
191
+
192
+ <div id="public-instance-method-details" class="method-section section">
193
+ <h3 class="section-header">Public Instance Methods</h3>
194
+
195
+
196
+ <div id="freq-method" class="method-detail ">
197
+ <a name="method-i-freq"></a>
198
+
199
+
200
+ <div class="method-heading">
201
+ <span class="method-name">freq</span><span
202
+ class="method-args">(k)</span>
203
+ <span class="method-click-advice">click to toggle source</span>
204
+ </div>
205
+
206
+
207
+ <div class="method-description">
208
+
209
+ <p>Compute frequency of the element</p>
210
+
211
+
212
+
213
+ <div class="method-source-code" id="freq-source">
214
+ <pre>
215
+ <span class="ruby-comment"># File lib/entropy/dict.rb, line 20</span>
216
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">freq</span>(<span class="ruby-identifier">k</span>)
217
+ (<span class="ruby-ivar">@bucket</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">to_d</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@space_size</span>)
218
+ <span class="ruby-keyword">end</span></pre>
219
+ </div><!-- freq-source -->
220
+
221
+ </div>
222
+
223
+
224
+
225
+
226
+ </div><!-- freq-method -->
227
+
228
+
229
+ <div id="scan_keys-method" class="method-detail ">
230
+ <a name="method-i-scan_keys"></a>
231
+
232
+
233
+ <div class="method-heading">
234
+ <span class="method-name">scan_keys</span><span
235
+ class="method-args">()</span>
236
+ <span class="method-click-advice">click to toggle source</span>
237
+ </div>
238
+
239
+
240
+ <div class="method-description">
241
+
242
+ <p>Return all the elements of the space</p>
243
+
244
+
245
+
246
+ <div class="method-source-code" id="scan_keys-source">
247
+ <pre>
248
+ <span class="ruby-comment"># File lib/entropy/dict.rb, line 25</span>
249
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">scan_keys</span>
250
+ <span class="ruby-ivar">@bucket</span>.<span class="ruby-identifier">keys</span>
251
+ <span class="ruby-keyword">end</span></pre>
252
+ </div><!-- scan_keys-source -->
253
+
254
+ </div>
255
+
256
+
257
+
258
+
259
+ </div><!-- scan_keys-method -->
260
+
261
+
262
+ <div id="upd-method" class="method-detail ">
263
+ <a name="method-i-upd"></a>
264
+
265
+
266
+ <div class="method-heading">
267
+ <span class="method-name">upd</span><span
268
+ class="method-args">(k)</span>
269
+ <span class="method-click-advice">click to toggle source</span>
270
+ </div>
271
+
272
+
273
+ <div class="method-description">
274
+
275
+ <p>Add an element to the space</p>
276
+
277
+
278
+
279
+ <div class="method-source-code" id="upd-source">
280
+ <pre>
281
+ <span class="ruby-comment"># File lib/entropy/dict.rb, line 14</span>
282
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">upd</span>(<span class="ruby-identifier">k</span>)
283
+ <span class="ruby-ivar">@bucket</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
284
+ <span class="ruby-ivar">@space_size</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
285
+ <span class="ruby-keyword">end</span></pre>
286
+ </div><!-- upd-source -->
287
+
288
+ </div>
289
+
290
+
291
+
292
+
293
+ </div><!-- upd-method -->
294
+
295
+
296
+ </div><!-- public-instance-method-details -->
297
+
298
+ </div><!-- 5Buntitled-5D -->
299
+
300
+
301
+ </div><!-- documentation -->
302
+
303
+ <div id="validator-badges">
304
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
305
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
306
+ Rdoc Generator</a> 2</small>.</p>
307
+ </div>
308
+
309
+ </body>
310
+ </html>
311
+