sparse-tensor-0.2.0.0: typesafe tensor algebra library

Copyright(c) 2019 Tobias Reinhart and Nils Alex
LicenseMIT
Maintainertobi.reinhart@fau.de, nils.alex@fau.de
Safe HaskellNone
LanguageHaskell2010

Math.Tensor.Internal.LinearAlgebra

Contents

Description

Gaussian elimination algorithm based on hmatrix.

Synopsis

Gaussian Elimination

gaussianST :: STMatrix s Double -> ST s () Source #

Gaussian elimination perfomed in-place in the ST monad.

gaussian :: Matrix Double -> Matrix Double Source #

Gaussian elimination as pure function. Involves a copy of the input matrix.

λ let mat = (3 >< 4) [1, 1, -2, 0, 0, 2, -6, -4, 3, 0, 3, 1]
λ mat
(3><4)
 [ 1.0, 1.0, -2.0,  0.0
 , 0.0, 2.0, -6.0, -4.0
 , 3.0, 0.0,  3.0,  1.0 ]
λ gaussian mat
(3><4)
 [ 3.0, 0.0,  3.0,                1.0
 , 0.0, 2.0, -6.0,               -4.0
 , 0.0, 0.0,  0.0, 1.6666666666666667 ]

Linearly Independent Columns

independentColumns :: Matrix Double -> [Int] Source #

Returns the indices of a maximal linearly independent subset of the columns in the matrix.

λ let mat = (3 >< 4) [1, 1, -2, 0, 0, 2, -6, -4, 3, 0, 3, 1]
λ mat
(3><4)
 [ 1.0, 1.0, -2.0,  0.0
 , 0.0, 2.0, -6.0, -4.0
 , 3.0, 0.0,  3.0,  1.0 ]
λ independentColumns mat
[0,1,3]

independentColumnsMat :: Matrix Double -> Matrix Double Source #

Returns a sub matrix containing a maximal linearly independent subset of the columns in the matrix.

λ let mat = (3 >< 4) [1, 1, -2, 0, 0, 2, -6, -4, 3, 0, 3, 1]
λ mat
(3><4)
 [ 1.0, 1.0, -2.0,  0.0
 , 0.0, 2.0, -6.0, -4.0
 , 3.0, 0.0,  3.0,  1.0 ]
λ independentColumnsMat mat
(3><3)
 [ 1.0, 1.0,  0.0
 , 0.0, 2.0, -4.0
 , 3.0, 0.0,  1.0 ]

Pivots

pivotsU :: Matrix Double -> [Int] Source #

Returns the pivot columns of an upper triangular matrix.

λ let mat = (3 >< 4) [1, 0, 2, -3, 0, 0, 1, 0, 0, 0, 0, 0]
λ mat
(3><4)
 [ 1.0, 0.0, 2.0, -3.0
 , 0.0, 0.0, 1.0,  0.0
 , 0.0, 0.0, 0.0,  0.0 ]
λ pivotsU mat
[0,2]

findPivotMax :: Matrix Double -> Int -> Int -> Maybe (Int, Int) Source #

Find pivot element below position (i, j) with greatest absolute value.