sparse-lin-alg-0.3: Small library for effective linear algebra on sparse matrices

Safe HaskellSafe-Infered

Math.LinearAlgebra.Sparse.Algorithms.Staircase

Synopsis

Documentation

staircase :: Integral α => SparseMatrix α -> (SparseMatrix α, SparseMatrix α)Source

Staircase Form of matrix.

It uses an identity matrix as initial protocol matrix for staircase'.

It returns also transformation matrix:

>>> let (s, t) = staircase m  in  t × m == s
True

Usage of divMod causes Integral context. (TODO: eliminate it)

Method: Gauss method applied to the rows of matrix. Though α may be not a field, we repeat the remainder division to obtain zeroes down in the column.

staircase' :: Integral a => SparseMatrix a -> SparseMatrix a -> (SparseMatrix a, SparseMatrix a)Source

Staircase Form of matrix.

It takes matrix itself and initial protocol matrix and applies all transformations to both of them in the same way, and then returns matrix in the staircase form and a transformation matrix.

Usage of divMod causes Integral context. (TODO: eliminate it)

Method: Gauss method applied to the rows of matrix. Though α may be not a field, we repeat the remainder division to obtain zeroes down in the column.

clearColumnSource

Arguments

:: Integral t 
=> Index

row index (clears column beneath this row)

-> Index

column index

-> SparseMatrix t

matrix itself

-> SparseMatrix t

protocol matrix

-> (SparseMatrix t, SparseMatrix t)

result matrix and changed protocol matrix

Fills column with zeroes

extGCD :: (Num α, Integral α) => α -> α -> (SparseVector α, SparseVector α)Source

Extended Euclid algorithm