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" >
2019-08-23 20:45:07 +00:00
< meta name = "generator" content = "Crystal Docs 0.30.1" >
2019-06-13 02:23:54 +00:00
< 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" >
2019-07-10 01:18:01 +00:00
< title > Apatite::LinearAlgebra::Vector(T) - github.com/watzon/apatite< / title >
2019-06-13 02:23:54 +00:00
< / 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 >
2019-07-10 01:18:01 +00:00
< li class = " " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/ErrDimensionMismatch" data-name = "apatite::linearalgebra::errdimensionmismatch" >
< a href = "../../Apatite/LinearAlgebra/ErrDimensionMismatch.html" > ErrDimensionMismatch< / a >
< / li >
< li class = " " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/ErrNotRegular" data-name = "apatite::linearalgebra::errnotregular" >
< a href = "../../Apatite/LinearAlgebra/ErrNotRegular.html" > ErrNotRegular< / a >
< / li >
< li class = " " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/ErrOperationNotDefined" data-name = "apatite::linearalgebra::erroperationnotdefined" >
< a href = "../../Apatite/LinearAlgebra/ErrOperationNotDefined.html" > ErrOperationNotDefined< / a >
< / li >
< li class = " " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/Error" data-name = "apatite::linearalgebra::error" >
< a href = "../../Apatite/LinearAlgebra/Error.html" > Error< / a >
< / li >
2019-07-10 02:08:46 +00:00
< li class = "parent " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/Matrix" data-name = "apatite::linearalgebra::matrix(t)" >
2019-06-13 02:23:54 +00:00
< a href = "../../Apatite/LinearAlgebra/Matrix.html" > Matrix< / a >
2019-07-10 02:08:46 +00:00
< ul >
2019-06-13 02:23:54 +00:00
2019-07-10 02:08:46 +00:00
< li class = " " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/Matrix/EigenvalueDecomposition" data-name = "apatite::linearalgebra::matrix::eigenvaluedecomposition" >
< a href = "../../Apatite/LinearAlgebra/Matrix/EigenvalueDecomposition.html" > EigenvalueDecomposition< / a >
2019-06-13 02:23:54 +00:00
< / li >
2019-07-10 02:08:46 +00:00
< li class = " " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/Matrix/LupDecomposition" data-name = "apatite::linearalgebra::matrix::lupdecomposition" >
< a href = "../../Apatite/LinearAlgebra/Matrix/LupDecomposition.html" > LupDecomposition< / a >
2019-07-10 01:18:01 +00:00
< / li >
< / ul >
< / li >
2019-07-10 02:08:46 +00:00
< li class = " " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/NDArray" data-name = "apatite::linearalgebra::ndarray" >
< a href = "../../Apatite/LinearAlgebra/NDArray.html" > NDArray< / a >
2019-07-10 01:18:01 +00:00
2019-07-10 02:08:46 +00:00
< / li >
2019-07-10 01:18:01 +00:00
2019-07-10 02:08:46 +00:00
< li class = " current" data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/Vector" data-name = "apatite::linearalgebra::vector(t)" >
< a href = "../../Apatite/LinearAlgebra/Vector.html" > Vector< / a >
2019-07-10 01:18:01 +00:00
< / li >
2019-07-10 02:08:46 +00:00
< li class = " " data-id = "github.com/watzon/apatite/Apatite/LinearAlgebra/ZeroVectorError" data-name = "apatite::linearalgebra::zerovectorerror" >
< a href = "../../Apatite/LinearAlgebra/ZeroVectorError.html" > ZeroVectorError< / a >
2019-07-10 01:18:01 +00:00
< / li >
2019-06-13 02:23:54 +00:00
< / 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" >
2019-07-10 01:18:01 +00:00
< span class = "kind" > class< / span > Apatite::LinearAlgebra::Vector(T)
2019-06-13 02:23:54 +00:00
< / h1 >
2019-07-10 01:18:01 +00:00
< ul class = "superclass-hierarchy" > < li class = "superclass" > < a href = "../../Apatite/LinearAlgebra/Vector.html" > Apatite::LinearAlgebra::Vector(T)< / a > < / li > < li class = "superclass" > Reference< / li > < li class = "superclass" > Object< / li > < / ul >
2019-06-13 02:23:54 +00:00
< 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" >
2019-07-10 01:18:01 +00:00
< li class = "other-type" > Comparable(< a href = "../../Apatite/LinearAlgebra/Vector.html" > Apatite::LinearAlgebra::Vector(T)< / a > )< / li >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< li class = "other-type" > Enumerable(T)< / li >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< li class = "other-type" > Indexable(T)< / li >
2019-06-13 02:23:54 +00:00
< / ul >
< h2 > Defined in:< / h2 >
2019-08-23 20:45:07 +00:00
< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L8" target = "_blank" >
2019-06-13 02:23:54 +00:00
apatite/linear_algebra/vector.cr
< / a >
< br / >
< h2 > Class Method Summary< / h2 >
< ul class = "list-summary" >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#[](*array)-class-method" class = "signature" > < strong > .[]< / strong > (*array)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Creates a new vector from a list of elements.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#basis(size,index)-class-method" class = "signature" > < strong > .basis< / strong > (size, index)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns a standard basis < code > n< / code > -vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#elements(array,copy=true)-class-method" class = "signature" > < strong > .elements< / strong > (array, copy = < span class = "n" > true< / span > )< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Creates a vector from an Array.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
2019-07-10 02:45:49 +00:00
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#independent?(*vs)-class-method" class = "signature" > < strong > .independent?< / strong > (*vs)< / a >
2019-07-10 02:45:49 +00:00
< div class = "summary" > < p > Returns < code > true< / code > if all of vectors are linearly independent.< / p > < / div >
< / li >
2019-06-13 02:23:54 +00:00
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#zero(size)-class-method" class = "signature" > < strong > .zero< / strong > (size)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Return a zero vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< / ul >
< h2 > Instance Method Summary< / h2 >
< ul class = "list-summary" >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#*(x:Number)-instance-method" class = "signature" > < strong > #*< / strong > (x : Number)< / a >
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< div class = "summary" > < p > Multiplies the vector by x, where x is a number.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#*(x:Vector)-instance-method" class = "signature" > < strong > #*< / strong > (x : Vector)< / a >
< div class = "summary" > < p > Multiplies the vector by x, where x is another vector.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#*(x:Matrix)-instance-method" class = "signature" > < strong > #*< / strong > (x : Matrix)< / a >
< div class = "summary" > < p > Multiplies the vector by x, where x is a matrix.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#+(x:Matrix)-instance-method" class = "signature" > < strong > #+< / strong > (x : Matrix)< / a >
< div class = "summary" > < p > Vector addition.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#+(x:Number)-instance-method" class = "signature" > < strong > #+< / strong > (x : Number)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Vector addition.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#+(x:Vector)-instance-method" class = "signature" > < strong > #+< / strong > (x : Vector)< / a >
< div class = "summary" > < p > Vector addition.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#-(x:Matrix)-instance-method" class = "signature" > < strong > #-< / strong > (x : Matrix)< / a >
< div class = "summary" > < p > Vector subtraction.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#-(x:Vector)-instance-method" class = "signature" > < strong > #-< / strong > (x : Vector)< / a >
< div class = "summary" > < p > Vector subtraction.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#-(x:Number)-instance-method" class = "signature" > < strong > #-< / strong > (x : Number)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Vector subtraction.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#/(x:Matrix)-instance-method" class = "signature" > < strong > #/< / strong > (x : Matrix)< / a >
< div class = "summary" > < p > Vector division.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#/(x:Number)-instance-method" class = "signature" > < strong > #/< / strong > (x : Number)< / a >
< div class = "summary" > < p > Vector division.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#/(x:Vector)-instance-method" class = "signature" > < strong > #/< / strong > (x : Vector)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Vector division.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-07-10 01:18:01 +00:00
< a href = "#-instance-method" class = "signature" > < strong > #< =>< / strong > < / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Take me to your leader< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#(other:Vector%7CIndexable)-instance-method" class = "signature" > < strong > #< =>< / strong > (other : Vector | Indexable)< / a >
< div class = "summary" > < p > Alien mothership< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#==(other)-instance-method" class = "signature" > < strong > #==< / strong > (other)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Equality operator< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#angle_with(v)-instance-method" class = "signature" > < strong > #angle_with< / strong > (v)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns an angle with another vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
< a href = "#clone-instance-method" class = "signature" > < strong > #clone< / strong > < / a >
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns a copy of the vector.< / p > < / div >
2019-06-17 22:18:58 +00:00
< / li >
2019-06-13 02:23:54 +00:00
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#coerce(klass:BigRational.class,denominator:Int)-instance-method" class = "signature" > < strong > #coerce< / strong > (klass : < span class = "t" > BigRational< / span > .< span class = "k" > class< / span > , denominator : Int)< / a >
< div class = "summary" > < p > Attempt to coerce the elements in a vector to BigRational with the given < code > denominator< / code > .< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#coerce(klass:U.class):Apatite::LinearAlgebra::Vector(U)forallU-instance-method" class = "signature" > < strong > #coerce< / strong > (klass : < span class = "t" > U< / span > .< span class = "k" > class< / span > ) : Apatite::LinearAlgebra::Vector(U) forall U< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 02:08:46 +00:00
< div class = "summary" > < p > The coerce method allows you to attempt to coerce the elements in the matrix to another type.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
2019-08-23 20:45:07 +00:00
< li class = "entry-summary" >
< a href = "#coerce(klass:BigInt.class,base=10)-instance-method" class = "signature" > < strong > #coerce< / strong > (klass : < span class = "t" > BigInt< / span > .< span class = "k" > class< / span > , base = < span class = "n" > 10< / span > )< / a >
< div class = "summary" > < p > Attempt to coerce the elements in a vector to BigInt with an optional < code > base< / code > value.< / p > < / div >
< / li >
< li class = "entry-summary" >
< a href = "#coerce(klass:Complex.class,imag:Number)-instance-method" class = "signature" > < strong > #coerce< / strong > (klass : < span class = "t" > Complex< / span > .< span class = "k" > class< / span > , imag : Number)< / a >
< div class = "summary" > < p > Attempt to coerce the elements in a vector to Complex with < code > imag< / code > as the imaginary number.< / p > < / div >
< / li >
2019-07-10 02:45:49 +00:00
< 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 >
2019-06-13 02:23:54 +00:00
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#cross(v)-instance-method" class = "signature" > < strong > #cross< / strong > (v)< / a >
2019-06-13 02:23:54 +00:00
< div class = "summary" > < p > Returns the cross product of this vector with the others.< / p > < / div >
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#cross_product(*vs)-instance-method" class = "signature" > < strong > #cross_product< / strong > (*vs)< / a >
2019-06-17 22:01:05 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns the cross product of this vector with the others.< / p > < / div >
2019-06-17 22:01:05 +00:00
< / li >
2019-06-13 02:23:54 +00:00
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#dot(v)-instance-method" class = "signature" > < strong > #dot< / strong > (v)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns the inner product of this vector with the other.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#each(*args,**options,&block)-instance-method" class = "signature" > < strong > #each< / strong > (*args, **options, & block)< / a >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#each(v,&block)-instance-method" class = "signature" > < strong > #each< / strong > (v, & block)< / a >
< div class = "summary" > < p > Iterate over the elements of this vector and < code > v< / code > in conjunction.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#each(*args,**options)-instance-method" class = "signature" > < strong > #each< / strong > (*args, **options)< / a >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#inner_product(v)-instance-method" class = "signature" > < strong > #inner_product< / strong > (v)< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns the inner product of this vector with the other.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-07-10 01:18:01 +00:00
< a href = "#inspect-instance-method" class = "signature" > < strong > #inspect< / strong > < / a >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
< a href = "#magnitude-instance-method" class = "signature" > < strong > #magnitude< / strong > < / a >
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns the modulus (Pythagorean distance) of the vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#map(&block:T-%3EUNDERSCORE)-instance-method" class = "signature" > < strong > #map< / strong > (& block : T -> UNDERSCORE)< / a >
< div class = "summary" > < p > Maps over a vector, passing each element to the block< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#map(v,&block:T,T-%3EUNDERSCORE)-instance-method" class = "signature" > < strong > #map< / strong > (v, & block : T, T -> UNDERSCORE)< / a >
< div class = "summary" > < p > Maps over the current vector and < code > v< / code > in conjunction, passing each element in each to the block and returning a new vector< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-07-10 01:18:01 +00:00
< a href = "#norm-instance-method" class = "signature" > < strong > #norm< / strong > < / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns the modulus (Pythagorean distance) of the vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
2019-06-17 22:01:05 +00:00
< li class = "entry-summary" >
< a href = "#normalize-instance-method" class = "signature" > < strong > #normalize< / strong > < / a >
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns a new vector with the same direction but with norm 1< / p > < / div >
2019-06-13 02:23:54 +00:00
< / li >
< li class = "entry-summary" >
2019-07-10 01:18:01 +00:00
< a href = "#r-instance-method" class = "signature" > < strong > #r< / strong > < / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns a new vector with the same direction but with norm 1< / p > < / div >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#round(ndigits=0)-instance-method" class = "signature" > < strong > #round< / strong > (ndigits = < span class = "n" > 0< / span > )< / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns a vector with entries rounded to the given precision.< / p > < / div >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< / li >
< li class = "entry-summary" >
< a href = "#to_a-instance-method" class = "signature" > < strong > #to_a< / strong > < / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns the elements of the vector in an array.< / p > < / div >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< / li >
< li class = "entry-summary" >
< a href = "#to_matrix-instance-method" class = "signature" > < strong > #to_matrix< / strong > < / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Return a single-column matrix from this vector.< / p > < / div >
2019-06-17 22:01:05 +00:00
2019-07-10 01:18:01 +00:00
< / li >
< li class = "entry-summary" >
< a href = "#to_s-instance-method" class = "signature" > < strong > #to_s< / strong > < / a >
2019-06-17 22:01:05 +00:00
2019-07-10 01:18:01 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#unsafe_fetch(i)-instance-method" class = "signature" > < strong > #unsafe_fetch< / strong > (i)< / a >
2019-06-17 22:01:05 +00:00
2019-07-10 01:18:01 +00:00
< / li >
< li class = "entry-summary" >
2019-08-23 20:45:07 +00:00
< a href = "#zero?-instance-method" class = "signature" > < strong > #zero?< / strong > < / a >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "summary" > < p > Returns < code > true< / code > if all elements are zero.< / p > < / div >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< / li >
< / ul >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "methods-inherited" >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< / div >
< h2 > Class Method Detail< / h2 >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "[](*array)-class-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def self.< strong > []< / strong > (*array)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#[](*array)-class-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Creates a new vector from a list of elements.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L23" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "basis(size,index)-class-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def self.< strong > basis< / strong > (size, index)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#basis(size,index)-class-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns a standard basis < code > n< / code > -vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L35" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "elements(array,copy=true)-class-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def self.< strong > elements< / strong > (array, copy = < span class = "n" > true< / span > )
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#elements(array,copy=true)-class-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Creates a vector from an Array. The optional second argument specifies
whether the array itself or a copy is used internally.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L29" target = "_blank" > View source< / a > ]
2019-07-10 02:45:49 +00:00
< / div >
< / div >
< div class = "entry-detail" id = "independent?(*vs)-class-method" >
< div class = "signature" >
def self.< strong > independent?< / strong > (*vs)
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#independent?(*vs)-class-method" > #< / a >
2019-07-10 02:45:49 +00:00
< / div >
< div class = "doc" > < p > Returns < code > true< / code > if all of vectors are linearly independent.< / p >
< pre > < code > < span class = "t" > Vector< / span > .independent?(< span class = "t" > Vector< / span > [< span class = "n" > 1< / span > ,< span class = "n" > 0< / span > ], < span class = "t" > Vector< / span > [< span class = "n" > 0< / span > ,< span class = "n" > 1< / span > ])
< span class = "c" > # => true< / span >
< span class = "t" > Vector< / span > .independent?(< span class = "t" > Vector< / span > [< span class = "n" > 1< / span > ,< span class = "n" > 2< / span > ], < span class = "t" > Vector< / span > [< span class = "n" > 2< / span > ,< span class = "n" > 4< / span > ])
< span class = "c" > # => false< / span > < / code > < / pre > < / div >
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L52" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "zero(size)-class-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def self.< strong > zero< / strong > (size)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#zero(size)-class-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Return a zero vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L62" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< h2 > Instance Method Detail< / h2 >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "*(x:Number)-instance-method" >
< div class = "signature" >
def < strong > *< / strong > (x : Number)
< a class = "method-permalink" href = "#*(x:Number)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Multiplies the vector by x, where x is a number.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L79" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "*(x:Vector)-instance-method" >
< div class = "signature" >
def < strong > *< / strong > (x : < a href = "../../Apatite/LinearAlgebra/Vector.html" > Vector< / a > )
< a class = "method-permalink" href = "#*(x:Vector)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Multiplies the vector by x, where x is another vector.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L90" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "*(x:Matrix)-instance-method" >
< div class = "signature" >
def < strong > *< / strong > (x : < a href = "../../Apatite/LinearAlgebra/Matrix.html" > Matrix< / a > )
< a class = "method-permalink" href = "#*(x:Matrix)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Multiplies the vector by x, where x is a matrix.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L85" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "+(x:Matrix)-instance-method" >
< div class = "signature" >
def < strong > +< / strong > (x : < a href = "../../Apatite/LinearAlgebra/Matrix.html" > Matrix< / a > )
< a class = "method-permalink" href = "#+(x:Matrix)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Vector addition.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L102" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "+(x:Number)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > +< / strong > (x : Number)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#+(x:Number)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-08-23 20:45:07 +00:00
< div class = "doc" > < p > Vector addition.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L96" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "+(x:Vector)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > +< / strong > (x : < a href = "../../Apatite/LinearAlgebra/Vector.html" > Vector< / a > )
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#+(x:Vector)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Vector addition.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L107" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "-(x:Matrix)-instance-method" >
< div class = "signature" >
def < strong > -< / strong > (x : < a href = "../../Apatite/LinearAlgebra/Matrix.html" > Matrix< / a > )
< a class = "method-permalink" href = "#-(x:Matrix)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Vector subtraction.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L119" target = "_blank" > View source< / a > ]
2019-06-17 22:01:05 +00:00
< / div >
< / div >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "-(x:Vector)-instance-method" >
2019-06-17 22:01:05 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > -< / strong > (x : < a href = "../../Apatite/LinearAlgebra/Vector.html" > Vector< / a > )
2019-06-17 22:01:05 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#-(x:Vector)-instance-method" > #< / a >
2019-06-17 22:01:05 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Vector subtraction.< / p > < / div >
2019-06-17 22:01:05 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L124" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "-(x:Number)-instance-method" >
< div class = "signature" >
def < strong > -< / strong > (x : Number)
< a class = "method-permalink" href = "#-(x:Number)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Vector subtraction.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L113" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "/(x:Matrix)-instance-method" >
< div class = "signature" >
def < strong > /< / strong > (x : < a href = "../../Apatite/LinearAlgebra/Matrix.html" > Matrix< / a > )
< a class = "method-permalink" href = "#/(x:Matrix)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Vector division.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L136" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "/(x:Number)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > /< / strong > (x : Number)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#/(x:Number)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Vector division.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L130" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "/(x:Vector)-instance-method" >
< div class = "signature" >
def < strong > /< / strong > (x : < a href = "../../Apatite/LinearAlgebra/Vector.html" > Vector< / a > )
< a class = "method-permalink" href = "#/(x:Vector)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Vector division.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L141" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > < =>< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Take me to your leader< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L156" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "(other:Vector|Indexable)-instance-method" >
< div class = "signature" >
def < strong > < =>< / strong > (other : < a href = "../../Apatite/LinearAlgebra/Vector.html" > Vector< / a > | Indexable)
< a class = "method-permalink" href = "#(other:Vector%7CIndexable)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Alien mothership< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L69" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "==(other)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > ==< / strong > (other)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#==(other)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Equality operator< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L147" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "angle_with(v)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > angle_with< / strong > (v)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#angle_with(v)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns an angle with another vector. Result is within the [0…Math::PI].< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L165" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "clone-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > clone< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#clone-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns a copy of the vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L174" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "coerce(klass:BigRational.class,denominator:Int)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > coerce< / strong > (klass : < span class = "t" > BigRational< / span > .< span class = "k" > class< / span > , denominator : Int)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#coerce(klass:BigRational.class,denominator:Int)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Attempt to coerce the elements in a vector to BigRational
with the given < code > denominator< / code > .< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L290" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "coerce(klass:U.class):Apatite::LinearAlgebra::Vector(U)forallU-instance-method" >
< div class = "signature" >
def < strong > coerce< / strong > (klass : < span class = "t" > U< / span > .< span class = "k" > class< / span > ) : < a href = "../../Apatite/LinearAlgebra/Vector.html" > Apatite::LinearAlgebra::Vector< / a > (U) forall U
< a class = "method-permalink" href = "#coerce(klass:U.class):Apatite::LinearAlgebra::Vector(U)forallU-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 02:08:46 +00:00
< div class = "doc" > < p > The coerce method allows you to attempt to coerce the elements
2019-08-23 20:45:07 +00:00
in the matrix to another type.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L297" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "coerce(klass:BigInt.class,base=10)-instance-method" >
< div class = "signature" >
def < strong > coerce< / strong > (klass : < span class = "t" > BigInt< / span > .< span class = "k" > class< / span > , base = < span class = "n" > 10< / span > )
< a class = "method-permalink" href = "#coerce(klass:BigInt.class,base=10)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Attempt to coerce the elements in a vector to BigInt with
an optional < code > base< / code > value.< / p > < / div >
2019-07-10 01:18:01 +00:00
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L283" target = "_blank" > View source< / a > ]
< / div >
< / div >
< div class = "entry-detail" id = "coerce(klass:Complex.class,imag:Number)-instance-method" >
< div class = "signature" >
def < strong > coerce< / strong > (klass : < span class = "t" > Complex< / span > .< span class = "k" > class< / span > , imag : Number)
< a class = "method-permalink" href = "#coerce(klass:Complex.class,imag:Number)-instance-method" > #< / a >
< / div >
< div class = "doc" > < p > Attempt to coerce the elements in a vector to Complex with
< code > imag< / code > as the imaginary number.< / p > < / div >
< br / >
< div >
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L276" target = "_blank" > View source< / a > ]
2019-07-10 02:45:49 +00:00
< / 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 >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L195" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "cross(v)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > cross< / strong > (v)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#cross(v)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns the cross product of this vector with the others.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L223" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "cross_product(*vs)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > cross_product< / strong > (*vs)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#cross_product(*vs)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns the cross product of this vector with the others.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L200" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "dot(v)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > dot< / strong > (v)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#dot(v)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns the inner product of this vector with the other.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L234" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "each(*args,**options,&block)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > each< / strong > (*args, **options, & block)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#each(*args,**options,&block)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L15" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "each(v,&block)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > each< / strong > (v, & block)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#each(v,&block)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-08-23 20:45:07 +00:00
< div class = "doc" > < p > Iterate over the elements of this vector and < code > v< / code > in conjunction.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L239" target = "_blank" > View source< / a > ]
2019-06-17 22:01:05 +00:00
< / div >
< / div >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "each(*args,**options)-instance-method" >
2019-06-17 22:01:05 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > each< / strong > (*args, **options)
2019-06-17 22:01:05 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#each(*args,**options)-instance-method" > #< / a >
2019-06-17 22:01:05 +00:00
< / div >
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L15" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "inner_product(v)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > inner_product< / strong > (v)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#inner_product(v)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns the inner product of this vector with the other.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L228" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "inspect-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > inspect< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#inspect-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L321" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "magnitude-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > magnitude< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#magnitude-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns the modulus (Pythagorean distance) of the vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L248" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "map(&block:T->UNDERSCORE)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > map< / strong > (& block : T -> UNDERSCORE)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#map(&block:T-%3EUNDERSCORE)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-08-23 20:45:07 +00:00
< div class = "doc" > < p > Maps over a vector, passing each element to the block< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L179" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-08-23 20:45:07 +00:00
< div class = "entry-detail" id = "map(v,&block:T,T->UNDERSCORE)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-08-23 20:45:07 +00:00
def < strong > map< / strong > (v, & block : T, T -> UNDERSCORE)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#map(v,&block:T,T-%3EUNDERSCORE)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-08-23 20:45:07 +00:00
< div class = "doc" > < p > Maps over the current vector and < code > v< / code > in conjunction, passing each
element in each to the block and returning a new vector< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L186" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "norm-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > norm< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#norm-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns the modulus (Pythagorean distance) of the vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L253" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "normalize-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > normalize< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#normalize-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns a new vector with the same direction but with norm 1< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L258" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "r-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > r< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#r-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns a new vector with the same direction but with norm 1< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L265" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "round(ndigits=0)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > round< / strong > (ndigits = < span class = "n" > 0< / span > )
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#round(ndigits=0)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns a vector with entries rounded to the given precision.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L270" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "to_a-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > to_a< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#to_a-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns the elements of the vector in an array.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L303" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "to_matrix-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > to_matrix< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#to_matrix-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Return a single-column matrix from this vector.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L308" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "to_s-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > to_s< / strong >
2019-06-13 02:23:54 +00:00
2019-07-10 01:18:01 +00:00
< a class = "method-permalink" href = "#to_s-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L312" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
2019-07-10 01:18:01 +00:00
< div class = "entry-detail" id = "unsafe_fetch(i)-instance-method" >
2019-06-13 02:23:54 +00:00
< div class = "signature" >
2019-07-10 01:18:01 +00:00
def < strong > unsafe_fetch< / strong > (i)
2019-06-13 02:23:54 +00:00
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#unsafe_fetch(i)-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L325" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
< div class = "entry-detail" id = "zero?-instance-method" >
< div class = "signature" >
def < strong > zero?< / strong >
2019-08-23 20:45:07 +00:00
< a class = "method-permalink" href = "#zero?-instance-method" > #< / a >
2019-06-13 02:23:54 +00:00
< / div >
2019-07-10 01:18:01 +00:00
< div class = "doc" > < p > Returns < code > true< / code > if all elements are zero.< / p > < / div >
2019-06-13 02:23:54 +00:00
< br / >
< div >
2019-08-23 20:45:07 +00:00
[< a href = "https://github.com/watzon/apatite/blob/c7bc6f4f5ec3f4b2725b0b6bdf03d9524007e864/src/apatite/linear_algebra/vector.cr#L317" target = "_blank" > View source< / a > ]
2019-06-13 02:23:54 +00:00
< / div >
< / div >
< / div >
< / body >
< / html >