-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Numerical Linear Algebra using LAPACK -- -- This is a high-level interface to LAPACK. It provides solvers for -- simultaneous linear equations, linear least-squares problems, -- eigenvalue and singular value problems for matrices with certain kinds -- of structures. -- -- Features: -- --
-- dot x y = Matrix.toScalar (singleRow x <#> singleColumn y) --dot :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> a -- |
-- inner x y = dot (conjugate x) y --inner :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> a sum :: (C sh, Floating a) => Vector sh a -> a -- | Sum of the absolute values of real numbers or components of complex -- numbers. For real numbers it is equivalent to norm1. absSum :: (C sh, Floating a) => Vector sh a -> RealOf a norm1 :: (C sh, Floating a) => Vector sh a -> RealOf a -- | Euclidean norm of a vector or Frobenius norm of a matrix. norm2 :: (C sh, Floating a) => Vector sh a -> RealOf a normInf :: (C sh, Floating a) => Vector sh a -> RealOf a -- | Computes (almost) the infinity norm of the vector. For complex numbers -- every element is replaced by the sum of the absolute component values -- first. normInf1 :: (C sh, Floating a) => Vector sh a -> RealOf a -- | Returns the index and value of the element with the maximal absolute -- value. Caution: It actually returns the value of the element, not its -- absolute value! argAbsMaximum :: (InvIndexed sh, Floating a) => Vector sh a -> (Index sh, a) -- | Returns the index and value of the element with the maximal absolute -- value. The function does not strictly compare the absolute value of a -- complex number but the sum of the absolute complex components. -- Caution: It actually returns the value of the element, not its -- absolute value! argAbs1Maximum :: (InvIndexed sh, Floating a) => Vector sh a -> (Index sh, a) product :: (C sh, Floating a) => Vector sh a -> a scale :: (C sh, Floating a) => a -> Vector sh a -> Vector sh a scaleReal :: (C sh, Floating a) => RealOf a -> Vector sh a -> Vector sh a add :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a sub :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a mac :: (C sh, Eq sh, Floating a) => a -> Vector sh a -> Vector sh a -> Vector sh a mul :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a conjugate :: (C sh, Floating a) => Vector sh a -> Vector sh a fromReal :: (C sh, Floating a) => Vector sh (RealOf a) -> Vector sh a toComplex :: (C sh, Floating a) => Vector sh a -> Vector sh (ComplexOf a) realPart :: (C sh, Floating a) => Vector sh a -> Vector sh (RealOf a) complexFromReal :: (C sh, Real a) => Vector sh a -> Vector sh (Complex a) complexToRealPart :: (C sh, Real a) => Vector sh (Complex a) -> Vector sh a complexToImaginaryPart :: (C sh, Real a) => Vector sh (Complex a) -> Vector sh a zipComplex :: (C sh, Eq sh, Real a) => Vector sh a -> Vector sh a -> Vector sh (Complex a) unzipComplex :: (C sh, Real a) => Vector sh (Complex a) -> (Vector sh a, Vector sh a) random :: (C sh, Floating a) => RandomDistribution -> sh -> Word64 -> Vector sh a data RandomDistribution UniformBox01 :: RandomDistribution UniformBoxPM1 :: RandomDistribution Normal :: RandomDistribution UniformDisc :: RandomDistribution UniformCircle :: RandomDistribution instance Eq RandomDistribution instance Ord RandomDistribution instance Show RandomDistribution instance Enum RandomDistribution module Numeric.LAPACK.Format (##) :: Format a => a -> String -> IO () class Format a format :: Format a => String -> a -> Box class C sh => FormatArray sh formatArray :: (FormatArray sh, Floating a) => String -> Array sh a -> Box deflt :: String instance Eq Separator instance Ord Separator instance Show Separator instance (Natural offDiag, C size) => FormatArray (BandedHermitian offDiag size) instance (Natural sub, Natural super, C vert, C horiz, C height, C width) => FormatArray (Banded sub super vert horiz height width) instance (Content lo, Content up, TriDiag diag, C size) => FormatArray (Triangular lo diag up size) instance C size => FormatArray (Hermitian size) instance (Eq lower, C vert, C horiz, C height, C width) => FormatArray (Split lower vert horiz height width) instance (C vert, C horiz, C height, C width) => FormatArray (Full vert horiz height width) instance Integral i => FormatArray (OneBased i) instance Integral i => FormatArray (ZeroBased i) instance (FormatArray sh, Floating a) => Format (Array sh a) instance (Format a, Format b, Format c) => Format (a, b, c) instance (Format a, Format b) => Format (a, b) instance Format a => Format [a] instance Real a => Format (Complex a) instance Format Double instance Format Float instance Format Int module Numeric.LAPACK.ShapeStatic -- | ZeroBased denotes a range starting at zero and has a certain -- length. newtype ZeroBased n ZeroBased :: UnaryProxy n -> ZeroBased n zeroBasedSize :: ZeroBased n -> UnaryProxy n vector :: (Natural n, Storable a) => T n a -> Array (ZeroBased n) a instance Eq (ZeroBased n) instance Natural n => Show (ZeroBased n) instance Natural n => InvIndexed (ZeroBased n) instance Natural n => Indexed (ZeroBased n) instance Natural n => C (ZeroBased n) module Numeric.LAPACK.Matrix.HermitianPositiveDefinite solve :: (C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Hermitian sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a -- |
-- solve a b == solveDecomposed (decompose a) b -- solve (covariance u) b == solveDecomposed u b --solveDecomposed :: (C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Upper sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a inverse :: (C sh, Floating a) => Hermitian sh a -> Hermitian sh a -- | Cholesky decomposition decompose :: (C sh, Floating a) => Hermitian sh a -> Upper sh a determinant :: (C sh, Floating a) => Hermitian sh a -> RealOf a module Numeric.LAPACK.Matrix.Hermitian type Hermitian sh = Array (Hermitian sh) data Transposition NonTransposed :: Transposition Transposed :: Transposition fromList :: (C sh, Storable a) => Order -> sh -> [a] -> Hermitian sh a autoFromList :: Storable a => Order -> [a] -> Hermitian ZeroInt a identity :: (C sh, Floating a) => Order -> sh -> Hermitian sh a diagonal :: (C sh, Floating a) => Order -> Vector sh (RealOf a) -> Hermitian sh a takeDiagonal :: (C sh, Floating a) => Hermitian sh a -> Vector sh (RealOf a) multiplyVector :: (C sh, Eq sh, Floating a) => Transposition -> Hermitian sh a -> Vector sh a -> Vector sh a square :: (C sh, Eq sh, Floating a) => Hermitian sh a -> Hermitian sh a multiplyFull :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Transposition -> Hermitian height a -> Full vert horiz height width a -> Full vert horiz height width a outer :: (C sh, Floating a) => Order -> Vector sh a -> Hermitian sh a sumRank1 :: (C sh, Eq sh, Floating a) => Order -> sh -> [(RealOf a, Vector sh a)] -> Hermitian sh a sumRank1NonEmpty :: (C sh, Eq sh, Floating a) => Order -> T [] (RealOf a, Vector sh a) -> Hermitian sh a sumRank2 :: (C sh, Eq sh, Floating a) => Order -> sh -> [(a, (Vector sh a, Vector sh a))] -> Hermitian sh a sumRank2NonEmpty :: (C sh, Eq sh, Floating a) => Order -> T [] (a, (Vector sh a, Vector sh a)) -> Hermitian sh a toSquare :: (C sh, Floating a) => Hermitian sh a -> Square sh a -- | A^H * A covariance :: (C height, C width, Eq width, Floating a) => General height width a -> Hermitian width a -- | A^H + A addAdjoint :: (C sh, Floating a) => Square sh a -> Hermitian sh a solve :: (C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Hermitian sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a inverse :: (C sh, Floating a) => Hermitian sh a -> Hermitian sh a determinant :: (C sh, Floating a) => Hermitian sh a -> RealOf a eigenvalues :: (C sh, Floating a) => Hermitian sh a -> Vector sh (RealOf a) -- | For symmetric eigenvalue problems, eigensystem and -- schur coincide. eigensystem :: (C sh, Floating a) => Hermitian sh a -> (Square sh a, Vector sh (RealOf a)) module Numeric.LAPACK.Matrix.BandedHermitian type BandedHermitian offDiag size = Array (BandedHermitian offDiag size) data Transposition NonTransposed :: Transposition Transposed :: Transposition fromList :: (Natural offDiag, C size, Storable a) => UnaryProxy offDiag -> Order -> size -> [a] -> BandedHermitian offDiag size a identity :: (C sh, Floating a) => sh -> Diagonal sh a diagonal :: (C sh, Floating a) => Vector sh (RealOf a) -> Diagonal sh a takeDiagonal :: (Natural offDiag, C size, Floating a) => BandedHermitian offDiag size a -> Vector size (RealOf a) toHermitian :: (Natural offDiag, C size, Floating a) => BandedHermitian offDiag size a -> Hermitian size a toBanded :: (Natural offDiag, C size, Floating a) => BandedHermitian offDiag size a -> Square offDiag offDiag size a multiplyVector :: (Natural offDiag, C size, Eq size, Floating a) => Transposition -> BandedHermitian offDiag size a -> Vector size a -> Vector size a multiplyFull :: (Natural offDiag, C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Transposition -> BandedHermitian offDiag height a -> Full vert horiz height width a -> Full vert horiz height width a covariance :: (C size, Eq size, Floating a, Natural sub, Natural super) => Square sub super size a -> BandedHermitian (sub :+: super) size a sumRank1 :: (Natural k, Indexed sh, Floating a) => Order -> sh -> [(RealOf a, (Index sh, StaticVector (Succ k) a))] -> BandedHermitian k sh a eigenvalues :: (Natural offDiag, C sh, Floating a) => BandedHermitian offDiag sh a -> Vector sh (RealOf a) -- | For symmetric eigenvalue problems, eigensystem and -- schur coincide. eigensystem :: (Natural offDiag, C sh, Floating a) => BandedHermitian offDiag sh a -> (Square sh a, Vector sh (RealOf a)) module Numeric.LAPACK.Matrix.BandedHermitianPositiveDefinite solve :: (Natural offDiag, C size, Eq size, C vert, C horiz, C nrhs, Floating a) => BandedHermitian offDiag size a -> Full vert horiz size nrhs a -> Full vert horiz size nrhs a -- |
-- solve a b == solveDecomposed (decompose a) b -- solve (covariance u) b == solveDecomposed u b --solveDecomposed :: (Natural offDiag, C size, Eq size, C vert, C horiz, C nrhs, Floating a) => Upper offDiag size a -> Full vert horiz size nrhs a -> Full vert horiz size nrhs a -- | Cholesky decomposition decompose :: (Natural offDiag, C size, Floating a) => BandedHermitian offDiag size a -> Upper offDiag size a determinant :: (Natural offDiag, C size, Floating a) => BandedHermitian offDiag size a -> RealOf a module Numeric.LAPACK.Matrix.Square type Square sh = Array (Square sh) size :: Square sh a -> sh toFull :: (C vert, C horiz) => Square sh a -> Full vert horiz sh sh a toGeneral :: Square sh a -> General sh sh a fromGeneral :: Eq sh => General sh sh a -> Square sh a fromScalar :: Storable a => a -> Square () a toScalar :: Storable a => Square () a -> a fromList :: (C sh, Storable a) => sh -> [a] -> Square sh a autoFromList :: Storable a => [a] -> Square ZeroInt a transpose :: Square sh a -> Square sh a -- | conjugate transpose adjoint :: (C sh, Floating a) => Square sh a -> Square sh a identity :: (C sh, Floating a) => sh -> Square sh a identityFrom :: (C sh, Floating a) => Square sh a -> Square sh a identityFromWidth :: (C height, C width, Floating a) => General height width a -> Square width a identityFromHeight :: (C height, C width, Floating a) => General height width a -> Square height a diagonal :: (C sh, Floating a) => Vector sh a -> Square sh a takeDiagonal :: (C sh, Floating a) => Square sh a -> Vector sh a trace :: (C sh, Floating a) => Square sh a -> a multiply :: (C sh, Eq sh, Floating a) => Square sh a -> Square sh a -> Square sh a square :: (C sh, Floating a) => Square sh a -> Square sh a power :: (C sh, Floating a) => Integer -> Square sh a -> Square sh a solve :: (C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Square sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a inverse :: (C sh, Floating a) => Square sh a -> Square sh a determinant :: (C sh, Floating a) => Square sh a -> a eigenvalues :: (C sh, Floating a) => Square sh a -> Vector sh (ComplexOf a) -- | If (q,r) = schur a, then a = q <> adjoint q, -- where q is unitary (orthogonal) and r is a -- right-upper triangular matrix for complex a and a -- 1x1-or-2x2-block upper triangular matrix for real a. With -- takeDiagonal r you get all eigenvalues of a if -- a is complex and the real parts of the eigenvalues if -- a is real. Complex conjugated eigenvalues of a real matrix -- a are encoded as 2x2 blocks along the diagonal. schur :: (C sh, Floating a) => Square sh a -> (Square sh a, Square sh a) -- |
-- (vr,d,vl) = eigensystem a ---- -- Counterintuitively, vr contains the right eigenvectors and -- vl contains the left eigenvectors as columns. The idea is to -- provide a decomposition of a. If a is -- diagonalizable, then vr and vl are almost inverse to -- each other. More precisely, adjoint vl <#> vr is a -- diagonal matrix. This is because all eigenvectors are normalized to -- Euclidean norm 1. With the following scaling, the decomposition -- becomes perfect: -- --
-- let scal = Array.map recip $ takeDiagonal $ adjoint vl <#> vr -- a == vr <#> diagonal d <#> diagonal scal <#> adjoint vl ---- -- If a is non-diagonalizable then some columns of vr -- and vl are left zero and the above property does not hold. eigensystem :: (C sh, Floating a) => Square sh a -> (Square sh (ComplexOf a), Vector sh (ComplexOf a), Square sh (ComplexOf a)) type ComplexOf x = Complex (RealOf x) module Numeric.LAPACK.Matrix.Banded type Banded sub super vert horiz height width = Array (Banded sub super vert horiz height width) type General sub super height width = Array (BandedGeneral sub super height width) type Square sub super size = Array (BandedSquare sub super size) type Upper super size = Square U0 super size type Lower sub size = Square sub U0 size type Diagonal size = Square U0 U0 size fromList :: (Natural sub, Natural super, C height, C width, Storable a) => (UnaryProxy sub, UnaryProxy super) -> Order -> height -> width -> [a] -> General sub super height width a squareFromList :: (Natural sub, Natural super, C size, Storable a) => (UnaryProxy sub, UnaryProxy super) -> Order -> size -> [a] -> Square sub super size a lowerFromList :: (Natural sub, C size, Storable a) => UnaryProxy sub -> Order -> size -> [a] -> Lower sub size a upperFromList :: (Natural super, C size, Storable a) => UnaryProxy super -> Order -> size -> [a] -> Upper super size a mapExtent :: (C vertA, C horizA) => (C vertB, C horizB) => Map vertA horizA vertB horizB height width -> Banded super sub vertA horizA height width a -> Banded super sub vertB horizB height width a diagonal :: (C sh, Floating a) => Vector sh a -> Diagonal sh a takeDiagonal :: (Natural sub, Natural super, C sh, Floating a) => Square sub super sh a -> Vector sh a toFull :: (Natural sub, Natural super, C vert, C horiz, C height, C width, Floating a) => Banded sub super vert horiz height width a -> Full vert horiz height width a toLowerTriangular :: (Natural sub, C sh, Floating a) => Lower sub sh a -> Lower sh a toUpperTriangular :: (Natural super, C sh, Floating a) => Upper super sh a -> Upper sh a transpose :: (C vert, C horiz) => Banded sub super vert horiz height width a -> Banded super sub horiz vert width height a adjoint :: (Natural super, Natural sub, C vert, C horiz, C width, C height, Floating a) => Banded sub super vert horiz height width a -> Banded super sub horiz vert width height a multiplyVector :: (Natural sub, Natural super, C vert, C horiz, C height, C width, Eq width, Floating a) => Banded sub super vert horiz height width a -> Vector width a -> Vector height a multiply :: (Natural subA, Natural superA, Natural subB, Natural superB, (subA :+: subB) ~ subC, (superA :+: superB) ~ superC, C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) => Banded subA superA vert horiz height fuse a -> Banded subB superB vert horiz fuse width a -> Banded subC superC vert horiz height width a multiplyFull :: (Natural sub, Natural super, C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) => Banded sub super vert horiz height fuse a -> Full vert horiz fuse width a -> Full vert horiz height width a height :: (C vert, C horiz) => Banded sub super vert horiz height width a -> height width :: (C vert, C horiz) => Banded sub super vert horiz height width a -> width solve :: (Natural sub, Natural super, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Square sub super sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a determinant :: (Natural sub, Natural super, C sh, Floating a) => Square sub super sh a -> a module Numeric.LAPACK.Orthogonal.Householder data Householder vert horiz height width a type General = Householder Big Big type Tall = Householder Big Small type Wide = Householder Small Big type Square sh = Householder Small Small sh sh mapExtent :: (C vertA, C horizA) => (C vertB, C horizB) => Map vertA horizA vertB horizB height width -> Householder vertA horizA height width a -> Householder vertB horizB height width a fromMatrix :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Householder vert horiz height width a determinant :: (C sh, Floating a) => Square sh a -> a determinantAbsolute :: (C vert, C horiz, C height, C width, Floating a) => Householder vert horiz height width a -> RealOf a leastSquares :: (C vert, C horiz, C height, Eq height, C width, Eq width, C nrhs, Floating a) => Householder horiz Small height width a -> Full vert horiz height nrhs a -> Full vert horiz width nrhs a -- |
-- HH.minimumNorm (HH.fromMatrix a) b -- == -- Ortho.minimumNorm (adjoint a) b --minimumNorm :: (C vert, C horiz, C height, Eq height, C width, Eq width, C nrhs, Floating a) => Householder vert Small width height a -> Full vert horiz height nrhs a -> Full vert horiz width nrhs a data Transposition NonTransposed :: Transposition Transposed :: Transposition data Conjugation NonConjugated :: Conjugation Conjugated :: Conjugation data Inversion NonInverted :: Inversion Inverted :: Inversion extractQ :: (C vert, C horiz, C height, C width, Floating a) => Householder vert horiz height width a -> Square height a extractR :: (C vert, C horiz, C height, C width, Floating a) => Householder vert horiz height width a -> Full vert horiz height width a multiplyQ :: (C vertA, C horizA, C widthA, C vertB, C horizB, C widthB, C height, Eq height, Floating a) => Inversion -> Householder vertA horizA height widthA a -> Full vertB horizB height widthB a -> Full vertB horizB height widthB a tallExtractQ :: (C vert, C height, C width, Floating a) => Householder vert Small height width a -> Full vert Small height width a tallExtractR :: (C vert, C height, C width, Floating a) => Householder vert Small height width a -> Upper width a tallMultiplyQ :: (C vert, C horiz, C height, Eq height, C width, C fuse, Eq fuse, Floating a) => Householder vert Small height fuse a -> Full vert horiz fuse width a -> Full vert horiz height width a tallMultiplyQAdjoint :: (C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) => Householder horiz Small fuse height a -> Full vert horiz fuse width a -> Full vert horiz height width a tallMultiplyR :: (C vertA, C vert, C horiz, C height, Eq height, C heightA, C widthB, Floating a) => Transposition -> Householder vertA Small heightA height a -> Full vert horiz height widthB a -> Full vert horiz height widthB a tallSolveR :: (C vertA, C vert, C horiz, C height, C width, Eq width, C nrhs, Floating a) => Transposition -> Conjugation -> Householder vertA Small height width a -> Full vert horiz width nrhs a -> Full vert horiz width nrhs a module Numeric.LAPACK.Permutation data Permutation sh data Inversion NonInverted :: Inversion Inverted :: Inversion -- | The pivot array must be at most as long as Shape.size sh. fromPivots :: C sh => Inversion -> sh -> Vector ZeroInt CInt -> Permutation sh toPivots :: C sh => Inversion -> Permutation sh -> Vector sh CInt toMatrix :: (C sh, Floating a) => Permutation sh -> Square sh a determinant :: C sh => Permutation sh -> Sign numberFromSign :: Floating a => Sign -> a transpose :: C sh => Permutation sh -> Permutation sh multiply :: (C sh, Eq sh) => Permutation sh -> Permutation sh -> Permutation sh apply :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Bool -> Permutation height -> Full vert horiz height width a -> Full vert horiz height width a module Numeric.LAPACK.Linear.LowerUpper data LowerUpper vert horiz height width a type Square sh = LowerUpper Small Small sh sh data Transposition NonTransposed :: Transposition Transposed :: Transposition data Conjugation NonConjugated :: Conjugation Conjugated :: Conjugation data Inversion NonInverted :: Inversion Inverted :: Inversion mapExtent :: (C vertA, C horizA) => (C vertB, C horizB) => Map vertA horizA vertB horizB height width -> LowerUpper vertA horizA height width a -> LowerUpper vertB horizB height width a -- | LowerUpper.fromMatrix a computes the LU decomposition of -- matrix a with row pivotisation. -- -- You can reconstruct a from lu depending on wether -- a is tall or wide. -- --
-- LU.multiplyP False lu $ LU.extractL lu <#> LU.tallExtractU lu -- LU.multiplyP False lu $ LU.wideExtractL lu <#> LU.extractU lu --fromMatrix :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> LowerUpper vert horiz height width a toMatrix :: (C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => LowerUpper vert horiz height width a -> Full vert horiz height width a solve :: (C vert, C horiz, Eq height, C height, C width, Floating a) => Square height a -> Full vert horiz height width a -> Full vert horiz height width a multiplyFullRight :: (C vert, C horiz, C height, Eq height, C width, C fuse, Eq fuse, Floating a) => LowerUpper vert horiz height fuse a -> Full vert horiz fuse width a -> Full vert horiz height width a -- | Caution: LU.determinant . LU.fromMatrix will fail for -- singular matrices. determinant :: (C sh, Floating a, Eq a) => Square sh a -> a extractP :: (C vert, C horiz, C height) => Inversion -> LowerUpper vert horiz height width a -> Permutation height multiplyP :: (C vertA, C horizA, C vertB, C horizB, Eq height, C height, C widthA, C widthB, Floating a) => Inversion -> LowerUpper vertA horizA height widthA a -> Full vertB horizB height widthB a -> Full vertB horizB height widthB a extractL :: (C vert, C horiz, C height, C width, Floating a) => LowerUpper vert horiz height width a -> Full vert horiz height width a wideExtractL :: (C horiz, C height, C width, Floating a) => LowerUpper Small horiz height width a -> UnitLower height a -- | wideMultiplyL transposed lu a multiplies the square part of -- lu containing the lower triangular matrix with a. -- --
-- wideMultiplyL False lu a == wideExtractL lu <#> a -- wideMultiplyL True lu a == wideExtractL (Tri.transposeUp lu) <#> a --wideMultiplyL :: (C horizA, C vert, C horiz, C height, Eq height, C widthA, C widthB, Floating a) => Transposition -> LowerUpper Small horizA height widthA a -> Full vert horiz height widthB a -> Full vert horiz height widthB a wideSolveL :: (C horizA, C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => Transposition -> Conjugation -> LowerUpper Small horizA height width a -> Full vert horiz height nrhs a -> Full vert horiz height nrhs a extractU :: (C vert, C horiz, C height, C width, Floating a) => LowerUpper vert horiz height width a -> Full vert horiz height width a tallExtractU :: (C vert, C height, C width, Floating a) => LowerUpper vert Small height width a -> Upper width a -- | tallMultiplyU transposed lu a multiplies the square part of -- lu containing the upper triangular matrix with a. -- --
-- tallMultiplyU False lu a == tallExtractU lu <#> a -- tallMultiplyU True lu a == tallExtractU (Tri.transposeDown lu) <#> a --tallMultiplyU :: (C vertA, C vert, C horiz, C height, Eq height, C heightA, C widthB, Floating a) => Transposition -> LowerUpper vertA Small heightA height a -> Full vert horiz height widthB a -> Full vert horiz height widthB a tallSolveU :: (C vertA, C vert, C horiz, C height, C width, Eq width, C nrhs, Floating a) => Transposition -> Conjugation -> LowerUpper vertA Small height width a -> Full vert horiz width nrhs a -> Full vert horiz width nrhs a caseTallWide :: (C vert, C horiz, C height, C width) => LowerUpper vert horiz height width a -> Either (Tall height width a) (Wide height width a) instance (Show height, Show width, Show a, Storable a, C height, C width, C vert, C horiz) => Show (LowerUpper vert horiz height width a) instance (C vert, C horiz, C height, C width, Floating a) => Format (LowerUpper vert horiz height width a) module Numeric.LAPACK.Matrix.Triangular type Triangular lo diag up sh = Array (Triangular lo diag up sh) type UpLo lo up = (UpLoC lo up, UpLoC up lo) type Upper sh = FlexUpper NonUnit sh type UnitUpper sh = Array (UpperTriangular Unit sh) type Lower sh = FlexLower NonUnit sh type UnitLower sh = Array (LowerTriangular Unit sh) type Symmetric sh = Array (Symmetric sh) type Diagonal sh = FlexDiagonal NonUnit sh fromList :: (Content lo, Content up, C sh, Storable a) => Order -> sh -> [a] -> Triangular lo NonUnit up sh a autoFromList :: (Content lo, Content up, Storable a) => Order -> [a] -> Triangular lo NonUnit up ZeroInt a lowerFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Lower sh a autoLowerFromList :: Storable a => Order -> [a] -> Lower ZeroInt a upperFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Upper sh a autoUpperFromList :: Storable a => Order -> [a] -> Upper ZeroInt a symmetricFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Symmetric sh a autoSymmetricFromList :: Storable a => Order -> [a] -> Symmetric ZeroInt a diagonalFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Diagonal sh a autoDiagonalFromList :: Storable a => Order -> [a] -> Diagonal ZeroInt a relaxUnitDiagonal :: TriDiag diag => Triangular lo Unit up sh a -> Triangular lo diag up sh a strictNonUnitDiagonal :: TriDiag diag => Triangular lo diag up sh a -> Triangular lo NonUnit up sh a asDiagonal :: FlexDiagonal diag sh a -> FlexDiagonal diag sh a asLower :: FlexLower diag sh a -> FlexLower diag sh a asUpper :: FlexUpper diag sh a -> FlexUpper diag sh a asSymmetric :: FlexSymmetric diag sh a -> FlexSymmetric diag sh a forceUnitDiagonal :: Triangular lo Unit up sh a -> Triangular lo Unit up sh a forceNonUnitDiagonal :: Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a identity :: (Content lo, Content up, C sh, Floating a) => Order -> sh -> Triangular lo Unit up sh a diagonal :: (Content lo, Content up, C sh, Floating a) => Order -> Vector sh a -> Triangular lo NonUnit up sh a takeDiagonal :: (Content lo, Content up, C sh, Floating a) => Triangular lo diag up sh a -> Vector sh a transpose :: (Content lo, Content up, TriDiag diag) => Triangular lo diag up sh a -> Triangular up diag lo sh a adjoint :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular up diag lo sh a toSquare :: (Content lo, Content up, C sh, Floating a) => Triangular lo diag up sh a -> Square sh a takeUpper :: (C vert, C height, C width, Floating a) => Full vert Small height width a -> Upper width a takeLower :: (C horiz, C height, C width, Floating a) => Full Small horiz height width a -> Lower height a fromLowerRowMajor :: (C sh, Floating a) => Array (Triangular Lower sh) a -> Lower sh a toLowerRowMajor :: (C sh, Floating a) => Lower sh a -> Array (Triangular Lower sh) a fromUpperRowMajor :: (C sh, Floating a) => Array (Triangular Upper sh) a -> Upper sh a toUpperRowMajor :: (C sh, Floating a) => Upper sh a -> Array (Triangular Upper sh) a forceOrder :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Order -> Triangular lo diag up sh a -> Triangular lo diag up sh a -- | adaptOrder x y contains the data of y with the -- layout of x. adaptOrder :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -> Triangular lo diag up sh a add :: (Content lo, Content up, Eq lo, Eq up, Eq sh, C sh, Floating a) => Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a sub :: (Content lo, Content up, Eq lo, Eq up, Eq sh, C sh, Floating a) => Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a multiplyVector :: (Content lo, Content up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Vector sh a -> Vector sh a square :: (DiagUpLo lo up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -- | Include symmetric matrices. However, symmetric matrices do not -- preserve unit diagonals. squareGeneric :: (Content lo, Content up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo (PowerDiag lo up diag) up sh a multiply :: (DiagUpLo lo up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -> Triangular lo diag up sh a multiplyFull :: (Content lo, Content up, TriDiag diag, C vert, C horiz, C height, Eq height, C width, Floating a) => Triangular lo diag up height a -> Full vert horiz height width a -> Full vert horiz height width a solve :: (Content lo, Content up, TriDiag diag, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Triangular lo diag up sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a inverse :: (DiagUpLo lo up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a inverseGeneric :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo (PowerDiag lo up diag) up sh a determinant :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> a size :: Triangular lo diag up sh a -> sh eigenvalues :: (DiagUpLo lo up, C sh, Floating a) => Triangular lo diag up sh a -> Vector sh a -- |
-- (vr,d,vlAdj) = eigensystem a ---- -- Counterintuitively, vr contains the right eigenvectors as -- columns and vlAdj contains the left conjugated eigenvectors -- as rows. The idea is to provide a decomposition of a. If -- a is diagonalizable, then vr and vlAdj are -- almost inverse to each other. More precisely, vlAdj <#> -- vr is a diagonal matrix. This is because the eigenvectors are not -- normalized. With the following scaling, the decomposition becomes -- perfect: -- --
-- let scal = Array.map recip $ takeDiagonal $ vlAdj <#> vr -- a == vr <#> diagonal d <#> diagonal scal <#> vlAdj ---- -- If a is non-diagonalizable then some columns of vr -- and corresponding rows of vlAdj are left zero and the above -- property does not hold. eigensystem :: (DiagUpLo lo up, C sh, Floating a) => Triangular lo NonUnit up sh a -> (Triangular lo NonUnit up sh a, Vector sh a, Triangular lo NonUnit up sh a) module Numeric.LAPACK.Matrix.Shape type General height width = Full Big Big height width type Tall height width = Full Big Small height width type Wide height width = Full Small Big height width type Square size = Full Small Small size size data Full vert horiz height width Full :: Order -> Extent vert horiz height width -> Full vert horiz height width fullOrder :: Full vert horiz height width -> Order fullExtent :: Full vert horiz height width -> Extent vert horiz height width fullHeight :: (C vert, C horiz) => Full vert horiz height width -> height fullWidth :: (C vert, C horiz) => Full vert horiz height width -> width data Order RowMajor :: Order ColumnMajor :: Order flipOrder :: Order -> Order general :: Order -> height -> width -> General height width square :: Order -> sh -> Square sh wide :: (C height, C width) => Order -> height -> width -> Wide height width tall :: (C height, C width) => Order -> height -> width -> Tall height width data Split lower vert horiz height width type SplitGeneral lower height width = Split lower Big Big height width data Triangle Triangle :: Triangle data Reflector Reflector :: Reflector splitGeneral :: lower -> Order -> height -> width -> SplitGeneral lower height width splitFromFull :: lower -> Full vert horiz height width -> Split lower vert horiz height width -- | Store the upper triangular half of a real symmetric or complex -- Hermitian matrix. data Hermitian size Hermitian :: Order -> size -> Hermitian size hermitianOrder :: Hermitian size -> Order hermitianSize :: Hermitian size -> size hermitian :: Order -> size -> Hermitian size data Triangular lo diag up size Triangular :: diag -> (lo, up) -> Order -> size -> Triangular lo diag up size triangularDiag :: Triangular lo diag up size -> diag triangularUplo :: Triangular lo diag up size -> (lo, up) triangularOrder :: Triangular lo diag up size -> Order triangularSize :: Triangular lo diag up size -> size type Identity = Triangular Empty Unit Empty type Diagonal = Triangular Empty NonUnit Empty type LowerTriangular diag = Triangular Filled diag Empty type UpperTriangular diag = Triangular Empty diag Filled type Symmetric = FlexSymmetric NonUnit diagonal :: Order -> size -> Triangular Empty NonUnit Empty size lowerTriangular :: Order -> size -> LowerTriangular NonUnit size upperTriangular :: Order -> size -> UpperTriangular NonUnit size symmetric :: Order -> size -> Symmetric size autoDiag :: TriDiag diag => diag autoUplo :: (Content lo, Content up) => (lo, up) type DiagUpLo lo up = (DiagUpLoC lo up, DiagUpLoC up lo) data Unit Unit :: Unit data NonUnit NonUnit :: NonUnit data Banded sub super vert horiz height width Banded :: (UnaryProxy sub, UnaryProxy super) -> Order -> Extent vert horiz height width -> Banded sub super vert horiz height width bandedOffDiagonals :: Banded sub super vert horiz height width -> (UnaryProxy sub, UnaryProxy super) bandedOrder :: Banded sub super vert horiz height width -> Order bandedExtent :: Banded sub super vert horiz height width -> Extent vert horiz height width type BandedGeneral sub super = Banded sub super Big Big type BandedSquare sub super size = Banded sub super Small Small size size type BandedLowerTriangular sub size = BandedSquare sub U0 size type BandedUpperTriangular super size = BandedSquare U0 super size type BandedDiagonal size = BandedSquare U0 U0 size data BandedIndex row column InsideBox :: row -> column -> BandedIndex row column VertOutsideBox :: Int -> column -> BandedIndex row column HorizOutsideBox :: row -> Int -> BandedIndex row column bandedGeneral :: (UnaryProxy sub, UnaryProxy super) -> Order -> height -> width -> Banded sub super Big Big height width bandedSquare :: (UnaryProxy sub, UnaryProxy super) -> Order -> size -> Banded sub super Small Small size size bandedFromFull :: (UnaryProxy sub, UnaryProxy super) -> Full vert horiz height width -> Banded sub super vert horiz height width type UnaryProxy a = Proxy (Un a) addOffDiagonals :: (Natural subA, Natural superA, Natural subB, Natural superB, (subA :+: subB) ~ subC, (superA :+: superB) ~ superC) => (UnaryProxy subA, UnaryProxy superA) -> (UnaryProxy subB, UnaryProxy superB) -> ((Nat subC, Nat superC), (UnaryProxy subC, UnaryProxy superC)) class TriDiag diag switchTriDiag :: TriDiag diag => f Unit -> f NonUnit -> f diag class Content c data BandedHermitian off size BandedHermitian :: UnaryProxy off -> Order -> size -> BandedHermitian off size bandedHermitianOffDiagonals :: BandedHermitian off size -> UnaryProxy off bandedHermitianOrder :: BandedHermitian off size -> Order bandedHermitianSize :: BandedHermitian off size -> size bandedHermitian :: UnaryProxy off -> Order -> size -> BandedHermitian off size module Numeric.LAPACK.Matrix type Full vert horiz height width = Array (Full vert horiz height width) type General height width = Array (General height width) type Tall height width = Array (Tall height width) type Wide height width = Array (Wide height width) type ZeroInt = ZeroBased Int zeroInt :: Int -> ZeroInt transpose :: (C vert, C horiz) => Full vert horiz height width a -> Full horiz vert width height a -- | conjugate transpose -- -- Problem: adjoint a # a is always square, but how to -- convince the type checker to choose the Square type? Anser: Use -- Hermitian.toSquare $ Hermitian.covariance a instead. adjoint :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Full horiz vert width height a height :: (C vert, C horiz) => Full vert horiz height width a -> height width :: (C vert, C horiz) => Full vert horiz height width a -> width -- | Square matrices will be classified as Tall. caseTallWide :: (C vert, C horiz, C height, C width) => Full vert horiz height width a -> Either (Tall height width a) (Wide height width a) fromScalar :: Storable a => a -> General () () a toScalar :: Storable a => General () () a -> a fromList :: (C height, C width, Storable a) => height -> width -> [a] -> General height width a mapExtent :: (C vertA, C horizA) => (C vertB, C horizB) => Map vertA horizA vertB horizB height width -> Full vertA horizA height width a -> Full vertB horizB height width a fromFull :: (C vert, C horiz) => Full vert horiz height width a -> General height width a generalizeTall :: (C vert, C horiz) => Full vert Small height width a -> Full vert horiz height width a generalizeWide :: (C vert, C horiz) => Full Small horiz height width a -> Full vert horiz height width a identity :: (C sh, Floating a) => sh -> General sh sh a diagonal :: (C sh, Floating a) => Vector sh a -> General sh sh a fromRowsNonEmpty :: (C width, Eq width, Storable a) => T [] (Vector width a) -> General ZeroInt width a fromRowArray :: (C height, C width, Eq width, Storable a) => width -> Array height (Vector width a) -> General height width a fromRows :: (C width, Eq width, Storable a) => width -> [Vector width a] -> General ZeroInt width a fromColumnsNonEmpty :: (C height, Eq height, Storable a) => T [] (Vector height a) -> General height ZeroInt a fromColumnArray :: (C height, Eq height, C width, Storable a) => height -> Array width (Vector height a) -> General height width a fromColumns :: (C height, Eq height, Storable a) => height -> [Vector height a] -> General height ZeroInt a singleRow :: Order -> Vector width a -> General () width a singleColumn :: Order -> Vector height a -> General height () a flattenRow :: General () width a -> Vector width a flattenColumn :: General height () a -> Vector height a toRows :: (C vert, C horiz, Indexed height, C width, Floating a) => Full vert horiz height width a -> [Vector width a] toColumns :: (C vert, C horiz, C height, Indexed width, Floating a) => Full vert horiz height width a -> [Vector height a] toRowArray :: (C vert, C horiz, Indexed height, C width, Floating a) => Full vert horiz height width a -> Array height (Vector width a) toColumnArray :: (C vert, C horiz, C height, Indexed width, Floating a) => Full vert horiz height width a -> Array width (Vector height a) takeRow :: (C vert, C horiz, Indexed height, C width, Index height ~ ix, Floating a) => Full vert horiz height width a -> ix -> Vector width a takeColumn :: (C vert, C horiz, C height, Indexed width, Index width ~ ix, Floating a) => Full vert horiz height width a -> ix -> Vector height a takeRows :: (C vert, C width, Floating a) => Int -> Full vert Big ZeroInt width a -> Full vert Big ZeroInt width a takeColumns :: (C horiz, C height, Floating a) => Int -> Full Big horiz height ZeroInt a -> Full Big horiz height ZeroInt a -- | Take a left-top aligned square or as much as possible of it. The -- advantange of this function is that it maintains the matrix size -- relation, e.g. Square remains Square, Tall remains Tall. takeEqually :: (C vert, C horiz, Floating a) => Int -> Full vert horiz ZeroInt ZeroInt a -> Full vert horiz ZeroInt ZeroInt a dropRows :: (C vert, C width, Floating a) => Int -> Full vert Big ZeroInt width a -> Full vert Big ZeroInt width a dropColumns :: (C horiz, C height, Floating a) => Int -> Full Big horiz height ZeroInt a -> Full Big horiz height ZeroInt a -- | Drop the same number of top-most rows and left-most columns. The -- advantange of this function is that it maintains the matrix size -- relation, e.g. Square remains Square, Tall remains Tall. dropEqually :: (C vert, C horiz, Floating a) => Int -> Full vert horiz ZeroInt ZeroInt a -> Full vert horiz ZeroInt ZeroInt a takeTopRows :: (C vert, C height0, C height1, C width, Floating a) => Full vert Big (height0 :+: height1) width a -> Full vert Big height0 width a takeBottomRows :: (C vert, C height0, C height1, C width, Floating a) => Full vert Big (height0 :+: height1) width a -> Full vert Big height1 width a takeLeftColumns :: (C vert, C height, C width0, C width1, Floating a) => Full Big vert height (width0 :+: width1) a -> Full Big vert height width0 a takeRightColumns :: (C vert, C height, C width0, C width1, Floating a) => Full Big vert height (width0 :+: width1) a -> Full Big vert height width1 a reverseRows :: (C vert, C horiz, C width, Floating a) => Full vert horiz ZeroInt width a -> Full vert horiz ZeroInt width a reverseColumns :: (C vert, C horiz, C height, Floating a) => Full vert horiz height ZeroInt a -> Full vert horiz height ZeroInt a fromRowMajor :: (C height, C width, Floating a) => Array (height, width) a -> General height width a toRowMajor :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Array (height, width) a flatten :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Vector ZeroInt a forceOrder :: (C vert, C horiz, C height, C width, Floating a) => Order -> Full vert horiz height width a -> Full vert horiz height width a -- | adaptOrder x y contains the data of y with the -- layout of x. adaptOrder :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Full vert horiz height width a -> Full vert horiz height width a (|||) :: (C vert, C height, Eq height, C widtha, C widthb, Floating a) => Full vert Big height widtha a -> Full vert Big height widthb a -> Full vert Big height (widtha :+: widthb) a (===) :: (C horiz, C width, Eq width, C heighta, C heightb, Floating a) => Full Big horiz heighta width a -> Full Big horiz heightb width a -> Full Big horiz (heighta :+: heightb) width a -- |
-- tensorProduct order x y = singleColumn order x <#> singleRow order y --tensorProduct :: (C height, Eq height, C width, Eq width, Floating a) => Order -> Vector height a -> Vector width a -> General height width a -- |
-- outer order x y = tensorProduct order x (Vector.conjugate y) --outer :: (C height, Eq height, C width, Eq width, Floating a) => Order -> Vector height a -> Vector width a -> General height width a sumRank1 :: (C height, Eq height, C width, Eq width, Floating a) => (height, width) -> [(a, (Vector height a, Vector width a))] -> General height width a add :: (C vert, C horiz, C height, C width, Eq height, Eq width, Floating a) => Full vert horiz height width a -> Full vert horiz height width a -> Full vert horiz height width a sub :: (C vert, C horiz, C height, C width, Eq height, Eq width, Floating a) => Full vert horiz height width a -> Full vert horiz height width a -> Full vert horiz height width a rowSums :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Vector height a columnSums :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Vector width a scaleRows :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height a -> Full vert horiz height width a -> Full vert horiz height width a scaleColumns :: (C vert, C horiz, C height, C width, Eq width, Floating a) => Vector width a -> Full vert horiz height width a -> Full vert horiz height width a scaleRowsComplex :: (C vert, C horiz, C height, Eq height, C width, Real a) => Vector height a -> Full vert horiz height width (Complex a) -> Full vert horiz height width (Complex a) scaleColumnsComplex :: (C vert, C horiz, C height, C width, Eq width, Real a) => Vector width a -> Full vert horiz height width (Complex a) -> Full vert horiz height width (Complex a) scaleRowsReal :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height (RealOf a) -> Full vert horiz height width a -> Full vert horiz height width a scaleColumnsReal :: (C vert, C horiz, C height, C width, Eq width, Floating a) => Vector width (RealOf a) -> Full vert horiz height width a -> Full vert horiz height width a -- | Multiply two matrices with the same dimension constraints. E.g. you -- can multiply General and General matrices, or -- Square and Square matrices. It may seem to be overly -- strict in this respect, but that design supports type inference the -- best. You can lift the restrictions by generalizing operands with -- toFull, fromFull, generalizeTall or -- generalizeWide. multiply :: (C vert, C horiz, C height, C fuse, Eq fuse, C width, Floating a) => Full vert horiz height fuse a -> Full vert horiz fuse width a -> Full vert horiz height width a multiplyVector :: (C vert, C horiz, C height, C width, Eq width, Floating a) => Full vert horiz height width a -> Vector width a -> Vector height a -- | This class allows to multiply two matrices of arbitrary special -- features and returns the most special matrix type possible. At the -- first glance, this is handy. At the second glance, this has some -- problems. First of all, we may refine the types in future and then -- multiplication may return a different, more special type than before. -- Second, if you write code with polymorphic matrix types, then -- <#> may leave you with constraints like -- ExtentPriv.Multiply vert vert ~ vert. That constraint is -- always fulfilled but the compiler cannot infer that. Because of these -- problems you may instead consider using specialised multiply -- functions from the various modules for production use. Btw. -- MultiplyLeft and MultiplyRight are much less -- problematic, because the input and output are always dense vectors. class (C shapeA, C shapeB) => Multiply shapeA shapeB (<#>) :: (Multiply shapeA shapeB, Floating a) => Array shapeA a -> Array shapeB a -> Array (Multiplied shapeA shapeB) a class C shape => MultiplyLeft shape (<#) :: (MultiplyLeft shape, Floating a) => Vector (HeightOf shape) a -> Array shape a -> Vector (WidthOf shape) a class C shape => MultiplyRight shape (#>) :: (MultiplyRight shape, Floating a) => Array shape a -> Vector (WidthOf shape) a -> Vector (HeightOf shape) a class C shape => Solve shape solve :: (Solve shape, Floating a, HeightOf shape ~ height, Eq height, C horiz, C vert, C nrhs) => Array shape a -> Full vert horiz height nrhs a -> Full vert horiz height nrhs a solveVector :: (Solve shape, HeightOf shape ~ height, Eq height, Floating a) => Array shape a -> Vector height a -> Vector height a class Solve shape => Inverse shape inverse :: (Inverse shape, Floating a) => Array shape a -> Array shape a module Numeric.LAPACK.Orthogonal -- | If x = leastSquares a b then x minimizes -- Vector.norm2 (multiply a x sub b). -- -- Precondition: a must have full rank and height a >= -- width a. leastSquares :: (C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => Full horiz Small height width a -> Full vert horiz height nrhs a -> Full vert horiz width nrhs a -- | The vector x with x = minimumNorm a b is the vector -- with minimal Vector.norm2 x that satisfies multiply a x -- == b. -- -- Precondition: a must have full rank and height a <= -- width a. minimumNorm :: (C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => Full Small vert height width a -> Full vert horiz height nrhs a -> Full vert horiz width nrhs a -- | If x = leastSquaresMinimumNormRCond rcond a b then x -- is the vector with minimum Vector.norm2 x that minimizes -- Vector.norm2 (multiply a x sub b). -- -- Matrix a can have any rank but you must specify the -- reciprocal condition of the rank-truncated matrix. leastSquaresMinimumNormRCond :: (C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => RealOf a -> Full horiz vert height width a -> Full vert horiz height nrhs a -> (Int, Full vert horiz width nrhs a) pseudoInverseRCond :: (C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => RealOf a -> Full vert horiz height width a -> (Int, Full horiz vert width height a) determinant :: (C sh, Floating a) => Square sh a -> a -- | Gramian determinant - works also for non-square matrices, but is -- sensitive to transposition. -- --
-- determinantAbsolute a = sqrt (Herm.determinant (Herm.covariance a)) --determinantAbsolute :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> RealOf a -- | For an m-by-n-matrix a with m>=n this function computes an -- m-by-(m-n)-matrix b such that Matrix.multiply (adjoint b) -- a is a zero matrix. The function does not try to compensate a -- rank deficiency of a. That is, a|||b has full rank -- if and only if a has full rank. -- -- For full-rank matrices you might also call this kernel or -- nullspace. complement :: (C height, C width, Floating a) => Tall height width a -> Tall height ZeroInt a householder :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> (Square height a, Full vert horiz height width a) module Numeric.LAPACK.Singular values :: (C height, C width, Floating a) => General height width a -> Vector ZeroInt (RealOf a) valuesTall :: (C vert, C height, C width, Floating a) => Full vert Small height width a -> Vector width (RealOf a) valuesWide :: (C horiz, C height, C width, Floating a) => Full Small horiz height width a -> Vector height (RealOf a) decompose :: (C height, C width, Floating a) => General height width a -> (Square height a, Vector ZeroInt (RealOf a), Square width a) decomposeTall :: (C horiz, C height, C width, Floating a) => Full horiz Small height width a -> (Full horiz Small height width a, Vector width (RealOf a), Square width a) decomposeWide :: (C vert, C height, C width, Floating a) => Full Small vert height width a -> (Square height a, Vector height (RealOf a), Full Small vert height width a) determinantAbsolute :: (C height, C width, Floating a) => General height width a -> RealOf a leastSquaresMinimumNormRCond :: (C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => RealOf a -> Full horiz vert height width a -> Full vert horiz height nrhs a -> (Int, Full vert horiz width nrhs a) pseudoInverseRCond :: (C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => RealOf a -> Full vert horiz height width a -> (Int, Full horiz vert width height a)