Safe Haskell | None |
---|
Algorithms.CL.SNFMatrix
Description
A data structure representing an m×n matrix and some operations on it.
The SNF transformation is similar to Gaussian elimination, but using integers, which form a principal ideal domain. There is a handful of operations that we implement as operations on rows, and then using efficient transposition, these operations can be applied to columns.
- data SNFMatrix a = SNFMatrix Int Int (Array (Int, Int) a) Bool
- transpose :: SNFMatrix a -> SNFMatrix a
- rows :: SNFMatrix a -> Int
- cols :: SNFMatrix a -> Int
- row_list :: SNFMatrix a -> [Int]
- col_list :: SNFMatrix a -> [Int]
- idx :: SNFMatrix a -> Int -> Int -> (Int, Int)
- mtx_elem :: Show a => SNFMatrix a -> Int -> Int -> a
- mulrow :: (Show a, Num a) => SNFMatrix a -> Int -> a -> SNFMatrix a
- swaprows :: Show a => SNFMatrix a -> Int -> Int -> SNFMatrix a
- addmulrow :: (Show a, Num a) => SNFMatrix a -> Int -> Int -> a -> SNFMatrix a
- printSNF :: Show a => SNFMatrix a -> [String]
- matrixFromList :: [[a]] -> SNFMatrix a
Documentation
A data type to hold an m×n integer matrix (aij). The fields are: m, the number of rows; n, the number of columns; a, the matrix data, and isTranspose, a flag to indicate whether the matrix should be transposed.
idx :: SNFMatrix a -> Int -> Int -> (Int, Int)Source
Get an index tuple into the matrix given row and column.
mulrow :: (Show a, Num a) => SNFMatrix a -> Int -> a -> SNFMatrix aSource
Multiply a row of the matrix by a multiplier.
addmulrow :: (Show a, Num a) => SNFMatrix a -> Int -> Int -> a -> SNFMatrix aSource
Add a multiple of a row to another row.
matrixFromList :: [[a]] -> SNFMatrix aSource
Construct an SNFMatrix
from a list.