
Numeric.LinearAlgebra.Algorithms  Portability  uses ffi  Stability  provisional  Maintainer  Alberto Ruiz (aruiz at um dot es) 





Description 
A generic interface for some common functions. Using it we can write higher level algorithms
and testing properties both for real and complex matrices.
In any case, the specific functions for particular base types can also be explicitly
imported from Numeric.LinearAlgebra.LAPACK.


Synopsis 

inv :: Field t => Matrix t > Matrix t   pinv :: Field t => Matrix t > Matrix t   pinvTol   det :: Field t => Matrix t > t   rank :: Field t => Matrix t > Int   rcond :: Field t => Matrix t > Double   full :: Element t => (Matrix t > (Matrix t, Vector Double, Matrix t)) > Matrix t > (Matrix t, Matrix Double, Matrix t)   economy :: Element t => (Matrix t > (Matrix t, Vector Double, Matrix t)) > Matrix t > (Matrix t, Vector Double, Matrix t)   eigSH :: Field t => Matrix t > (Vector Double, Matrix t)   chol :: Field t => Matrix t > Matrix t   lu :: Field t => Matrix t > (Matrix t, Matrix t, Matrix t, t)   expm :: Field t => Matrix t > Matrix t   sqrtm :: Field t => Matrix t > Matrix t   matFunc :: Field t => (Complex Double > Complex Double) > Matrix t > Matrix (Complex Double)   nullspacePrec :: Field t => Double > Matrix t > [Vector t]   nullVector :: Field t => Matrix t > Vector t   class Normed t where      eps :: Double   i :: Complex Double   haussholder :: Field a => a > Vector a > Matrix a   unpackQR :: Field t => (Matrix t, Vector t) > (Matrix t, Matrix t)   unpackHess :: Field t => (Matrix t > (Matrix t, Vector t)) > Matrix t > (Matrix t, Matrix t)   class (Normed (Matrix t), Linear Vector t, Linear Matrix t) => Field t where  



Linear Systems



Inverse of a square matrix using lapacks' dgesv and zgesv.



Pseudoinverse of a general matrix using lapack's dgelss or zgelss.


pinvTol 


determinant of a square matrix, computed from the LU decomposition.



Number of linearly independent rows or columns.



Reciprocal of the 2norm condition number of a matrix, computed from the SVD.


Matrix factorizations


Singular value decomposition



A version of svd which returns an appropriate diagonal matrix with the singular values.
If (u,d,v) = full svd m then m == u <> d <> trans v.



A version of svd which returns only the nonzero singular values and the corresponding rows and columns of the rotations.
If (u,s,v) = economy svd m then m == u <> diag s <> trans v.


Eigensystems



Eigenvalues and Eigenvectors of a complex hermitian or real symmetric matrix using lapack's dsyev or zheev.
If (s,v) = eigSH m then m == v <> diag s <> ctrans v


QR


Cholesky



Cholesky factorization of a positive definite hermitian or symmetric matrix using lapack's dpotrf or zportrf.
If c = chol m then m == ctrans c <> c.


Hessenberg


Schur


LU



LU factorization of a general matrix using lapack's dgetrf or zgetrf.
If (l,u,p,s) = lu m then m == p <> l <> u, where l is lower triangular,
u is upper triangular, p is a permutation matrix and s is the signature of the permutation.


Matrix functions



Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan,
based on a scaled Pade approximation.



Matrix square root. Currently it uses a simple iterative algorithm described in Wikipedia.
It only works with invertible matrices that have a real solution. For diagonalizable matrices you can try matFunc sqrt.
m = (2><2) [4,9
,0,4] :: Matrix Double >sqrtm m
(2><2)
[ 2.0, 2.25
, 0.0, 2.0 ] 


Generic matrix functions for diagonalizable matrices. For instance:
logm = matFunc log 

Nullspace



:: Field t   => Double  relative tolerance in eps units
 > Matrix t  input matrix
 > [Vector t]  list of unitary vectors spanning the nullspace
 The nullspace of a matrix from its SVD decomposition.




The nullspace of a matrix, assumed to be onedimensional, with default tolerance (shortcut for last . nullspacePrec 1).


Norms



Objects which have a pnorm.
Using it you can define convenient shortcuts:
norm2 x = pnorm PNorm2 x frobenius m = norm2 . flatten $ m   Methods    Instances  





Misc



The machine precision of a Double: eps = 2.22044604925031e16 (the value used by GNUOctave).



The imaginary unit: i = 0.0 :+ 1.0


Util









Auxiliary typeclass used to define generic computations for both real and complex matrices.
  Methods   Singular value decomposition using lapack's dgesvd or zgesvd.
   Solution of a general linear system (for several righthand sides) using lapacks' dgesv and zgesv.
See also other versions of linearSolve in Numeric.LinearAlgebra.LAPACK.
     Eigenvalues and eigenvectors of a general square matrix using lapack's dgeev or zgeev.
If (s,v) = eig m then m <> v == v <> diag s
   Similar to eigSH without checking that the input matrix is hermitian or symmetric.
   Similar to chol without checking that the input matrix is hermitian or symmetric.
   QR factorization using lapack's dgeqr2 or zgeqr2.
If (q,r) = qr m then m == q <> r, where q is unitary and r is upper triangular.
   Hessenberg factorization using lapack's dgehrd or zgehrd.
If (p,h) = hess m then m == p <> h <> ctrans p, where p is unitary
and h is in upper Hessenberg form.
   Schur factorization using lapack's dgees or zgees.
If (u,s) = schur m then m == u <> s <> ctrans u, where u is unitary
and s is a Shur matrix. A complex Schur matrix is upper triangular. A real Schur matrix is
upper triangular in 2x2 blocks.
"Anything that the Jordan decomposition can do, the Schur decomposition
can do better!" (Van Loan)
   Conjugate transpose.

  Instances  


Produced by Haddock version 2.4.2 