apatite/docs/Apatite/LinearAlgebra/Vector.html

2199 lines
78 KiB
HTML
Raw Normal View History

2019-06-13 02:23:54 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.29.0">
<link href="../../css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../../js/doc.js"></script>
<script type="text/javascript">
CrystalDoc.base_path = "../../";
</script>
<meta id="repository-name" content="github.com/watzon/apatite">
<title>Apatite::LinearAlgebra::Vector - github.com/watzon/apatite</title>
</head>
<body>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="repository-links">
<a href="../../index.html">README</a>
</div>
</div>
<div class="search-results" class="hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="github.com/watzon/apatite/Apatite" data-name="apatite">
<a href="../../Apatite.html">Apatite</a>
<ul>
<li class="parent open current" data-id="github.com/watzon/apatite/Apatite/LinearAlgebra" data-name="apatite::linearalgebra">
<a href="../../Apatite/LinearAlgebra.html">LinearAlgebra</a>
<ul>
<li class=" " data-id="github.com/watzon/apatite/Apatite/LinearAlgebra/Matrix" data-name="apatite::linearalgebra::matrix">
<a href="../../Apatite/LinearAlgebra/Matrix.html">Matrix</a>
</li>
<li class=" " data-id="github.com/watzon/apatite/Apatite/LinearAlgebra/NDArray" data-name="apatite::linearalgebra::ndarray">
<a href="../../Apatite/LinearAlgebra/NDArray.html">NDArray</a>
</li>
<li class=" current" data-id="github.com/watzon/apatite/Apatite/LinearAlgebra/Vector" data-name="apatite::linearalgebra::vector">
<a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a>
</li>
</ul>
</li>
</ul>
</li>
<li class=" " data-id="github.com/watzon/apatite/Array" data-name="array(t)">
<a href="../../Array.html">Array</a>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">class</span> Apatite::LinearAlgebra::Vector
</h1>
<ul class="superclass-hierarchy"><li class="superclass"><a href="../../Apatite/LinearAlgebra/Vector.html">Apatite::LinearAlgebra::Vector</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
<h2>Overview</h2>
<p>Represents a mathematical vector, and also constitutes a row or column
of a <code><a href="../../Apatite/LinearAlgebra/Matrix.html">Matrix</a></code></p>
<h2>Included Modules</h2>
<ul class="other-types-list">
<li class="other-type">Comparable(<a href="../../Apatite/LinearAlgebra/Vector.html">Apatite::LinearAlgebra::Vector</a>)</li>
<li class="other-type">Enumerable(Float64)</li>
<li class="other-type">Indexable(Float64)</li>
</ul>
<h2>Defined in:</h2>
<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L4" target="_blank">
apatite/linear_algebra/vector.cr
</a>
<br/>
<h2>Constant Summary</h2>
<dl>
<dt class="entry-const" id="I">
<strong>I</strong> = <code><span class="t">Vector</span>.create([<span class="n">1.0</span>, <span class="n">0.0</span>, <span class="n">0.0</span>])</code>
</dt>
<dd class="entry-const-doc">
<p>Cartesian unit vector I</p>
</dd>
<dt class="entry-const" id="J">
<strong>J</strong> = <code><span class="t">Vector</span>.create([<span class="n">0.0</span>, <span class="n">1.0</span>, <span class="n">0.0</span>])</code>
</dt>
<dd class="entry-const-doc">
<p>Cartesian unit vector J</p>
</dd>
<dt class="entry-const" id="K">
<strong>K</strong> = <code><span class="t">Vector</span>.create([<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">1.0</span>])</code>
</dt>
<dd class="entry-const-doc">
<p>Cartesian unit vector K</p>
</dd>
</dl>
<h2>Constructors</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#build%28capacity%3AInt%2C%26block%29%3Aself-class-method" class="signature"><strong>.build</strong>(capacity : Int, &block) : <span class="k">self</span></a>
<div class="summary"><p>Creates a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code>, allocating an internal buffer with the given <em>capacity</em>, and yielding that buffer.</p></div>
</li>
<li class="entry-summary">
<a href="#new%28size%3AInt%2Cvalue%3AFloat64%29-class-method" class="signature"><strong>.new</strong>(size : Int, value : Float64)</a>
<div class="summary"><p>Creates a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> of the given <em>size</em> filled with the same <em>value</em> in each position.</p></div>
</li>
<li class="entry-summary">
<a href="#new%28initial_capacity%3AInt%29-class-method" class="signature"><strong>.new</strong>(initial_capacity : Int)</a>
<div class="summary"><p>Creates a new empty <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> backed by a buffer that is initially <code>initial_capacity</code> big.</p></div>
</li>
<li class="entry-summary">
<a href="#new-class-method" class="signature"><strong>.new</strong></a>
<div class="summary"><p>Create a new empty <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code>.</p></div>
</li>
<li class="entry-summary">
<a href="#new%28size%3AInt%2C%26block%3AInt32-%3EFloat64%29-class-method" class="signature"><strong>.new</strong>(size : Int, &block : Int32 -> Float64)</a>
<div class="summary"><p>Creates a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> of the given <em>size</em> and invokes the given block once for each index of <code>self</code>, assigning the block's value in that index.</p></div>
</li>
</ul>
<h2>Class Method Summary</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#%5B%5D%28%2Aarray%29-class-method" class="signature"><strong>.[]</strong>(*array)</a>
</li>
<li class="entry-summary">
<a href="#basis%28size%2Cindex%29-class-method" class="signature"><strong>.basis</strong>(size, index)</a>
<div class="summary"><p>Returns a standard basis n-vector.</p></div>
</li>
<li class="entry-summary">
<a href="#create%28elements%3AIndexable%28Number%29%29-class-method" class="signature"><strong>.create</strong>(elements : Indexable(Number))</a>
<div class="summary"><p>Creates a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> from the elements of another <code>Indexable</code> collection.</p></div>
</li>
<li class="entry-summary">
<a href="#ones%28n%29-class-method" class="signature"><strong>.ones</strong>(n)</a>
<div class="summary"><p>Create a new vector of size <code>n</code> filled with ones.</p></div>
</li>
<li class="entry-summary">
<a href="#random%28n%2Crange%3DFloat64%3A%3AMIN..Float64%3A%3AMAX%29-class-method" class="signature"><strong>.random</strong>(n, range = <span class="t">Float64</span><span class="t">::</span><span class="t">MIN</span>..<span class="t">Float64</span><span class="t">::</span><span class="t">MAX</span>)</a>
<div class="summary"><p>Generates a random vector of size <code>n</code> with elements in <code>range</code>.</p></div>
</li>
<li class="entry-summary">
<a href="#zeros%28n%29-class-method" class="signature"><strong>.zeros</strong>(n)</a>
<div class="summary"><p>Create a new vector of size <code>n</code> filled with zeros.</p></div>
</li>
</ul>
<h2>Instance Method Summary</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#%2A%28other%29-instance-method" class="signature"><strong>#*</strong>(other)</a>
</li>
<li class="entry-summary">
<a href="#%2B%28other%29-instance-method" class="signature"><strong>#+</strong>(other)</a>
</li>
<li class="entry-summary">
<a href="#-%28other%29-instance-method" class="signature"><strong>#-</strong>(other)</a>
</li>
<li class="entry-summary">
<a href="#%3C%3C%28value%3AFloat64%29-instance-method" class="signature"><strong>#<<</strong>(value : Float64)</a>
<div class="summary"><p>Alias for <code><a href="../../Apatite/LinearAlgebra/Vector.html#push%28%2Avalues%3AFloat64%29-instance-method">#push</a></code></p></div>
</li>
<li class="entry-summary">
<a href="#%28other%29-instance-method" class="signature"><strong>#<=></strong>(other)</a>
<div class="summary"><p>Combined comparison operator.</p></div>
</li>
<li class="entry-summary">
<a href="#%3D%3D%28other%3AVector%29-instance-method" class="signature"><strong>#==</strong>(other : Vector)</a>
</li>
<li class="entry-summary">
<a href="#%5B%5D%28start%3AInt%2Ccount%3AInt%29-instance-method" class="signature"><strong>#[]</strong>(start : Int, count : Int)</a>
<div class="summary"><p>Returns count or less (if there aren't enough) elements starting at the given start index.</p></div>
</li>
<li class="entry-summary">
<a href="#%5B%5D%28range%3ARange%28Int%2CInt%29%29-instance-method" class="signature"><strong>#[]</strong>(range : Range(Int, Int))</a>
<div class="summary"><p>Returns all elements that are within the given range.</p></div>
</li>
<li class="entry-summary">
<a href="#%5B%5D%3D%28index%3AInt%2Ccount%3AInt%2Cvalues%3AVector%29-instance-method" class="signature"><strong>#[]=</strong>(index : Int, count : Int, values : Vector)</a>
<div class="summary"><p>Replaces a subrange with the elements of the given vector.</p></div>
</li>
<li class="entry-summary">
<a href="#%5B%5D%3D%28index%3AInt%2Ccount%3AInt%2Cvalue%29-instance-method" class="signature"><strong>#[]=</strong>(index : Int, count : Int, value)</a>
<div class="summary"><p>Replaces a subrange with a single value.</p></div>
</li>
<li class="entry-summary">
<a href="#%5B%5D%3D%28index%3AInt%2Cvalue%29-instance-method" class="signature"><strong>#[]=</strong>(index : Int, value)</a>
<div class="summary"><p>Sets the given value at the given index.</p></div>
</li>
<li class="entry-summary">
<a href="#%5B%5D%3D%28range%3ARange%28Int%2CInt%29%2Cvalue%29-instance-method" class="signature"><strong>#[]=</strong>(range : Range(Int, Int), value)</a>
<div class="summary"><p>Replaces a subrange with a single value.</p></div>
</li>
<li class="entry-summary">
<a href="#add%28value%29-instance-method" class="signature"><strong>#add</strong>(value)</a>
<div class="summary"><p>When the input is a number, this returns the result of adding it to all vector elements.</p></div>
</li>
<li class="entry-summary">
<a href="#angle_from%28vector%29-instance-method" class="signature"><strong>#angle_from</strong>(vector)</a>
<div class="summary"><p>Returns the angle between this vector and another in radians.</p></div>
</li>
<li class="entry-summary">
<a href="#antiparallel_to%3F%28vector%29-instance-method" class="signature"><strong>#antiparallel_to?</strong>(vector)</a>
<div class="summary"><p>Returns whether the vectors are antiparallel to each other.</p></div>
</li>
<li class="entry-summary">
<a href="#augment%28elements%29-instance-method" class="signature"><strong>#augment</strong>(elements)</a>
<div class="summary"><p>Returns a new vector with the provided <code>elements</code> concatenated on the end.</p></div>
</li>
<li class="entry-summary">
<a href="#chomp%28n%29-instance-method" class="signature"><strong>#chomp</strong>(n)</a>
<div class="summary"><p>Returns a new vector with the first <code>n</code> elements removed from the beginning.</p></div>
</li>
<li class="entry-summary">
<a href="#clear-instance-method" class="signature"><strong>#clear</strong></a>
<div class="summary"><p>Removes all elements from self.</p></div>
</li>
<li class="entry-summary">
<a href="#clone-instance-method" class="signature"><strong>#clone</strong></a>
</li>
<li class="entry-summary">
<a href="#concat%28other%3AVector%29-instance-method" class="signature"><strong>#concat</strong>(other : Vector)</a>
</li>
<li class="entry-summary">
<a href="#covector-instance-method" class="signature"><strong>#covector</strong></a>
<div class="summary"><p>Creates a single-row matrix from this vector.</p></div>
</li>
<li class="entry-summary">
<a href="#cross%28%2Avs%29-instance-method" class="signature"><strong>#cross</strong>(*vs)</a>
<div class="summary"><p>Returns the cross product of this vector with the others.</p></div>
</li>
<li class="entry-summary">
<a href="#distance_from%28obj%29-instance-method" class="signature"><strong>#distance_from</strong>(obj)</a>
<div class="summary"><p>Gets this vector's distance from the argument, when considered a point in space.</p></div>
</li>
<li class="entry-summary">
<a href="#dot%28other%29-instance-method" class="signature"><strong>#dot</strong>(other)</a>
<div class="summary"><p>Get the scalar (dot) product of this vector with <code>vector</code>.</p></div>
</li>
<li class="entry-summary">
<a href="#e%28i%29-instance-method" class="signature"><strong>#e</strong>(i)</a>
<div class="summary"><p>Returns the <code>ith</code> element of the vector.</p></div>
</li>
<li class="entry-summary">
<a href="#independent%3F%28%2Avs%29-instance-method" class="signature"><strong>#independent?</strong>(*vs)</a>
<div class="summary"><p>Returns true if all vectors are linearly independent.</p></div>
</li>
<li class="entry-summary">
<a href="#lies_in%28plane%29-instance-method" class="signature"><strong>#lies_in</strong>(plane)</a>
<div class="summary"><p>Returns true if the vector is a point on the given plane.</p></div>
</li>
<li class="entry-summary">
<a href="#lies_on%28line%29-instance-method" class="signature"><strong>#lies_on</strong>(line)</a>
<div class="summary"><p>Returns true if the vector is a point on the given line</p></div>
</li>
<li class="entry-summary">
<a href="#log-instance-method" class="signature"><strong>#log</strong></a>
<div class="summary"><p>Return a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> with the log of every item in <code>self</code>.</p></div>
</li>
<li class="entry-summary">
<a href="#magnitude-instance-method" class="signature"><strong>#magnitude</strong></a>
<div class="summary"><p>Returns the magnitude/euclidian norm of this vector.</p></div>
</li>
<li class="entry-summary">
<a href="#map%28%26block%29-instance-method" class="signature"><strong>#map</strong>(&block)</a>
<div class="summary"><p>Invokes the given block for each element of <code>self</code>.</p></div>
</li>
<li class="entry-summary">
<a href="#map%21%28%26block%29-instance-method" class="signature"><strong>#map!</strong>(&block)</a>
<div class="summary"><p>Invokes the given block for each element of <code>self</code>, replacing the element with the value returned by the block.</p></div>
</li>
<li class="entry-summary">
<a href="#map_with_index%28%26block%29-instance-method" class="signature"><strong>#map_with_index</strong>(&block)</a>
<div class="summary"><p>Optimized version of <code>Enumerable#map_with_index</code>.</p></div>
</li>
<li class="entry-summary">
<a href="#map_with_index%21%28%26block%29-instance-method" class="signature"><strong>#map_with_index!</strong>(&block)</a>
<div class="summary"><p>Like <code><a href="../../Apatite/LinearAlgebra/Vector.html#map_with_index%28%26block%29-instance-method">#map_with_index</a></code>, but mutates <code>self</code> instead of allocating a new object.</p></div>
</li>
<li class="entry-summary">
<a href="#max-instance-method" class="signature"><strong>#max</strong></a>
<div class="summary"><p>Returns the (absolute) largest element in this vector.</p></div>
</li>
<li class="entry-summary">
<a href="#max_index-instance-method" class="signature"><strong>#max_index</strong></a>
<div class="summary"><p>Gets the index of the largest element in this vector.</p></div>
</li>
<li class="entry-summary">
<a href="#multiply%28value%29-instance-method" class="signature"><strong>#multiply</strong>(value)</a>
<div class="summary"><p>When the input is a number, this returns the result of multiplying it to all vector elements.</p></div>
</li>
<li class="entry-summary">
<a href="#parallel_to%3F%28vector%29-instance-method" class="signature"><strong>#parallel_to?</strong>(vector)</a>
<div class="summary"><p>Returns whether the vectors are parallel to each other.</p></div>
</li>
<li class="entry-summary">
<a href="#perpendicular_to%3F%28vector%29-instance-method" class="signature"><strong>#perpendicular_to?</strong>(vector)</a>
<div class="summary"><p>Returns whether the vectors are perpendicular to each other.</p></div>
</li>
<li class="entry-summary">
<a href="#pretty_print%28pp%29%3ANil-instance-method" class="signature"><strong>#pretty_print</strong>(pp) : Nil</a>
</li>
<li class="entry-summary">
<a href="#product-instance-method" class="signature"><strong>#product</strong></a>
<div class="summary"><p>Get the product of all elements in this vector.</p></div>
</li>
<li class="entry-summary">
<a href="#push%28%2Avalues%3AFloat64%29-instance-method" class="signature"><strong>#push</strong>(*values : Float64)</a>
</li>
<li class="entry-summary">
<a href="#push%28value%3AFloat64%29-instance-method" class="signature"><strong>#push</strong>(value : Float64)</a>
</li>
<li class="entry-summary">
<a href="#reflection_in%28object%29-instance-method" class="signature"><strong>#reflection_in</strong>(object)</a>
<div class="summary"><p>Returns the result of reflecting the point in the given <code>object</code> (point, line, or plane).</p></div>
</li>
<li class="entry-summary">
<a href="#rotate%28t%2Cobject%29-instance-method" class="signature"><strong>#rotate</strong>(t, object)</a>
<div class="summary"><p>Rotates the vector about the given <code>object</code>.</p></div>
</li>
<li class="entry-summary">
<a href="#round-instance-method" class="signature"><strong>#round</strong></a>
<div class="summary"><p>Gets the result of rounding the elements of the vector.</p></div>
</li>
<li class="entry-summary">
<a href="#set_elements%28elements%29-instance-method" class="signature"><strong>#set_elements</strong>(elements)</a>
</li>
<li class="entry-summary">
<a href="#sigmoid-instance-method" class="signature"><strong>#sigmoid</strong></a>
<div class="summary"><p>Sums the numbers in the vector and returns a sigmoid value across the whole vector.</p></div>
</li>
<li class="entry-summary">
<a href="#size%3AInt32-instance-method" class="signature"><strong>#size</strong> : Int32</a>
<div class="summary"><p>Returns the number of elements in the vector</p></div>
</li>
<li class="entry-summary">
<a href="#snap_to%28value%29-instance-method" class="signature"><strong>#snap_to</strong>(value)</a>
<div class="summary"><p>Returns a copy of the vector with elements set to <code>value</code> if they differ from it by less than <code>Apetite.precision</code></p></div>
</li>
<li class="entry-summary">
<a href="#subtract%28value%29-instance-method" class="signature"><strong>#subtract</strong>(value)</a>
<div class="summary"><p>When the input is a number, this returns the result of subtracting it to all vector elements.</p></div>
</li>
<li class="entry-summary">
<a href="#sum-instance-method" class="signature"><strong>#sum</strong></a>
<div class="summary"><p>Returns the sum of all elements in the vector.</p></div>
</li>
<li class="entry-summary">
<a href="#to_3d-instance-method" class="signature"><strong>#to_3d</strong></a>
<div class="summary"><p>Utility to make sure vectors are 3D.</p></div>
</li>
<li class="entry-summary">
<a href="#to_a-instance-method" class="signature"><strong>#to_a</strong></a>
</li>
<li class="entry-summary">
<a href="#to_diagonal_matrix-instance-method" class="signature"><strong>#to_diagonal_matrix</strong></a>
<div class="summary"><p>Returns a diagonal <code><a href="../../Apatite/LinearAlgebra/Matrix.html">Matrix</a></code> with the vectors elements as its diagonal elements.</p></div>
</li>
<li class="entry-summary">
<a href="#to_s%28io%29-instance-method" class="signature"><strong>#to_s</strong>(io)</a>
</li>
<li class="entry-summary">
<a href="#to_unit_vector-instance-method" class="signature"><strong>#to_unit_vector</strong></a>
<div class="summary"><p>Returns a new vector created by normalizing this one to have a magnitude of <code>1</code>.</p></div>
</li>
<li class="entry-summary">
<a href="#to_unsafe%3APointer%28Float64%29-instance-method" class="signature"><strong>#to_unsafe</strong> : Pointer(Float64)</a>
<div class="summary"><p>Returns a pointer to the internal buffer where <code>self</code>'s elements are stored.</p></div>
</li>
<li class="entry-summary">
<a href="#top%28n%29-instance-method" class="signature"><strong>#top</strong>(n)</a>
<div class="summary"><p>Returns a vector containing only the first <code>n</code> elements.</p></div>
</li>
<li class="entry-summary">
<a href="#transpose-instance-method" class="signature"><strong>#transpose</strong></a>
<div class="summary"><p>Transpose this vector into a 1xn <code><a href="../../Apatite/LinearAlgebra/Matrix.html">Matrix</a></code></p></div>
</li>
<li class="entry-summary">
<a href="#unsafe_fetch%28index%3AInt%29-instance-method" class="signature"><strong>#unsafe_fetch</strong>(index : Int)</a>
</li>
<li class="entry-summary">
<a href="#zero%3F-instance-method" class="signature"><strong>#zero?</strong></a>
</li>
</ul>
<div class="methods-inherited">
</div>
<h2>Constructor Detail</h2>
<div class="entry-detail" id="build(capacity:Int,&amp;block):self-class-method">
<div class="signature">
def self.<strong>build</strong>(capacity : Int, &block) : <span class="k">self</span>
<a class="method-permalink" href="#build%28capacity%3AInt%2C%26block%29%3Aself-class-method">#</a>
</div>
<div class="doc"><p>Creates a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code>, allocating an internal buffer with the given <em>capacity</em>,
and yielding that buffer. The given block must return the desired size of the vector.</p>
<p>This method is <strong>unsafe</strong>.</p>
<pre><code><span class="t">Vector</span>.build(<span class="n">3</span>) <span class="k">do</span> <span class="o">|</span>buffer<span class="o">|</span>
<span class="t">LibSome</span>.fill_buffer_and_return_number_of_elements_filled(buffer)
<span class="k">end</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L106" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="new(size:Int,value:Float64)-class-method">
<div class="signature">
def self.<strong>new</strong>(size : Int, value : Float64)
<a class="method-permalink" href="#new%28size%3AInt%2Cvalue%3AFloat64%29-class-method">#</a>
</div>
<div class="doc"><p>Creates a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> of the given <em>size</em> filled with the same <em>value</em> in each position.</p>
<pre><code><span class="t">Vector</span>.<span class="k">new</span>(<span class="n">3</span>, <span class="n">1.0</span>) <span class="c"># =&gt; Vector{1.0, 1.0, 1.0}</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L63" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="new(initial_capacity:Int)-class-method">
<div class="signature">
def self.<strong>new</strong>(initial_capacity : Int)
<a class="method-permalink" href="#new%28initial_capacity%3AInt%29-class-method">#</a>
</div>
<div class="doc"><p>Creates a new empty <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> backed by a buffer that is initially
<code>initial_capacity</code> big.</p>
<p>The <em>initial_capacity</em> is useful to avoid unnecessary reallocations
of the internal buffer in case of growth. If you have an estimate
of the maximum number of elements an vector will hold, the vector should
be initialized with that capacity for improved performance.</p>
<pre><code>vec <span class="o">=</span> <span class="t">Vector</span>.<span class="k">new</span>(<span class="n">5</span>)
vec.size <span class="c"># =&gt; 0</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L43" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="new-class-method">
<div class="signature">
def self.<strong>new</strong>
<a class="method-permalink" href="#new-class-method">#</a>
</div>
<div class="doc"><p>Create a new empty <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code>.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L25" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="new(size:Int,&amp;block:Int32-&gt;Float64)-class-method">
<div class="signature">
def self.<strong>new</strong>(size : Int, &block : Int32 -> Float64)
<a class="method-permalink" href="#new%28size%3AInt%2C%26block%3AInt32-%3EFloat64%29-class-method">#</a>
</div>
<div class="doc"><p>Creates a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> of the given <em>size</em> and invokes the given block once
for each index of <code>self</code>, assigning the block's value in that index.</p>
<pre><code><span class="t">Vector</span>.<span class="k">new</span>(<span class="n">3</span>) { <span class="o">|</span>i<span class="o">|</span> (i <span class="o">+</span> <span class="n">1.0</span>) <span class="o">**</span> <span class="n">2.0</span> } <span class="c"># =&gt; Vector{1.0, 4.0, 9.0}</span>
vec <span class="o">=</span> <span class="t">Vector</span>.<span class="k">new</span>(<span class="n">3</span>) { <span class="n">5.0</span> }
vec <span class="c"># =&gt; Vector{5.0, 5.0, 5.0}</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L87" target="_blank">View source</a>]
</div>
</div>
<h2>Class Method Detail</h2>
<div class="entry-detail" id="[](*array)-class-method">
<div class="signature">
def self.<strong>[]</strong>(*array)
<a class="method-permalink" href="#%5B%5D%28%2Aarray%29-class-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L156" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="basis(size,index)-class-method">
<div class="signature">
def self.<strong>basis</strong>(size, index)
<a class="method-permalink" href="#basis%28size%2Cindex%29-class-method">#</a>
</div>
<div class="doc"><p>Returns a standard basis n-vector.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L138" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="create(elements:Indexable(Number))-class-method">
<div class="signature">
def self.<strong>create</strong>(elements : Indexable(Number))
<a class="method-permalink" href="#create%28elements%3AIndexable%28Number%29%29-class-method">#</a>
</div>
<div class="doc"><p>Creates a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> from the elements of another <code>Indexable</code>
collection.</p>
<pre><code><span class="t">Vector</span>.create([<span class="n">1</span>, <span class="n">2</span>, <span class="n">3</span>]) <span class="c"># Vector{1.0, 2.0, 3.0}</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L118" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="ones(n)-class-method">
<div class="signature">
def self.<strong>ones</strong>(n)
<a class="method-permalink" href="#ones%28n%29-class-method">#</a>
</div>
<div class="doc"><p>Create a new vector of size <code>n</code> filled with ones.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L152" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="random(n,range=Float64::MIN..Float64::MAX)-class-method">
<div class="signature">
def self.<strong>random</strong>(n, range = <span class="t">Float64</span><span class="t">::</span><span class="t">MIN</span>..<span class="t">Float64</span><span class="t">::</span><span class="t">MAX</span>)
<a class="method-permalink" href="#random%28n%2Crange%3DFloat64%3A%3AMIN..Float64%3A%3AMAX%29-class-method">#</a>
</div>
<div class="doc"><p>Generates a random vector of size <code>n</code> with elements
in <code>range</code>.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L128" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="zeros(n)-class-method">
<div class="signature">
def self.<strong>zeros</strong>(n)
<a class="method-permalink" href="#zeros%28n%29-class-method">#</a>
</div>
<div class="doc"><p>Create a new vector of size <code>n</code> filled with zeros.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L147" target="_blank">View source</a>]
</div>
</div>
<h2>Instance Method Detail</h2>
<div class="entry-detail" id="*(other)-instance-method">
<div class="signature">
def <strong>*</strong>(other)
<a class="method-permalink" href="#%2A%28other%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L370" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="+(other)-instance-method">
<div class="signature">
def <strong>+</strong>(other)
<a class="method-permalink" href="#%2B%28other%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L362" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="-(other)-instance-method">
<div class="signature">
def <strong>-</strong>(other)
<a class="method-permalink" href="#-%28other%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L366" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="&lt;&lt;(value:Float64)-instance-method">
<div class="signature">
def <strong><<</strong>(value : Float64)
<a class="method-permalink" href="#%3C%3C%28value%3AFloat64%29-instance-method">#</a>
</div>
<div class="doc"><p>Alias for <code><a href="../../Apatite/LinearAlgebra/Vector.html#push%28%2Avalues%3AFloat64%29-instance-method">#push</a></code></p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L349" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="(other)-instance-method">
<div class="signature">
def <strong><=></strong>(other)
<a class="method-permalink" href="#%28other%29-instance-method">#</a>
</div>
<div class="doc"><p>Combined comparison operator. Returns <em>0</em> if <code>self</code> equals <em>other</em>, <em>1</em> if
<code>self</code> is greater than <em>other</em> and <em>-1</em> if <code>self</code> is smaller than <em>other</em>.</p>
<p>It compares the elements of both vectors in the same position using the
<code><a href="../../Apatite/LinearAlgebra/Vector.html#%28other%29-instance-method">#<=></a></code> operator. As soon as one of such comparisons returns a non-zero
value, that result is the return value of the comparison.</p>
<p>If all elements are equal, the comparison is based on the size of the vectors.</p>
<pre><code><span class="t">Vector</span>{<span class="n">8.0</span>} <span class="o">&lt;=&gt;</span> <span class="t">Vector</span>(<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>} <span class="c"># =&gt; 1</span>
<span class="t">Vector</span>{<span class="n">2.0</span>} <span class="o">&lt;=&gt;</span> <span class="t">Vector</span>{<span class="n">4.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>} <span class="c"># =&gt; -1</span>
<span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>} <span class="o">&lt;=&gt;</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>} <span class="c"># =&gt; 0</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L339" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="==(other:Vector)-instance-method">
<div class="signature">
def <strong>==</strong>(other : <a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a>)
<a class="method-permalink" href="#%3D%3D%28other%3AVector%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L353" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="[](start:Int,count:Int)-instance-method">
<div class="signature">
def <strong>[]</strong>(start : Int, count : Int)
<a class="method-permalink" href="#%5B%5D%28start%3AInt%2Ccount%3AInt%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns count or less (if there aren't enough) elements starting at the
given start index.</p>
<p>Negative indices count backward from the end of the vector (-1 is the last
element). Additionally, an empty vector is returned when the starting index
for an element range is at the end of the vector.</p>
<p>Raises <code>IndexError</code> if the starting index is out of range.</p>
<pre><code>v <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>, <span class="n">4.0</span>, <span class="n">5.0</span>}
v[<span class="n">1</span>, <span class="n">3</span>] <span class="c"># =&gt; Vector{2.0, 3.0, 4.0}</span>
v[<span class="n">6</span>, <span class="n">10</span>] <span class="c"># raise IndexError</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L191" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="[](range:Range(Int,Int))-instance-method">
<div class="signature">
def <strong>[]</strong>(range : Range(Int, Int))
<a class="method-permalink" href="#%5B%5D%28range%3ARange%28Int%2CInt%29%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns all elements that are within the given range.</p>
<p>Negative indices count backward from the end of the vector (-1 is the last
element). Additionally, an empty vector is returned when the starting index
for an element range is at the end of the vector.</p>
<p>Raises <code>IndexError</code> if the starting index is out of range.</p>
<pre><code>v <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>, <span class="n">4.0</span>, <span class="n">5.0</span>}
v[<span class="n">1</span>..<span class="n">3</span>] <span class="c"># =&gt; Vector{2.0, 3.0, 4.0}</span>
v[<span class="n">6</span>..<span class="n">10</span>] <span class="c"># raise IndexError</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L173" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="[]=(index:Int,count:Int,values:Vector)-instance-method">
<div class="signature">
def <strong>[]=</strong>(index : Int, count : Int, values : <a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a>)
<a class="method-permalink" href="#%5B%5D%3D%28index%3AInt%2Ccount%3AInt%2Cvalues%3AVector%29-instance-method">#</a>
</div>
<div class="doc"><p>Replaces a subrange with the elements of the given vector.</p>
<pre><code>vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>, <span class="n">4.0</span>, <span class="n">5.0</span>}
vec[<span class="n">1</span>, <span class="n">3</span>] <span class="o">=</span> <span class="t">Vector</span>{<span class="n">6.0</span>, <span class="n">7.0</span>, <span class="n">8.0</span>}
vec <span class="c"># = Vector{1.0, 6.0, 7.0, 8.0, 5.0}</span>
vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>, <span class="n">4.0</span>, <span class="n">5.0</span>}
vec[<span class="n">1</span>, <span class="n">3</span>] <span class="o">=</span> <span class="t">Vector</span>{<span class="n">6.0</span>, <span class="n">7.0</span>}
vec <span class="c"># = Vector{1.0, 6.0, 7.0, 5.0}</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L297" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="[]=(index:Int,count:Int,value)-instance-method">
<div class="signature">
def <strong>[]=</strong>(index : Int, count : Int, value)
<a class="method-permalink" href="#%5B%5D%3D%28index%3AInt%2Ccount%3AInt%2Cvalue%29-instance-method">#</a>
</div>
<div class="doc"><p>Replaces a subrange with a single value. All elements in the range
<code>index...index+count</code> are removed and replaced by a single element
<em>value</em>.</p>
<p>If <em>count</em> is zero, <em>value</em> is inserted at <em>index</em>.</p>
<p>Negative values of <em>index</em> count from the end of the vector.</p>
<pre><code>vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>, <span class="n">4.0</span>, <span class="n">5.0</span>}
vec[<span class="n">1</span>, <span class="n">3</span>] <span class="o">=</span> <span class="n">6.0</span>
vec <span class="c"># =&gt; Vector{1.0, 6.0, 5.0}</span>
vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>, <span class="n">4.0</span>, <span class="n">5.0</span>}
vec[<span class="n">1</span>, <span class="n">0</span>] <span class="o">=</span> <span class="n">6.0</span>
vec <span class="c"># =&gt; Vector{1.0, 6.0, 2.0, 3.0, 4.0, 5.0}</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L248" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="[]=(index:Int,value)-instance-method">
<div class="signature">
def <strong>[]=</strong>(index : Int, value)
<a class="method-permalink" href="#%5B%5D%3D%28index%3AInt%2Cvalue%29-instance-method">#</a>
</div>
<div class="doc"><p>Sets the given value at the given index.</p>
<p>Negative indices can be used to start counting from the end of the array.
Raises <code>IndexError</code> if trying to set an element outside the array's range.</p>
<pre><code>vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>}
vec[<span class="n">0</span>] <span class="o">=</span> <span class="n">5.0</span>
p vec <span class="c"># =&gt; Vec{5.0, 2.0, 3.0}</span>
vec[<span class="n">3</span>] <span class="o">=</span> <span class="n">5.0</span> <span class="c"># raises IndexError</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L226" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="[]=(range:Range(Int,Int),value)-instance-method">
<div class="signature">
def <strong>[]=</strong>(range : Range(Int, Int), value)
<a class="method-permalink" href="#%5B%5D%3D%28range%3ARange%28Int%2CInt%29%2Cvalue%29-instance-method">#</a>
</div>
<div class="doc"><p>Replaces a subrange with a single value.</p>
<pre><code>vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>, <span class="n">4.0</span>, <span class="n">5.0</span>}
vec[<span class="n">1</span>..<span class="n">3</span>] <span class="o">=</span> <span class="n">6.0</span>
vec <span class="c"># = Vector{1.0, 6.0, 5.0}</span>
vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>, <span class="n">4.0</span>, <span class="n">5.0</span>}
vec[<span class="n">1</span>...<span class="n">1</span>] <span class="o">=</span> <span class="n">6</span>
vec <span class="c"># = Vector{1.0, 6.0, 2.0, 3.0, 4.0, 5.0}</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L282" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="add(value)-instance-method">
<div class="signature">
def <strong>add</strong>(value)
<a class="method-permalink" href="#add%28value%29-instance-method">#</a>
</div>
<div class="doc"><p>When the input is a number, this returns the result of adding
it to all vector elements. When it's a vector, the vectors
will be added together.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L488" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="angle_from(vector)-instance-method">
<div class="signature">
def <strong>angle_from</strong>(vector)
<a class="method-permalink" href="#angle_from%28vector%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns the angle between this vector and another in radians.
If the vectors are mirrored across their axes this will return <code>nil</code>.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L440" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="antiparallel_to?(vector)-instance-method">
<div class="signature">
def <strong>antiparallel_to?</strong>(vector)
<a class="method-permalink" href="#antiparallel_to%3F%28vector%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns whether the vectors are antiparallel to each other.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L475" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="augment(elements)-instance-method">
<div class="signature">
def <strong>augment</strong>(elements)
<a class="method-permalink" href="#augment%28elements%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns a new vector with the provided <code>elements</code> concatenated
on the end.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L556" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="chomp(n)-instance-method">
<div class="signature">
def <strong>chomp</strong>(n)
<a class="method-permalink" href="#chomp%28n%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns a new vector with the first <code>n</code> elements removed from
the beginning.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L541" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="clear-instance-method">
<div class="signature">
def <strong>clear</strong>
<a class="method-permalink" href="#clear-instance-method">#</a>
</div>
<div class="doc"><p>Removes all elements from self.</p>
<pre><code>vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>}
vec.clear <span class="c"># =&gt; Vector{}</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L782" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="clone-instance-method">
<div class="signature">
def <strong>clone</strong>
<a class="method-permalink" href="#clone-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L374" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="concat(other:Vector)-instance-method">
<div class="signature">
def <strong>concat</strong>(other : <a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a>)
<a class="method-permalink" href="#concat%28other%3AVector%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L731" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="covector-instance-method">
<div class="signature">
def <strong>covector</strong>
<a class="method-permalink" href="#covector-instance-method">#</a>
</div>
<div class="doc"><p>Creates a single-row matrix from this vector.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L601" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="cross(*vs)-instance-method">
<div class="signature">
def <strong>cross</strong>(*vs)
<a class="method-permalink" href="#cross%28%2Avs%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns the cross product of this vector with the others.</p>
<pre><code>v1 <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">0.0</span>, <span class="n">0.0</span>}
v2 <span class="o">=</span> <span class="t">Vector</span>{<span class="n">0.0</span>, <span class="n">1.0</span>, <span class="n">0.0</span>}
v1.cross(v2) => <span class="t">Vector</span>{<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">1.0</span>}</code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L518" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="distance_from(obj)-instance-method">
<div class="signature">
def <strong>distance_from</strong>(obj)
<a class="method-permalink" href="#distance_from%28obj%29-instance-method">#</a>
</div>
<div class="doc"><p>Gets this vector's distance from the argument, when considered
a point in space.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L629" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="dot(other)-instance-method">
<div class="signature">
def <strong>dot</strong>(other)
<a class="method-permalink" href="#dot%28other%29-instance-method">#</a>
</div>
<div class="doc"><p>Get the scalar (dot) product of this vector with <code>vector</code>.</p>
<p><a href="https://en.wikipedia.org/wiki/Scalar_product" target="_blank">https://en.wikipedia.org/wiki/Scalar_product</a></p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L574" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="e(i)-instance-method">
<div class="signature">
def <strong>e</strong>(i)
<a class="method-permalink" href="#e%28i%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns the <code>ith</code> element of the vector. Returns <code>nil</code> if <code>i</code>
is out of bounds. Indexing starts from 1.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L426" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="independent?(*vs)-instance-method">
<div class="signature">
def <strong>independent?</strong>(*vs)
<a class="method-permalink" href="#independent%3F%28%2Avs%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns true if all vectors are linearly independent.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L384" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="lies_in(plane)-instance-method">
<div class="signature">
def <strong>lies_in</strong>(plane)
<a class="method-permalink" href="#lies_in%28plane%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns true if the vector is a point on the given plane.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L654" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="lies_on(line)-instance-method">
<div class="signature">
def <strong>lies_on</strong>(line)
<a class="method-permalink" href="#lies_on%28line%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns true if the vector is a point on the given line</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L649" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="log-instance-method">
<div class="signature">
def <strong>log</strong>
<a class="method-permalink" href="#log-instance-method">#</a>
</div>
<div class="doc"><p>Return a new <code><a href="../../Apatite/LinearAlgebra/Vector.html">Vector</a></code> with the log of every item in <code>self</code>.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L562" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="magnitude-instance-method">
<div class="signature">
def <strong>magnitude</strong>
<a class="method-permalink" href="#magnitude-instance-method">#</a>
</div>
<div class="doc"><p>Returns the magnitude/euclidian norm of this vector.</p>
<p><a href="https://en.wikipedia.org/wiki/Euclidean_distance" target="_blank">https://en.wikipedia.org/wiki/Euclidean_distance</a></p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L419" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="map(&amp;block)-instance-method">
<div class="signature">
def <strong>map</strong>(&block)
<a class="method-permalink" href="#map%28%26block%29-instance-method">#</a>
</div>
<div class="doc"><p>Invokes the given block for each element of <code>self</code>.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L379" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="map!(&amp;block)-instance-method">
<div class="signature">
def <strong>map!</strong>(&block)
<a class="method-permalink" href="#map%21%28%26block%29-instance-method">#</a>
</div>
<div class="doc"><p>Invokes the given block for each element of <code>self</code>, replacing the element
with the value returned by the block. Returns <code>self</code>.</p>
<pre><code>vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>}
vec.map! { <span class="o">|</span>x<span class="o">|</span> x <span class="o">*</span> x }
a <span class="c"># =&gt; Vector{1.0, 4.0, 9.0}</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L400" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="map_with_index(&amp;block)-instance-method">
<div class="signature">
def <strong>map_with_index</strong>(&block)
<a class="method-permalink" href="#map_with_index%28%26block%29-instance-method">#</a>
</div>
<div class="doc"><p>Optimized version of <code>Enumerable#map_with_index</code>.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L406" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="map_with_index!(&amp;block)-instance-method">
<div class="signature">
def <strong>map_with_index!</strong>(&block)
<a class="method-permalink" href="#map_with_index%21%28%26block%29-instance-method">#</a>
</div>
<div class="doc"><p>Like <code><a href="../../Apatite/LinearAlgebra/Vector.html#map_with_index%28%26block%29-instance-method">#map_with_index</a></code>, but mutates <code>self</code> instead of allocating a new object.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L411" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="max-instance-method">
<div class="signature">
def <strong>max</strong>
<a class="method-permalink" href="#max-instance-method">#</a>
</div>
<div class="doc"><p>Returns the (absolute) largest element in this vector.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L589" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="max_index-instance-method">
<div class="signature">
def <strong>max_index</strong>
<a class="method-permalink" href="#max_index-instance-method">#</a>
</div>
<div class="doc"><p>Gets the index of the largest element in this vector.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L594" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="multiply(value)-instance-method">
<div class="signature">
def <strong>multiply</strong>(value)
<a class="method-permalink" href="#multiply%28value%29-instance-method">#</a>
</div>
<div class="doc"><p>When the input is a number, this returns the result of multiplying
it to all vector elements. When it's a vector, the vectors
will be element-wise multiplied.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L502" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="parallel_to?(vector)-instance-method">
<div class="signature">
def <strong>parallel_to?</strong>(vector)
<a class="method-permalink" href="#parallel_to%3F%28vector%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns whether the vectors are parallel to each other.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L469" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="perpendicular_to?(vector)-instance-method">
<div class="signature">
def <strong>perpendicular_to?</strong>(vector)
<a class="method-permalink" href="#perpendicular_to%3F%28vector%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns whether the vectors are perpendicular to each other.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L481" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="pretty_print(pp):Nil-instance-method">
<div class="signature">
def <strong>pretty_print</strong>(pp) : Nil
<a class="method-permalink" href="#pretty_print%28pp%29%3ANil-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L754" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="product-instance-method">
<div class="signature">
def <strong>product</strong>
<a class="method-permalink" href="#product-instance-method">#</a>
</div>
<div class="doc"><p>Get the product of all elements in this vector.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L567" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="push(*values:Float64)-instance-method">
<div class="signature">
def <strong>push</strong>(*values : Float64)
<a class="method-permalink" href="#push%28%2Avalues%3AFloat64%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L665" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="push(value:Float64)-instance-method">
<div class="signature">
def <strong>push</strong>(value : Float64)
<a class="method-permalink" href="#push%28value%3AFloat64%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L658" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="reflection_in(object)-instance-method">
<div class="signature">
def <strong>reflection_in</strong>(object)
<a class="method-permalink" href="#reflection_in%28object%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns the result of reflecting the point in the given <code>object</code>
(point, line, or plane).</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L684" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="rotate(t,object)-instance-method">
<div class="signature">
def <strong>rotate</strong>(t, object)
<a class="method-permalink" href="#rotate%28t%2Cobject%29-instance-method">#</a>
</div>
<div class="doc"><p>Rotates the vector about the given <code>object</code>. The object should
be a point if the vector is 2D, and a line if it is 3D. Be
careful with line directions!</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L678" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="round-instance-method">
<div class="signature">
def <strong>round</strong>
<a class="method-permalink" href="#round-instance-method">#</a>
</div>
<div class="doc"><p>Gets the result of rounding the elements of the vector.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L612" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="set_elements(elements)-instance-method">
<div class="signature">
def <strong>set_elements</strong>(elements)
<a class="method-permalink" href="#set_elements%28elements%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L726" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="sigmoid-instance-method">
<div class="signature">
def <strong>sigmoid</strong>
<a class="method-permalink" href="#sigmoid-instance-method">#</a>
</div>
<div class="doc"><p>Sums the numbers in the vector and returns a sigmoid value
across the whole vector.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L707" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="size:Int32-instance-method">
<div class="signature">
def <strong>size</strong> : Int32
<a class="method-permalink" href="#size%3AInt32-instance-method">#</a>
</div>
<div class="doc"><p>Returns the number of elements in the vector</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L24" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="snap_to(value)-instance-method">
<div class="signature">
def <strong>snap_to</strong>(value)
<a class="method-permalink" href="#snap_to%28value%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns a copy of the vector with elements set to <code>value</code> if
they differ from it by less than <code>Apetite.precision</code></p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L623" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="subtract(value)-instance-method">
<div class="signature">
def <strong>subtract</strong>(value)
<a class="method-permalink" href="#subtract%28value%29-instance-method">#</a>
</div>
<div class="doc"><p>When the input is a number, this returns the result of subtracting
it to all vector elements. When it's a vector, the vectors
will be subtracted.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L495" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="sum-instance-method">
<div class="signature">
def <strong>sum</strong>
<a class="method-permalink" href="#sum-instance-method">#</a>
</div>
<div class="doc"><p>Returns the sum of all elements in the vector.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L507" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="to_3d-instance-method">
<div class="signature">
def <strong>to_3d</strong>
<a class="method-permalink" href="#to_3d-instance-method">#</a>
</div>
<div class="doc"><p>Utility to make sure vectors are 3D. If they are 2D, a zero
z-component is added.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L713" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="to_a-instance-method">
<div class="signature">
def <strong>to_a</strong>
<a class="method-permalink" href="#to_a-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L744" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="to_diagonal_matrix-instance-method">
<div class="signature">
def <strong>to_diagonal_matrix</strong>
<a class="method-permalink" href="#to_diagonal_matrix-instance-method">#</a>
</div>
<div class="doc"><p>Returns a diagonal <code><a href="../../Apatite/LinearAlgebra/Matrix.html">Matrix</a></code> with the vectors elements as its
diagonal elements.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L607" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="to_s(io)-instance-method">
<div class="signature">
def <strong>to_s</strong>(io)
<a class="method-permalink" href="#to_s%28io%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L748" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="to_unit_vector-instance-method">
<div class="signature">
def <strong>to_unit_vector</strong>
<a class="method-permalink" href="#to_unit_vector-instance-method">#</a>
</div>
<div class="doc"><p>Returns a new vector created by normalizing this one
to have a magnitude of <code>1</code>. If the vector is a zero
vector, it will not be modified.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L433" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="to_unsafe:Pointer(Float64)-instance-method">
<div class="signature">
def <strong>to_unsafe</strong> : Pointer(Float64)
<a class="method-permalink" href="#to_unsafe%3APointer%28Float64%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns a pointer to the internal buffer where <code>self</code>'s elements are stored.</p>
<p>This method is <strong>unsafe</strong> because it returns a pointer, and the pointed might eventually
not be that of <code>self</code> if the array grows and its internal buffer is reallocated.</p>
<pre><code>vec <span class="o">=</span> <span class="t">Vector</span>{<span class="n">1.0</span>, <span class="n">2.0</span>, <span class="n">3.0</span>}
vec.to_unsafe[<span class="n">0</span>] <span class="c"># =&gt; 1.0</span></code></pre></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L772" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="top(n)-instance-method">
<div class="signature">
def <strong>top</strong>(n)
<a class="method-permalink" href="#top%28n%29-instance-method">#</a>
</div>
<div class="doc"><p>Returns a vector containing only the first <code>n</code> elements.</p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L548" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="transpose-instance-method">
<div class="signature">
def <strong>transpose</strong>
<a class="method-permalink" href="#transpose-instance-method">#</a>
</div>
<div class="doc"><p>Transpose this vector into a 1xn <code><a href="../../Apatite/LinearAlgebra/Matrix.html">Matrix</a></code></p></div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L617" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="unsafe_fetch(index:Int)-instance-method">
<div class="signature">
def <strong>unsafe_fetch</strong>(index : Int)
<a class="method-permalink" href="#unsafe_fetch%28index%3AInt%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L759" target="_blank">View source</a>]
</div>
</div>
<div class="entry-detail" id="zero?-instance-method">
<div class="signature">
def <strong>zero?</strong>
<a class="method-permalink" href="#zero%3F-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/watzon/apatite/blob/6c8ee1fded2782d2cc9fcd30ca82bd149f6eb9a3/src/apatite/linear_algebra/vector.cr#L788" target="_blank">View source</a>]
</div>
</div>
</div>
</body>
</html>