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

#toArray Source

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

#fromFunction Source

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

#null Source

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

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

#index Source

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

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

#index' Source

index' :: forall a. Vector a -> Int -> Maybe a

#mapWithIndex Source

mapWithIndex :: forall a b. (Int -> a -> b) -> Vector a -> Vector b

#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. https://en.wikipedia.org/wiki/Dot_product

#scale Source

scale :: 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