jonathanfishbein1/linear-algebra/22.1.0

NOTE: the latest version is 30.0.0

Vector

A module for Vectors

Types

type Vector a
= Vector (List a)

Vector type

type Vector3 a
= Vector3 a a a

3 Dimensional Vector type

type Scalar a
= Scalar a

Type to represent a scalar value

type alias VectorSpace a =
{ abelianGroup : AbelianGroup (Vector a)
, vectorScalarMultiplication : a -> Vector a -> Vector a
, field : Field a
}

Type to represent a Vector Space

type alias InnerProductSpace a =
{ vectorSpace : VectorSpace a
, innerProduct : Vector a -> Vector a -> a
, length : Vector a -> Float
, distance : Vector a -> Vector a -> Float
}

Type to represent an Inner Product Space

Values

realVectorSpace : VectorSpace Float

Real Numbered Vector Space

realVectorAbelianGroup : AbelianGroup (Vector Float)

Abelian Group instance for a real valued Vector.

realInnerProductSpace : InnerProductSpace Float

Real Numbered Inner Product Space

complexVectorSpace : VectorSpace (ComplexNumber Float)

Complex Numbered Vector Space

complexVectorAbelianGroup : AbelianGroup (Vector (ComplexNumber Float))

Group instance for a complex valued Vector.

complexInnerProductSpace : InnerProductSpace (ComplexNumber Float)

Complex Numbered Inner Product Space

zeros : Monoid a -> Int -> Vector a

Zero vector given a Field and dimension

Unitary Operations

scalarMultiplication : Field a -> a -> Vector a -> Vector a

Scalar multiplication over a Vector s

lengthReal : Vector Float -> Float

Calculate the length of a Real valued Vector

lengthComplex : Vector (ComplexNumber Float) -> Float

Calculate the length of a Complex valued Vector

sum : Monoid a -> Vector a -> a

Calculate the sum of a Vector

normaliseReal : Vector Float -> Vector Float

Adjust a real valued vector so that its length is exactly one

normaliseComplex : Vector (ComplexNumber Float) -> Vector (ComplexNumber Float)

Adjust a real valued vector so that its length is exactly one

conjugate : Vector (ComplexNumber number) -> Vector (ComplexNumber number)

Take the complex conjugate of a Complex Numbered Vector

Binary Operations

add : Field a -> Vector a -> Vector a -> Vector a

Add two Vectors

subtract : Field a -> Vector a -> Vector a -> Vector a

Subtract Vectors

hadamardMultiplication : Field a -> Vector a -> Vector a -> Vector a

Hadamard Multiplication Vectors

dotProduct : Field a -> Vector a -> Vector a -> a

Calculate the dot product of two Vectors

angleBetween : Vector Float -> Vector Float -> Float

Calculate the angle between two vectors

cross : CommutativeDivisionRing a -> Vector3 a -> Vector3 a -> Vector3 a

Take the cross product of two 3D vectors

tensorProduct : Field a -> Vector a -> Vector a -> Vector a

Calculate the tensor product of two vectors

Vector (ComplexNumber Float)
-> Vector (ComplexNumber Float)
-> Float

Calculate distance between two vectors

distanceReal : Vector Float -> Vector Float -> Float

Calculate distance between two vectors

Vector Properties

dimension : Vector a -> Int

Count of number of elements in a vector

Field a
-> AbelianGroup (Vector a)
-> Scalar a
-> List (Vector a)
-> List (a -> Bool)
-> Bool

Determine whether a list of Vectors makes a Subspace

all : (a -> Bool) -> Vector a -> Bool

Determine if all elements in a vector satisfy some test

SemiGroup, Monoid, Group, Ring, Field

Monoid empty for Vector

append : Vector a -> Vector a -> Vector a

Append Vectors together

concat : Monoid (Vector a)

Monoidally append Vectors together

realVectorCommutativeSemigroup : CommutativeSemigroup (Vector Float)

Commutative Semigroup instance for a real valued Vector.

complexVectorCommutativeSemigroup : CommutativeSemigroup (Vector (ComplexNumber Float))

Commutative Semigroup instance for a complex valued Vector.

realVectorCommutativeMonoid : CommutativeMonoid (Vector Float)

Commutative Monoid instance for a real valued Vector.

complexVectorCommutativeMonoid : CommutativeMonoid (Vector (ComplexNumber Float))

Commutative Monoid instance for a complex valued Vector.

Functor, Applicative, Monad, Foldable

map : (a -> b) -> Vector a -> Vector b

Map over a vector

pure : a -> Vector a

Place a value in minimal Vector context

andMap : Vector a -> Vector (a -> b) -> Vector b

Apply for Vector

map2 : (a -> b -> c) -> Vector a -> Vector b -> Vector c

Lift a binary function to work with Vectors

andThen : (a -> Vector b) -> Vector a -> Vector b

andThen for Vector

foldl : (a -> b -> b) -> b -> Vector a -> b

Left fold over a Vector

Equality

equal : (a -> a -> Bool) -> Vector a -> Vector a -> Bool

Compare two vectors for equality using a comparator

Manipulation

findIndex : (a -> Bool) -> Vector a -> Maybe Int

Find index of a value in a Vector

getAt : Int -> Vector a -> Maybe a

Get the value in a Vector at the specified index

setAt : Int -> a -> Vector a -> Vector a

Set the value in a Vector at the specified index

parseVector : Parser a -> Parser (Vector a)

Parse a Vector

printRealVector : Vector Float -> String

Print a Real Vector as a string

printComplexVector : Vector (ComplexNumber Float) -> String

Print a Complex Vector as a string

readRealVector : String -> Result (List DeadEnd) (Vector Float)

Try to read a string into a Real Vector

readComplexVector : String -> Result (List DeadEnd) (Vector (ComplexNumber Float))

Try to read a string into a Complex Vector

Convert a Vector3 type to a Vector type

Parse a Float that can be negative or positive