Sha256: 9fb25c7517ec8432d8b6d051b0c128554e24d6b7649e3645866c903fefa12fe0
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>normalize (Vector)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File lib/classifier/extensions/vector.rb, line 23</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize</span> <span class="ruby-identifier">nv</span> = [] <span class="ruby-identifier">mag</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">magnitude</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nv</span> <span class="ruby-operator"><<</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">/</span> <span class="ruby-identifier">mag</span>) <span class="ruby-keyword kw">end</span> <span class="ruby-constant">Vector</span>[<span class="ruby-operator">*</span><span class="ruby-identifier">nv</span>] <span class="ruby-keyword kw">end</span></pre> </body> </html>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
classifier-1.3.0 | doc/classes/Vector.src/M000002.html |