Matrix : Nat -> Nat -> Type -> Type A matrix is a rank-2 array.
Totality: total
Visibility: public exportMatrix' : Nat -> Type -> Type A synonym for a square matrix with dimensions of length `n`.
Totality: total
Visibility: public exportmatrix : {default B rep : Rep} -> RepConstraint rep a => Vect m (Vect n a) -> Matrix m n a Construct a matrix with the given order and elements.
Totality: total
Visibility: exportrepeatDiag : {default B rep : Rep} -> RepConstraint rep a => a -> a -> Matrix m n a Construct a matrix with a specific value along the diagonal.
@ diag The value to repeat along the diagonal
@ other The value to repeat elsewhere
Totality: total
Visibility: exportfromDiag : {default B rep : Rep} -> RepConstraint rep a => Vect (minimum m n) a -> a -> Matrix m n a Construct a matrix given its diagonal elements.
@ diag The elements of the matrix's diagonal
@ other The value to repeat elsewhere
Totality: total
Visibility: exportpermuteM : {default B rep : Rep} -> RepConstraint rep a => Num a => Permutation n -> Matrix' n a Construct a permutation matrix based on the given permutation.
Totality: total
Visibility: exportscale : {default B rep : Rep} -> RepConstraint rep a => Num a => a -> Matrix' n a Construct the matrix that scales a vector by the given value.
Totality: total
Visibility: exportrotate2D : {default B rep : Rep} -> RepConstraint rep Double => Double -> Matrix' 2 Double Construct a 2D rotation matrix that rotates by the given angle (in radians).
Totality: total
Visibility: exportrotate3DX : {default B rep : Rep} -> RepConstraint rep Double => Double -> Matrix' 3 Double Construct a 3D rotation matrix around the x-axis.
Totality: total
Visibility: exportrotate3DY : {default B rep : Rep} -> RepConstraint rep Double => Double -> Matrix' 3 Double Construct a 3D rotation matrix around the y-axis.
Totality: total
Visibility: exportrotate3DZ : {default B rep : Rep} -> RepConstraint rep Double => Double -> Matrix' 3 Double Construct a 3D rotation matrix around the z-axis.
Totality: total
Visibility: exportreflect : {default B rep : Rep} -> RepConstraint rep a => Neg a => Fin n -> Matrix' n a- Totality: total
Visibility: export reflectX : {default B rep : Rep} -> RepConstraint rep a => Neg a => Matrix' (1 + n) a- Totality: total
Visibility: export reflectY : {default B rep : Rep} -> RepConstraint rep a => Neg a => Matrix' (2 + n) a- Totality: total
Visibility: export reflectZ : {default B rep : Rep} -> RepConstraint rep a => Neg a => Matrix' (3 + n) a- Totality: total
Visibility: export index : Fin m -> Fin n -> Matrix m n a -> a Index the matrix at the given coordinates.
Totality: total
Visibility: exportindexNB : Nat -> Nat -> Matrix m n a -> Maybe a Index the matrix at the given coordinates, returning `Nothing` if the
coordinates are out of bounds.
Totality: total
Visibility: exportgetRow : Fin m -> Matrix m n a -> Vector n a Return a row of the matrix as a vector.
Totality: total
Visibility: exportgetColumn : Fin n -> Matrix m n a -> Vector m a Return a column of the matrix as a vector.
Totality: total
Visibility: exportdiagonal' : Matrix m n a -> Vector (minimum m n) a Return the diagonal elements of the matrix as a vector.
Totality: total
Visibility: exportdiagonal : Matrix' n a -> Vector n a Return the diagonal elements of the matrix as a vector.
Totality: total
Visibility: exportminor : Fin (S m) -> Fin (S n) -> Matrix (S m) (S n) a -> Matrix m n a Return a minor of the matrix, i.e. the matrix formed by removing a
single row and column.
Totality: total
Visibility: exportupperTriangle : Num a => Matrix m n a -> Matrix m n a- Totality: total
Visibility: export lowerTriangle : Num a => Matrix m n a -> Matrix m n a- Totality: total
Visibility: export upperTriangleStrict : Num a => Matrix m n a -> Matrix m n a- Totality: total
Visibility: export lowerTriangleStrict : Num a => Matrix m n a -> Matrix m n a- Totality: total
Visibility: export vconcat : Matrix m n a -> Matrix m' n a -> Matrix (m + m') n a Concatenate two matrices vertically.
Totality: total
Visibility: exporthconcat : Matrix m n a -> Matrix m n' a -> Matrix m (n + n') a Concatenate two matrices horizontally.
Totality: total
Visibility: exportvstack : Vect m (Vector n a) -> Matrix m n a Stack row vectors to form a matrix.
Totality: total
Visibility: exporthstack : Vect n (Vector m a) -> Matrix m n a Stack column vectors to form a matrix.
Totality: total
Visibility: exportswapRows : Fin m -> Fin m -> Matrix m n a -> Matrix m n a Swap two rows of a matrix.
Totality: total
Visibility: exportswapColumns : Fin n -> Fin n -> Matrix m n a -> Matrix m n a Swap two columns of a matrix.
Totality: total
Visibility: exportpermuteRows : Permutation m -> Matrix m n a -> Matrix m n a Permute the rows of a matrix.
Totality: total
Visibility: exportpermuteColumns : Permutation n -> Matrix m n a -> Matrix m n a Permute the columns of a matrix.
Totality: total
Visibility: exportouter : Num a => Vector m a -> Vector n a -> Matrix m n a Calculate the outer product of two vectors as a matrix.
Totality: total
Visibility: exporttrace : Num a => Matrix m n a -> a Calculate the trace of a matrix, i.e. the sum of its diagonal elements.
Totality: total
Visibility: exportreflectNormal : (Neg a, Fractional a) => Vector n a -> Matrix' n a Construct a matrix that reflects a vector along a hyperplane of the
given normal vector. The input does not have to be a unit vector.
Totality: total
Visibility: exportrecord DecompLU : Matrix m n a -> Type The LU decomposition of a matrix.
LU decomposition factors a matrix A into two matrices: a lower triangular
matrix L, and an upper triangular matrix U, such that A = LU.
Totality: total
Visibility: export
Constructor: MkLU : Matrix m n a -> DecompLU mat
Projections:
.lower : Num a => DecompLU mat -> Matrix m (minimum m n) a The lower triangular matrix L of the LU decomposition.
.lower' : Num a => DecompLU mat -> Matrix' n a The lower triangular matrix L of the LU decomposition.
This accessor is intended to be used for square matrix decompositions.
.lu : DecompLU mat -> Matrix m n a .upper : Num a => DecompLU mat -> Matrix (minimum m n) n a The upper triangular matrix U of the LU decomposition.
.upper' : Num a => DecompLU mat -> Matrix' n a The upper triangular matrix U of the LU decomposition.
This accessor is intended to be used for square matrix decompositions.
lower : Num a => DecompLU mat -> Matrix m (minimum m n) a The lower triangular matrix L of the LU decomposition.
Totality: total
Visibility: export.lower : Num a => DecompLU mat -> Matrix m (minimum m n) a The lower triangular matrix L of the LU decomposition.
Totality: total
Visibility: exportlower' : Num a => DecompLU mat -> Matrix' n a The lower triangular matrix L of the LU decomposition.
This accessor is intended to be used for square matrix decompositions.
Totality: total
Visibility: export.lower' : Num a => DecompLU mat -> Matrix' n a The lower triangular matrix L of the LU decomposition.
This accessor is intended to be used for square matrix decompositions.
Totality: total
Visibility: exportupper : Num a => DecompLU mat -> Matrix (minimum m n) n a The upper triangular matrix U of the LU decomposition.
Totality: total
Visibility: export.upper : Num a => DecompLU mat -> Matrix (minimum m n) n a The upper triangular matrix U of the LU decomposition.
Totality: total
Visibility: exportupper' : Num a => DecompLU mat -> Matrix' n a The upper triangular matrix U of the LU decomposition.
This accessor is intended to be used for square matrix decompositions.
Totality: total
Visibility: export.upper' : Num a => DecompLU mat -> Matrix' n a The upper triangular matrix U of the LU decomposition.
This accessor is intended to be used for square matrix decompositions.
Totality: total
Visibility: exportdecompLU : Field a => (mat : Matrix m n a) -> Maybe (DecompLU mat) Calculate the LU decomposition of a matrix, returning `Nothing` if one
does not exist.
Totality: total
Visibility: exportrecord DecompLUP : Matrix m n a -> Type The LUP decomposition of a matrix.
LUP decomposition is similar to LU decomposition, but the matrix may have
its rows permuted before being factored. More formally, an LUP decomposition
of a matrix A consists of a lower triangular matrix L, an upper triangular
matrix U, and a permutation matrix P, such that PA = LU.
Totality: total
Visibility: export
Constructor: MkLUP : Matrix m n a -> Permutation m -> Nat -> DecompLUP mat
Projections:
.lower : Num a => DecompLUP mat -> Matrix m (minimum m n) a The lower triangular matrix L of the LUP decomposition.
.lower' : Num a => DecompLUP mat -> Matrix' n a The lower triangular matrix L of the LUP decomposition.
This accessor is intended to be used for square matrix decompositions.
.lu : DecompLUP mat -> Matrix m n a .p : DecompLUP mat -> Permutation m .permute : DecompLUP mat -> Permutation m The row permutation of the LUP decomposition.
.sw : DecompLUP mat -> Nat .upper : Num a => DecompLUP mat -> Matrix (minimum m n) n a The upper triangular matrix U of the LUP decomposition.
.upper' : Num a => DecompLUP mat -> Matrix' n a The upper triangular matrix U of the LUP decomposition.
This accessor is intended to be used for square matrix decompositions.
lower : Num a => DecompLUP mat -> Matrix m (minimum m n) a The lower triangular matrix L of the LUP decomposition.
Totality: total
Visibility: export.lower : Num a => DecompLUP mat -> Matrix m (minimum m n) a The lower triangular matrix L of the LUP decomposition.
Totality: total
Visibility: exportlower' : Num a => DecompLUP mat -> Matrix' n a The lower triangular matrix L of the LUP decomposition.
This accessor is intended to be used for square matrix decompositions.
Totality: total
Visibility: export.lower' : Num a => DecompLUP mat -> Matrix' n a The lower triangular matrix L of the LUP decomposition.
This accessor is intended to be used for square matrix decompositions.
Totality: total
Visibility: exportupper : Num a => DecompLUP mat -> Matrix (minimum m n) n a The upper triangular matrix U of the LUP decomposition.
Totality: total
Visibility: export.upper : Num a => DecompLUP mat -> Matrix (minimum m n) n a The upper triangular matrix U of the LUP decomposition.
Totality: total
Visibility: exportupper' : Num a => DecompLUP mat -> Matrix' n a The upper triangular matrix U of the LUP decomposition.
This accessor is intended to be used for square matrix decompositions.
Totality: total
Visibility: export.upper' : Num a => DecompLUP mat -> Matrix' n a The upper triangular matrix U of the LUP decomposition.
This accessor is intended to be used for square matrix decompositions.
Totality: total
Visibility: exportpermute : DecompLUP mat -> Permutation m The row permutation of the LUP decomposition.
Totality: total
Visibility: export.permute : DecompLUP mat -> Permutation m The row permutation of the LUP decomposition.
Totality: total
Visibility: exportnumSwaps : DecompLUP mat -> Nat The number of swaps in the permutation of the LUP decomposition.
This is stored along with the permutation in order to increase the
efficiency of certain algorithms.
Totality: total
Visibility: exportfromLU : DecompLU mat -> DecompLUP mat Convert an LU decomposition into an LUP decomposition.
Totality: total
Visibility: exportdecompLUP : FieldCmp a => (mat : Matrix m n a) -> DecompLUP mat Calculate the LUP decomposition of a matrix.
Totality: total
Visibility: exportdetWithLUP : Num a => (mat : Matrix' n a) -> DecompLUP mat -> a Calculate the determinant of a matrix given its LUP decomposition.
Totality: total
Visibility: exportdet : FieldCmp a => Matrix' n a -> a Calculate the determinant of a matrix.
Totality: total
Visibility: exportsolveLowerTri : Field a => Matrix' n a -> Vector n a -> Maybe (Vector n a) Solve a linear equation, assuming the matrix is lower triangular.
Any entries other than those below the diagonal are ignored.
Totality: total
Visibility: exportsolveUpperTri : Field a => Matrix' n a -> Vector n a -> Maybe (Vector n a) Solve a linear equation, assuming the matrix is upper triangular.
Any entries other than those above the diagonal are ignored.
Totality: total
Visibility: exportsolveWithLUP : Field a => (mat : Matrix' n a) -> DecompLUP mat -> Vector n a -> Maybe (Vector n a) Solve a linear equation, given a matrix and its LUP decomposition.
Totality: total
Visibility: exportsolve : FieldCmp a => Matrix' n a -> Vector n a -> Maybe (Vector n a) Solve a linear equation given a matrix.
Totality: total
Visibility: exportinvertible : FieldCmp a => Matrix' n a -> Bool Determine whether a matrix has an inverse.
Totality: total
Visibility: exporttryInverse : FieldCmp a => Matrix' n a -> Maybe (Matrix' n a) Try to invert a square matrix, returning `Nothing` if an inverse
does not exist.
Totality: total
Visibility: export