Module

LinearAlgebra.Vector

Package
purescript-linalg
Repository
gbagan/purescript-linalg

#Vector Source

newtype Vector a

Instances

#fromArray Source

fromArray :: forall a. Array a -> Vector a

#fromFunction Source

fromFunction :: forall a. Int -> (Int -> a) -> Vector a

#invalid Source

invalid :: forall a. Vector a

#isValid Source

isValid :: forall a. Vector a -> Boolean

#null Source

null :: forall a. Eq a => Semiring a => Vector a -> Boolean

tests if the vector is null i.e. contains only zero values

#elem Source

elem :: forall a. Semiring a => Int -> Vector a -> a

returns the element at index i returns zero if the index are not valid

#add Source

add :: forall a. Semiring a => Vector a -> Vector a -> Vector a

#diff Source

diff :: forall a. Ring a => Vector a -> Vector a -> Vector a

#dot Source

dot :: forall a. Semiring a => Vector a -> Vector a -> a

dot product between two vectors. returns zero if the two vectors have not the same size https://en.wikipedia.org/wiki/Dot_product

#smult Source

smult :: forall a. Semiring a => a -> Vector a -> Vector a

scalar multiplication

#opposite Source

opposite :: forall a. Ring a => Vector a -> Vector a

#colinear Source

colinear :: forall a. Eq a => Field a => Vector a -> Vector a -> Boolean

returns true if v1 and v2 are colinear i.e. there exists a scalar n such that v1 = n v2 https://en.wikipedia.org/wiki/Collinearity