-- 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: -- -- -- -- See also: hmatrix. @package lapack @version 0.4 module Numeric.LAPACK.Output class Output out text :: Output out => String -> out above :: Output out => out -> out -> out beside :: Output out => out -> out -> out formatRow :: Output out => [out] -> out formatColumn :: Output out => [out] -> out formatAligned :: (Output out, Foldable f) => [[f out]] -> out formatSeparateTriangle :: (Output out, Foldable f) => [[f out]] -> out (/+/) :: Output out => out -> out -> out (<+>) :: Output out => out -> out -> out hyper :: Html -> Graphic instance GHC.Show.Show Numeric.LAPACK.Output.Separator instance GHC.Classes.Ord Numeric.LAPACK.Output.Separator instance GHC.Classes.Eq Numeric.LAPACK.Output.Separator instance Numeric.LAPACK.Output.Output Text.PrettyPrint.Boxes.Box instance Numeric.LAPACK.Output.Output Numeric.LAPACK.Output.Html module Numeric.LAPACK.Scalar type family RealOf x type ComplexOf x = Complex (RealOf x) zero :: Floating a => a one :: Floating a => a minusOne :: Floating a => a isZero :: Floating a => a -> Bool selectReal :: Real a => Float -> Double -> a selectFloating :: Floating a => Float -> Double -> Complex Float -> Complex Double -> a data ComplexSingleton a [Real] :: (Real a, RealOf a ~ a) => ComplexSingleton a [Complex] :: Real a => ComplexSingleton (Complex a) complexSingleton :: Floating a => ComplexSingleton a complexSingletonOf :: Floating a => a -> ComplexSingleton a complexSingletonOfFunctor :: Floating a => f a -> ComplexSingleton a data PrecisionSingleton a [Float] :: PrecisionSingleton Float [Double] :: PrecisionSingleton Double precisionSingleton :: Real a => PrecisionSingleton a precisionOf :: Real a => a -> PrecisionSingleton a precisionOfFunctor :: Real a => f a -> PrecisionSingleton a equal :: Floating a => a -> a -> Bool fromReal :: Floating a => RealOf a -> a toComplex :: Floating a => a -> ComplexOf a absolute :: Floating a => a -> RealOf a absoluteSquared :: Floating a => a -> RealOf a norm1 :: Floating a => a -> RealOf a realPart :: Floating a => a -> RealOf a conjugate :: Floating a => a -> a module Numeric.LAPACK.Shape -- | Class of shapes where indices still make sense if we permute elements. -- We use this for all matrix factorisations involving permutations or -- more generally orthogonal transformations, e.g. eigenvalue and -- singular value, LU and QR decompositions. E.g. say, we have a square -- matrix with dimension 'Shape.Enumeration Ordering'. Its vector of -- eigenvalues has the same dimension, but it does not make sense to -- access the eigenvalues with indices like LT or EQ. Thus -- Enumeration is no instance of Permutable (and you should -- not add an orphan instance). -- -- If you want to factor a matrix with a non-permutable shape, you should -- convert it temporarily to a permutable one, like ZeroBased -- (i.e. ShapeInt) or IntIndexed. -- -- The Permutable class has no method, so you could add any shape -- to it. However, you should use good taste when adding an instance. -- There is no strict criterion which shape type to add. -- -- We tried to use ShapeInt for eigenvalue vectors and -- LiberalSquares as transformation matrices of eigenvalue -- decompositions. However, this way, the type checker cannot infer that -- the product of the factorisation is a strict square. -- -- We also tried to use IntIndexed for eigenvalue vectors with -- according LiberalSquares transformations. This has also the -- problem of inferring squares. Additionally, more such transformations -- lead to nested IntIndexed wrappers and for ShapeInt even -- the first wrapper is unnecessary. class (C shape) => Permutable shape -- | This shape type wraps any other array shape type. However, its -- Indexed instance just uses zero-based Int indices. Thus -- it can turn any shape type into a Indexed one. The main usage -- is to make an arbitrary shape Permutable. newtype IntIndexed sh IntIndexed :: sh -> IntIndexed sh [deconsIntIndexed] :: IntIndexed sh -> sh shapeInt :: C sh => sh -> ZeroBased Int instance GHC.Show.Show sh => GHC.Show.Show (Numeric.LAPACK.Shape.IntIndexed sh) instance GHC.Classes.Eq sh => GHC.Classes.Eq (Numeric.LAPACK.Shape.IntIndexed sh) instance Control.DeepSeq.NFData sh => Control.DeepSeq.NFData (Numeric.LAPACK.Shape.IntIndexed sh) instance Data.Array.Comfort.Shape.C sh => Data.Array.Comfort.Shape.C (Numeric.LAPACK.Shape.IntIndexed sh) instance Data.Array.Comfort.Shape.C sh => Data.Array.Comfort.Shape.Indexed (Numeric.LAPACK.Shape.IntIndexed sh) instance Data.Array.Comfort.Shape.C sh => Data.Array.Comfort.Shape.InvIndexed (Numeric.LAPACK.Shape.IntIndexed sh) instance Data.Array.Comfort.Shape.C sh => Numeric.LAPACK.Shape.Permutable (Numeric.LAPACK.Shape.IntIndexed sh) instance Numeric.LAPACK.Shape.Permutable Data.Array.Comfort.Shape.Zero instance Numeric.LAPACK.Shape.Permutable () instance GHC.Ix.Ix n => Numeric.LAPACK.Shape.Permutable (Data.Array.Comfort.Shape.Range n) instance GHC.Real.Integral n => Numeric.LAPACK.Shape.Permutable (Data.Array.Comfort.Shape.Shifted n) instance GHC.Real.Integral n => Numeric.LAPACK.Shape.Permutable (Data.Array.Comfort.Shape.ZeroBased n) instance GHC.Real.Integral n => Numeric.LAPACK.Shape.Permutable (Data.Array.Comfort.Shape.OneBased n) instance GHC.Real.Integral n => Numeric.LAPACK.Shape.Permutable (Data.Array.Comfort.Shape.Cyclic n) instance Numeric.LAPACK.Shape.Permutable sh => Numeric.LAPACK.Shape.Permutable (Data.Array.Comfort.Shape.Deferred sh) instance Numeric.LAPACK.Shape.Permutable sh => Numeric.LAPACK.Shape.Permutable (Data.Tagged.Tagged s sh) module Numeric.LAPACK.Matrix.Layout type General height width = Full Size Big Big height width type Tall height width = Full Size Big Small height width type Wide height width = Full Size Small Big height width type Square size = SquareMeas Shape size size data Full meas vert horiz height width Full :: Order -> Extent meas vert horiz height width -> Full meas vert horiz height width [fullOrder] :: Full meas vert horiz height width -> Order [fullExtent] :: Full meas vert horiz height width -> Extent meas vert horiz height width fullHeight :: (Measure meas, C vert, C horiz) => Full meas vert horiz height width -> height fullWidth :: (Measure meas, C vert, C horiz) => Full meas 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 liberalSquare :: (C height, C width) => Order -> height -> width -> LiberalSquare height width 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 meas vert horiz height width type SplitGeneral lower height width = Split lower Size Big Big height width data Triangle Triangle :: Triangle data Reflector Reflector :: Reflector splitGeneral :: lower -> Order -> height -> width -> SplitGeneral lower height width splitFromFull :: lower -> Full meas vert horiz height width -> Split lower meas vert horiz height width data Mosaic pack mirror uplo size Mosaic :: PackingSingleton pack -> MirrorSingleton mirror -> UpLoSingleton uplo -> Order -> size -> Mosaic pack mirror uplo size [mosaicPack] :: Mosaic pack mirror uplo size -> PackingSingleton pack [mosaicMirror] :: Mosaic pack mirror uplo size -> MirrorSingleton mirror [mosaicUplo] :: Mosaic pack mirror uplo size -> UpLoSingleton uplo [mosaicOrder] :: Mosaic pack mirror uplo size -> Order [mosaicSize] :: Mosaic pack mirror uplo size -> size class Packing pack autoPacking :: Packing pack => PackingSingleton pack data PackingSingleton pack [Packed] :: PackingSingleton Packed [Unpacked] :: PackingSingleton Unpacked data Packed data Unpacked class Mirror mirror autoMirror :: Mirror mirror => MirrorSingleton mirror data MirrorSingleton mirror [NoMirror] :: MirrorSingleton NoMirror [SimpleMirror] :: MirrorSingleton SimpleMirror [ConjugateMirror] :: MirrorSingleton ConjugateMirror autoUplo :: UpLo uplo => UpLoSingleton uplo type Triangular = TriangularP Packed type LowerTriangular = Triangular Lower type LowerTriangularP pack = TriangularP pack Lower lowerTriangular :: Order -> size -> LowerTriangular size lowerTriangularP :: PackingSingleton pack -> Order -> size -> LowerTriangularP pack size type UpperTriangular = Triangular Upper type UpperTriangularP pack = TriangularP pack Upper upperTriangular :: Order -> size -> UpperTriangular size upperTriangularP :: PackingSingleton pack -> Order -> size -> UpperTriangularP pack size type Symmetric = SymmetricP Packed type SymmetricP pack = Mosaic pack SimpleMirror Upper symmetric :: Order -> size -> Symmetric size symmetricP :: PackingSingleton pack -> Order -> size -> SymmetricP pack size type Hermitian = HermitianP Packed type HermitianP pack = Mosaic pack ConjugateMirror Upper hermitian :: Order -> size -> Hermitian size hermitianP :: PackingSingleton pack -> Order -> size -> HermitianP pack size type Diagonal size = BandedSquare U0 U0 size diagonal :: Order -> size -> Diagonal size data Banded sub super meas vert horiz height width Banded :: (UnaryProxy sub, UnaryProxy super) -> Order -> Extent meas vert horiz height width -> Banded sub super meas vert horiz height width [bandedOffDiagonals] :: Banded sub super meas vert horiz height width -> (UnaryProxy sub, UnaryProxy super) [bandedOrder] :: Banded sub super meas vert horiz height width -> Order [bandedExtent] :: Banded sub super meas vert horiz height width -> Extent meas vert horiz height width type BandedGeneral sub super = Banded sub super Size Big Big type BandedSquare sub super size = BandedSquareMeas sub super Shape size size type BandedLowerTriangular sub size = BandedSquare sub U0 size type BandedUpperTriangular super size = BandedSquare U0 super 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 -> BandedGeneral sub super height width bandedSquare :: (UnaryProxy sub, UnaryProxy super) -> Order -> size -> BandedSquare sub super size bandedFromFull :: (UnaryProxy sub, UnaryProxy super) -> Full meas vert horiz height width -> Banded sub super meas 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)) 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.Shape.Omni data Omni pack property lower upper meas vert horiz height width [Full] :: (Property property, Strip lower, Strip upper) => Full meas vert horiz height width -> Omni Unpacked property lower upper meas vert horiz height width [UpperTriangular] :: TriDiag diag => UpperTriangular size -> Omni Packed diag Empty Filled Shape Small Small size size [LowerTriangular] :: TriDiag diag => LowerTriangular size -> Omni Packed diag Filled Empty Shape Small Small size size [Symmetric] :: Symmetric size -> Omni Packed Symmetric Filled Filled Shape Small Small size size [Hermitian] :: (C neg, C zero, C pos) => Hermitian size -> Omni Packed (Hermitian neg zero pos) Filled Filled Shape Small Small size size [Banded] :: (Natural sub, Natural super) => Banded sub super meas vert horiz height width -> Omni Packed Arbitrary (Bands sub) (Bands super) meas vert horiz height width [UnitBandedTriangular] :: (BandedTriangular sub super, BandedTriangular super sub) => BandedSquare sub super size -> Omni Packed Unit (Bands sub) (Bands super) Shape Small Small size size [BandedHermitian] :: (C neg, C zero, C pos, Natural offDiag) => BandedHermitian offDiag size -> Omni Packed (Hermitian neg zero pos) (Bands offDiag) (Bands offDiag) Shape Small Small size size data Unit data Arbitrary data Symmetric data Hermitian neg zero pos type HermitianUnknownDefiniteness = Hermitian True True True type HermitianPositiveDefinite = Hermitian False False True type HermitianPositiveSemidefinite = Hermitian False True True type HermitianNegativeDefinite = Hermitian True False False type HermitianNegativeSemidefinite = Hermitian True True False hermitianSet :: (C neg, C zero, C pos) => Omni pack (Hermitian neg zero pos) lower upper meas vert horiz height width -> (Singleton neg, Singleton zero, Singleton pos) class (Property diag) => TriDiag diag switchTriDiag :: TriDiag diag => f Unit -> f Arbitrary -> f diag data DiagSingleton diag [Unit] :: DiagSingleton Unit [Arbitrary] :: DiagSingleton Arbitrary autoDiag :: TriDiag diag => DiagSingleton diag charFromTriDiag :: TriDiag diag => DiagSingleton diag -> Char packTag :: Packing pack => Omni pack propery lower upper meas vert horiz height width -> PackingSingleton pack class Property property property :: Property property => Omni pack property lower upper meas vert horiz height width -> PropertySingleton property data PropertySingleton property [PropArbitrary] :: PropertySingleton Arbitrary [PropUnit] :: PropertySingleton Unit [PropSymmetric] :: PropertySingleton Symmetric [PropHermitian] :: (C neg, C zero, C pos) => PropertySingleton (Hermitian neg zero pos) propertySingleton :: Property property => PropertySingleton property class (MultipliedBands c Filled ~ Filled, MultipliedBands c Empty ~ c) => Strip c switchStrip :: Strip c => (forall offDiag. Natural offDiag => f (Bands offDiag)) -> f Filled -> f c strips :: (Strip lower, Strip upper) => Omni pack property lower upper meas vert horiz height width -> (StripSingleton lower, StripSingleton upper) data StripSingleton c [StripBands] :: Natural offDiag => HeadSingleton offDiag -> StripSingleton (Bands offDiag) [StripFilled] :: StripSingleton Filled stripSingleton :: Strip c => StripSingleton c -- | PowerStrip is either Empty or Filled. These are -- the Strips that are preserved in matrix powers. -- -- Pun intended. class (Strip c) => PowerStrip c switchPowerStrip :: PowerStrip c => f Empty -> f Filled -> f c data PowerStripSingleton c [Empty] :: PowerStripSingleton Empty [Filled] :: PowerStripSingleton Filled powerStripSingleton :: PowerStrip c => PowerStripSingleton c powerStrips :: (PowerStrip lower, PowerStrip upper) => Omni pack property lower upper meas vert horiz height width -> (PowerStripSingleton lower, PowerStripSingleton upper) class (Natural sub, Natural super) => BandedTriangular sub super data BandedTriangularSingleton sub super [BandedDiagonal] :: BandedTriangularSingleton Zero Zero [BandedUpper] :: Natural offDiag => BandedTriangularSingleton Zero (Succ offDiag) [BandedLower] :: Natural offDiag => BandedTriangularSingleton (Succ offDiag) Zero bandedTriangularSingleton :: BandedTriangular sub super => Banded sub super meas vert horiz height width -> BandedTriangularSingleton sub super extent :: (Measure meas, C vert, C horiz) => Omni pack property lower upper meas vert horiz height width -> Extent meas vert horiz height width height :: (Measure meas, C vert, C horiz) => Omni pack property lower upper meas vert horiz height width -> height width :: (Measure meas, C vert, C horiz) => Omni pack property lower upper meas vert horiz height width -> width squareSize :: Omni pack property lower upper Shape Small Small sh sh -> sh mapHeight :: (C heightA, C heightB, C vert, C horiz) => (heightA -> heightB) -> Omni pack property lower upper Size vert horiz heightA width -> Omni pack property lower upper Size vert horiz heightB width mapWidth :: (C widthA, C widthB, C vert, C horiz) => (widthA -> widthB) -> Omni pack property lower upper Size vert horiz height widthA -> Omni pack property lower upper Size vert horiz height widthB mapSquareSize :: (C shA, C shB) => (shA -> shB) -> Omni pack property lower upper Shape Small Small shA shA -> Omni pack property lower upper Shape Small Small shB shB order :: Omni pack property lower upper meas vert horiz height width -> Order transpose :: (Measure meas, C vert, C horiz) => Omni pack property lower upper meas vert horiz height width -> Omni pack property upper lower meas horiz vert width height type family Plain pack property lower upper meas vert horiz height width class FromPlain pack property lower upper meas vert horiz height width => ToPlain pack property lower upper meas vert horiz height width toPlain :: ToPlain pack property lower upper meas vert horiz height width => Omni pack property lower upper meas vert horiz height width -> Plain pack property lower upper meas vert horiz height width class FromPlain pack property lower upper meas vert horiz height width fromPlain :: FromPlain pack property lower upper meas vert horiz height width => Plain pack property lower upper meas vert horiz height width -> Omni pack property lower upper meas vert horiz height width toFull :: (Property property, Strip lower, Strip upper) => Omni Unpacked property lower upper meas vert horiz height width -> Full meas vert horiz height width fromFull :: (Property property, Strip lower, Strip upper) => Full meas vert horiz height width -> Omni Unpacked property lower upper meas vert horiz height width toBanded :: (Natural sub, Natural super) => Omni Packed Arbitrary (Bands sub) (Bands super) meas vert horiz height width -> Banded sub super meas vert horiz height width toBandedHermitian :: (C neg, C zero, C pos, Natural offDiag) => Omni Packed (Hermitian neg zero pos) (Bands offDiag) (Bands offDiag) Shape Small Small size size -> BandedHermitian offDiag size type family MultipliedBands bandsA bandsB type family MultipliedStrip contA contB type family MultipliedProperty propA propB type family UnitIfTriangular lower upper type family MergeUnit unit0 unit1 class Quadratic pack property lower upper quadratic :: (Quadratic pack property lower upper, C sh) => Order -> sh -> Omni pack property lower upper Shape Small Small sh sh uncheckedDiagonal :: (Packing pack, TriDiag diag) => Order -> size -> Omni pack diag Empty Empty Shape Small Small size size data Power pack property lower upper meas vert horiz height width [PowerIdentity] :: Packing pack => PowerQuadratic pack Unit Empty Empty sh [PowerDiagonal] :: Packing pack => Power pack property Empty Empty meas vert horiz height width [PowerUpperTriangular] :: (Packing pack, TriDiag diag) => PowerQuadratic pack diag Empty Filled sh [PowerLowerTriangular] :: (Packing pack, TriDiag diag) => PowerQuadratic pack diag Filled Empty sh [PowerSymmetric] :: Packing pack => PowerQuadratic pack Symmetric Filled Filled sh [PowerHermitian] :: (Packing pack, C neg, C zero, C pos) => PowerQuadratic pack (Hermitian neg zero pos) Filled Filled sh [PowerFull] :: Power Unpacked property lower upper meas vert horiz height width powerSingleton :: (Packing pack, Property property, PowerStrip lower, PowerStrip upper, Measure meas, C vert, C horiz) => Omni pack property lower upper meas vert horiz height width -> Power pack property lower upper meas vert horiz height width instance (Numeric.LAPACK.Matrix.Extent.Private.Measure meas, Numeric.LAPACK.Matrix.Extent.Private.C vert, Numeric.LAPACK.Matrix.Extent.Private.C horiz, GHC.Classes.Eq height, GHC.Classes.Eq width) => GHC.Classes.Eq (Numeric.LAPACK.Matrix.Shape.Omni.Omni pack property lower upper meas vert horiz height width) instance (Numeric.LAPACK.Matrix.Extent.Private.Measure meas, Numeric.LAPACK.Matrix.Extent.Private.C vert, Numeric.LAPACK.Matrix.Extent.Private.C horiz, GHC.Show.Show height, GHC.Show.Show width) => GHC.Show.Show (Numeric.LAPACK.Matrix.Shape.Omni.Omni pack property lower upper meas vert horiz height width) instance (offDiag GHC.Types.~ Type.Data.Num.Unary.Literal.U0) => Numeric.LAPACK.Matrix.Shape.Omni.PowerStrip (Numeric.LAPACK.Matrix.Layout.Private.Bands offDiag) instance Numeric.LAPACK.Matrix.Shape.Omni.PowerStrip Numeric.LAPACK.Matrix.Layout.Private.Filled instance (Numeric.LAPACK.Matrix.Shape.Omni.Strip lower, Numeric.LAPACK.Matrix.Shape.Omni.Strip upper, Numeric.LAPACK.Matrix.Extent.Strict.Measured meas vert, Numeric.LAPACK.Matrix.Extent.Strict.Measured meas horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Unpacked Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary lower upper meas vert horiz instance (Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz instance (Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty meas vert horiz instance (Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz instance (Numeric.LAPACK.Matrix.Extent.Strict.Measured meas vert, Numeric.LAPACK.Matrix.Extent.Strict.Measured meas horiz, Type.Data.Num.Unary.Natural sub, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, Type.Data.Num.Unary.Natural sub, sub GHC.Types.~ super, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz instance (Numeric.LAPACK.Matrix.Shape.Omni.Strip lower, Numeric.LAPACK.Matrix.Shape.Omni.Strip upper) => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Unpacked Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary lower upper instance Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled instance Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty instance Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled instance (Type.Data.Num.Unary.Natural sub, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub) => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, sub GHC.Types.~ super, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) instance Numeric.LAPACK.Matrix.Shape.Omni.ToPlain Numeric.LAPACK.Matrix.Layout.Private.Unpacked Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz height width instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Type.Data.Num.Unary.Natural sub, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz height width instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Type.Data.Num.Unary.Natural sub, sub GHC.Types.~ super, height GHC.Types.~ width, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance Numeric.LAPACK.Matrix.Shape.Omni.FromPlain Numeric.LAPACK.Matrix.Layout.Private.Unpacked Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz height width instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Type.Data.Num.Unary.Natural sub, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz height width instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Type.Data.Num.Unary.Natural sub, sub GHC.Types.~ super, height GHC.Types.~ width, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width instance (Numeric.LAPACK.Matrix.Extent.Private.Measure meas, Numeric.LAPACK.Matrix.Extent.Private.C vert, Numeric.LAPACK.Matrix.Extent.Private.C horiz, Control.DeepSeq.NFData height, Control.DeepSeq.NFData width) => Control.DeepSeq.NFData (Numeric.LAPACK.Matrix.Shape.Omni.Omni pack property lower upper meas vert horiz height width) instance (Numeric.LAPACK.Matrix.Extent.Private.Measure meas, Numeric.LAPACK.Matrix.Extent.Private.C vert, Numeric.LAPACK.Matrix.Extent.Private.C horiz, Data.Array.Comfort.Shape.C height, Data.Array.Comfort.Shape.C width) => Data.Array.Comfort.Shape.C (Numeric.LAPACK.Matrix.Shape.Omni.Omni pack property lower upper meas vert horiz height width) instance Type.Data.Num.Unary.Natural offDiag => Numeric.LAPACK.Matrix.Shape.Omni.Strip (Numeric.LAPACK.Matrix.Layout.Private.Bands offDiag) instance Numeric.LAPACK.Matrix.Shape.Omni.Strip Numeric.LAPACK.Matrix.Layout.Private.Filled instance Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular Type.Data.Num.Unary.Zero Type.Data.Num.Unary.Zero instance Type.Data.Num.Unary.Natural super => Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular Type.Data.Num.Unary.Zero (Type.Data.Num.Unary.Succ super) instance Type.Data.Num.Unary.Natural sub => Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular (Type.Data.Num.Unary.Succ sub) Type.Data.Num.Unary.Zero instance Numeric.LAPACK.Matrix.Shape.Omni.TriDiag Numeric.LAPACK.Matrix.Shape.Omni.Unit instance Numeric.LAPACK.Matrix.Shape.Omni.TriDiag Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance Numeric.LAPACK.Matrix.Shape.Omni.Property Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance Numeric.LAPACK.Matrix.Shape.Omni.Property Numeric.LAPACK.Matrix.Shape.Omni.Unit instance Numeric.LAPACK.Matrix.Shape.Omni.Property Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Shape.Omni.Property (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) instance Numeric.LAPACK.Matrix.Shape.Omni.Definiteness Type.Data.Bool.True Type.Data.Bool.True Type.Data.Bool.True instance Numeric.LAPACK.Matrix.Shape.Omni.Definiteness Type.Data.Bool.True Type.Data.Bool.True Type.Data.Bool.False instance Numeric.LAPACK.Matrix.Shape.Omni.Definiteness Type.Data.Bool.False Type.Data.Bool.True Type.Data.Bool.True instance Numeric.LAPACK.Matrix.Shape.Omni.Definiteness Type.Data.Bool.True Type.Data.Bool.False Type.Data.Bool.False instance Numeric.LAPACK.Matrix.Shape.Omni.Definiteness Type.Data.Bool.False Type.Data.Bool.True Type.Data.Bool.False instance Numeric.LAPACK.Matrix.Shape.Omni.Definiteness Type.Data.Bool.False Type.Data.Bool.False Type.Data.Bool.True instance GHC.Classes.Eq (Numeric.LAPACK.Matrix.Shape.Omni.DiagSingleton diag) instance GHC.Show.Show (Numeric.LAPACK.Matrix.Shape.Omni.DiagSingleton diag) instance Control.DeepSeq.NFData (Numeric.LAPACK.Matrix.Shape.Omni.DiagSingleton diag) module Numeric.LAPACK.Matrix.Shape type UpperQuasitriangular size = Quadratic Unpacked Arbitrary (Bands U1) Filled size -- | For singular values -- -- However, diagonal matrices produced by singular value decomposition -- may be non-square and Hermitian must be square. type PositiveDiagonal size = Quadratic Packed HermitianPositiveDefinite Empty Empty size -- | For Hermitian eigenvalues type RealDiagonal size = BandedHermitian U0 size type BandedHermitian offDiag size = Quadratic Packed HermitianUnknownDefiniteness (Bands offDiag) (Bands offDiag) size type BandedUnitUpper super size = BandedUnitTriangular U0 super size type BandedUnitLower sub size = BandedUnitTriangular sub U0 size type BandedUnitTriangular sub super size = Quadratic Packed Unit (Bands sub) (Bands super) size type BandedUpper super size = BandedTriangular U0 super size type BandedLower sub size = BandedTriangular sub U0 size type BandedTriangular sub super size = Quadratic Packed Arbitrary (Bands sub) (Bands super) size type BandedGeneral sub super = Omni Packed Arbitrary (Bands sub) (Bands super) Size Big Big type Banded sub super meas vert horiz = Omni Packed Arbitrary (Bands sub) (Bands super) meas vert horiz type Symmetric size = Quadratic Packed Symmetric Filled Filled size type UpperTriangular size = Quadratic Packed Arbitrary Empty Filled size type LowerTriangular size = Quadratic Packed Arbitrary Filled Empty size newtype GenTriangularLoUp diag size a lo up GenTriangularLoUp :: Triangular lo diag up size -> GenTriangularLoUp diag size a lo up [runGenTriangularLoUp] :: GenTriangularLoUp diag size a lo up -> Triangular lo diag up size newtype GenTriangularDiag lo up size a diag GenTriangularDiag :: Triangular lo diag up size -> GenTriangularDiag lo up size a diag [runGenTriangularDiag] :: GenTriangularDiag lo up size a diag -> Triangular lo diag up size type Triangular lo diag up size = Quadratic Packed diag lo up size data UpLoSingleton lo up [Lower] :: UpLoSingleton Filled Empty [Upper] :: UpLoSingleton Empty Filled class (PowerStrip lo, PowerStrip up) => DiagUpLoC lo up switchDiagUpLo :: DiagUpLoC lo up => f Empty Empty -> f Empty Filled -> f Filled Empty -> f lo up type DiagUpLo lo up = (DiagUpLoC lo up, DiagUpLoC up lo) class (DiagUpLoC lo up) => UpLoC lo up switchUpLo :: UpLoC lo up => f Empty Filled -> f Filled Empty -> f lo up type UpLo lo up = (UpLoC lo up, UpLoC up lo) type Identity size = Quadratic Packed Unit Empty Empty size type Diagonal size = Quadratic Packed Arbitrary Empty Empty size type Hermitian size = Quadratic Packed HermitianUnknownDefiniteness Filled Filled size type QuadraticMeas pack property lower upper meas height width = Omni pack property lower upper meas Small Small height width type Quadratic pack property lower upper size = QuadraticMeas pack property lower upper Shape size size type Square sh = Full Shape Small Small sh sh type LiberalSquare = Full Size Small Small type Wide = Full Size Small Big type Tall = Full Size Big Small type General = Full Size Big Big type Full = Omni Unpacked Arbitrary Filled Filled general :: Order -> height -> width -> General height width tall :: (C height, C width) => Order -> height -> width -> Tall height width wide :: (C height, C width) => Order -> height -> width -> Wide height width liberalSquare :: (C height, C width) => Order -> height -> width -> LiberalSquare height width square :: C sh => Order -> sh -> Square sh hermitian :: Order -> sh -> Hermitian sh diagonal :: Order -> size -> Diagonal size identity :: Order -> size -> Identity size autoUplo :: UpLo lo up => UpLoSingleton lo up triangular :: (DiagUpLo lo up, TriDiag diag) => Order -> size -> Triangular lo diag up size unitTriangular :: DiagUpLo lo up => Order -> size -> Triangular lo Unit up size arbitraryTriangular :: DiagUpLo lo up => Order -> size -> Triangular lo Arbitrary up size lowerTriangular :: Order -> size -> LowerTriangular size upperTriangular :: Order -> size -> UpperTriangular size symmetric :: Order -> size -> Symmetric size bandedOffDiagonals :: Omni Packed property (Bands sub) (Bands super) meas vert horiz height width -> (UnaryProxy sub, UnaryProxy super) bandedGeneral :: (Natural sub, Natural super, C height, C width) => (UnaryProxy sub, UnaryProxy super) -> Order -> height -> width -> BandedGeneral sub super height width bandedHermitian :: Natural offDiag => UnaryProxy offDiag -> Order -> size -> BandedHermitian offDiag size data Order RowMajor :: Order ColumnMajor :: Order flipOrder :: Order -> Order height :: (Measure meas, C vert, C horiz) => Omni pack property lower upper meas vert horiz height width -> height width :: (Measure meas, C vert, C horiz) => Omni pack property lower upper meas vert horiz height width -> width extent :: (Measure meas, C vert, C horiz) => Omni pack property lower upper meas vert horiz height width -> Extent meas vert horiz height width squareSize :: Omni pack property lower upper Shape Small Small sh sh -> sh order :: Omni pack property lower upper meas vert horiz height width -> Order class (Property diag) => TriDiag diag data DiagSingleton diag [Unit] :: DiagSingleton Unit [Arbitrary] :: DiagSingleton Arbitrary class Property property -- | PowerStrip is either Empty or Filled. These are -- the Strips that are preserved in matrix powers. -- -- Pun intended. class (Strip c) => PowerStrip c data PowerStripSingleton c [Empty] :: PowerStripSingleton Empty [Filled] :: PowerStripSingleton Filled powerStripSingleton :: PowerStrip c => PowerStripSingleton c class (MultipliedBands c Filled ~ Filled, MultipliedBands c Empty ~ c) => Strip c data StripSingleton c [StripBands] :: Natural offDiag => HeadSingleton offDiag -> StripSingleton (Bands offDiag) [StripFilled] :: StripSingleton Filled stripSingleton :: Strip c => StripSingleton c data Arbitrary data Unit data Filled type Empty = Bands U0 data Bands offDiag 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 Packing pack data Packed data Unpacked instance Numeric.LAPACK.Matrix.Shape.UpLoC Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled instance Numeric.LAPACK.Matrix.Shape.UpLoC Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty instance Numeric.LAPACK.Matrix.Shape.DiagUpLoC Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Empty instance Numeric.LAPACK.Matrix.Shape.DiagUpLoC Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled instance Numeric.LAPACK.Matrix.Shape.DiagUpLoC Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty module Numeric.LAPACK.Matrix.Extent class C tag switchTag :: C tag => f Small -> f Big -> f tag data Small data Big class Measure meas switchMeasure :: Measure meas => f Shape -> f Size -> f meas data Shape data Size -- | Admissible tag combinations are: -- --
--   meas  vert  horiz
--   Shape Small Small - Square
--   Size  Small Small - LiberalSquare
--   Size  Big   Small - Tall
--   Size  Small Big   - Wide
--   Size  Big   Big   - General
--   
-- -- We can enforce this set with the constraints -- --
--   (Extent.Measured meas vert, Extent.Measured meas horiz)
--   
-- -- However, in some cases it leads to constraints like Measured meas -- Small or Measured meas Big. The former one is morally -- equivalent to Measure meas and the latter one is morally -- equivalent to meas ~ Size. However, in order to convince the -- compiler you would have to go through switchMeasured. -- -- In order to circumvent this trouble we use internal functions with -- weaker constraints: -- --
--   (Extent.Measure meas, Extent.C vert, Extent.C horiz)
--   
-- -- This is typesafe whenever the input is based on one of the five -- admissible extent types. We only need the strict constraints when -- constructing matrices of arbitrary extent type, i.e. this almost only -- concerns fromSquare. class (Measure meas, C tag) => Measured meas tag switchMeasured :: Measured meas tag => f Shape Small -> f Size Small -> f Size Big -> f meas tag data Extent meas vert horiz height width data Map measA vertA horizA measB vertB horizB height width height :: (Measure meas, C vert, C horiz) => Extent meas vert horiz height width -> height width :: (Measure meas, C vert, C horiz) => Extent meas vert horiz height width -> width squareSize :: Square shape -> shape dimensions :: (Measure meas, C vert, C horiz) => Extent meas vert horiz height width -> (height, width) transpose :: (Measure meas, C vert, C horiz) => Extent meas vert horiz height width -> Extent meas horiz vert width height fuse :: (Measure meas, C vert, C horiz, Eq fuse) => Extent meas vert horiz height fuse -> Extent meas vert horiz fuse width -> Maybe (Extent meas vert horiz height width) type family MultiplyMeasure a b square :: sh -> Square sh toGeneral :: (Measure meas, C vert, C horiz) => Map meas vert horiz Size Big Big height width fromSquare :: (Measured meas vert, Measured meas horiz) => Map Shape Small Small meas vert horiz size size fromSquareLiberal :: (Measured meas vert, Measured meas horiz) => Map Shape Small Small meas vert horiz height width fromLiberalSquare :: (C vert, C horiz) => Map Size Small Small Size vert horiz height width generalizeTall :: (Measure meas, C vert, C horiz) => Map meas vert Small Size vert horiz height width generalizeWide :: (Measure meas, C vert, C horiz) => Map meas Small horiz Size vert horiz height width weakenTall :: (Measured meas horiz, C vert) => Map meas vert Small meas vert horiz height width weakenWide :: (Measured meas vert, C horiz) => Map meas Small horiz meas vert horiz height width data AppendMode vertA vertB vertC height widthA widthB appendSame :: C vert => AppendMode vert vert vert height widthA widthB appendLeft :: C vert => AppendMode vert Big vert height widthA widthB appendRight :: C vert => AppendMode Big vert vert height widthA widthB type family Append a b appendAny :: (C vertA, C vertB) => AppendMode vertA vertB (Append vertA vertB) height widthA widthB module Numeric.LAPACK.Vector type Vector = Array type family RealOf x type ComplexOf x = Complex (RealOf x) toList :: (C sh, Storable a) => Vector sh a -> [a] fromList :: (C sh, Storable a) => sh -> [a] -> Vector sh a autoFromList :: Storable a => [a] -> Vector (ZeroBased Int) a append :: (C shx, C shy, Storable a) => Array shx a -> Array shy a -> Array (shx ::+ shy) a infixr 5 `append` -- | Precedence and associativity (right) of (List.++). This also matches -- (::+). (+++) :: (C shx, C shy, Storable a) => Vector shx a -> Vector shy a -> Vector (shx ::+ shy) a infixr 5 +++ -- |
--   \(QC.NonNegative n) (Array16 x)  ->  x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x))
--   
take :: (Integral n, Storable a) => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a -- |
--   \(QC.NonNegative n) (Array16 x)  ->  x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x))
--   
drop :: (Integral n, Storable a) => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a -- |
--   \(Array16 x) (Array16 y) -> let xy = Array.append x y in x == Array.takeLeft xy  &&  y == Array.takeRight xy
--   
takeLeft :: (C sh0, C sh1, Storable a) => Array (sh0 ::+ sh1) a -> Array sh0 a takeRight :: (C sh0, C sh1, Storable a) => Array (sh0 ::+ sh1) a -> Array sh1 a swap :: (Indexed sh, Storable a) => Index sh -> Index sh -> Vector sh a -> Vector sh a -- |
--   \x  ->  Array.singleton x ! () == (x::Word16)
--   
singleton :: Storable a => a -> Array () a -- |
--   constant () = singleton
--   
-- -- However, singleton does not need Floating constraint. constant :: (C sh, Floating a) => sh -> a -> Vector sh a zero :: (C sh, Floating a) => sh -> Vector sh a one :: (C sh, Floating a) => sh -> Vector sh a unit :: (Indexed sh, Floating a) => sh -> Index sh -> Vector sh a -- |
--   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 -- |
--   dot x y = Matrix.toScalar (singleRow x <#> singleColumn y)
--   
(-*|) :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> a infixl 7 -*| 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 norm2Squared :: (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 (.*|) :: (C sh, Floating a) => a -> Vector sh a -> Vector sh a infixl 7 .*| add :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a infixl 6 `add` sub :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a infixl 6 `sub` (|+|) :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a infixl 6 |+| (|-|) :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a infixl 6 |-| negate :: (C sh, Floating a) => Vector sh a -> Vector sh a raise :: (C sh, Floating a) => a -> Array sh a -> Array 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 -- |
--   \xs ys -> mulConj xs ys == mul (conjugate xs) ys
--   
mulConj :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a divide :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a recip :: (C sh, Floating a) => Vector sh a -> Vector sh a -- | For restrictions see limits. minimum :: (C sh, Real a) => Vector sh a -> a -- | For restrictions see limits. argMinimum :: (InvIndexed sh, Index sh ~ ix, Real a) => Vector sh a -> (ix, a) -- | For restrictions see limits. maximum :: (C sh, Real a) => Vector sh a -> a -- | For restrictions see limits. argMaximum :: (InvIndexed sh, Index sh ~ ix, Real a) => Vector sh a -> (ix, a) -- | It should hold limits x = Array.limits x. The function is -- based on fast BLAS functions. It should be faster than -- Array.minimum and Array.maximum although it is -- certainly not as fast as possible. It is less precise if minimum and -- maximum differ considerably in magnitude and there are several minimum -- or maximum candidates of similar value. E.g. you cannot rely on the -- property that raise (- minimum x) x has only non-negative -- elements. limits :: (C sh, Real a) => Vector sh a -> (a, a) argLimits :: (InvIndexed sh, Index sh ~ ix, Real a) => Vector sh a -> ((ix, a), (ix, a)) foldl :: (C sh, Storable a) => (b -> a -> b) -> b -> Array sh a -> b foldl1 :: (C sh, Storable a) => (a -> a -> a) -> Array sh a -> a foldMap :: (C sh, Storable a, Ord a, Semigroup m) => (a -> m) -> Array sh a -> m 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) imaginaryPart :: (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 GHC.Enum.Enum Numeric.LAPACK.Vector.RandomDistribution instance GHC.Show.Show Numeric.LAPACK.Vector.RandomDistribution instance GHC.Classes.Ord Numeric.LAPACK.Vector.RandomDistribution instance GHC.Classes.Eq Numeric.LAPACK.Vector.RandomDistribution module Numeric.LAPACK.Matrix.Array data family Matrix typ extraLower extraUpper lower upper meas vert horiz height width a type ArrayMatrix pack property = Matrix (Array pack property) () () data Array pack property type OmniArray pack prop lower upper meas vert horiz height width a = Array (Omni pack prop lower upper meas vert horiz height width) a type PlainArray pack prop lower upper meas vert horiz height width = Array (Plain pack prop lower upper meas vert horiz height width) type Full meas vert horiz height width = UnpackedMatrix Arbitrary Filled Filled meas vert horiz height width type General height width = Full Size Big Big height width type Tall height width = Full Size Big Small height width type Wide height width = Full Size Small Big height width type LiberalSquare height width = SquareMeas Size height width type Square sh = SquareMeas Shape sh sh type SquareMeas meas height width = Full meas Small Small height width type Quadratic pack property lower upper sh = QuadraticMeas pack property lower upper Shape sh sh type FullQuadratic pack property sh = Quadratic pack property Filled Filled sh type QuadraticMeas pack property lower upper meas height width = ArrayMatrix pack property lower upper meas Small Small height width plainShape :: ToPlain pack property lower upper meas vert horiz height width => ArrayMatrix pack property lower upper meas vert horiz height width a -> Plain pack property lower upper meas vert horiz height width shape :: ArrayMatrix pack property lower upper meas vert horiz height width a -> Omni pack property lower upper meas vert horiz height width extent :: (Measure meas, C vert, C horiz) => ArrayMatrix pack property lower upper meas vert horiz height width a -> Extent meas vert horiz height width subBandsSingleton :: Natural sub => ArrayMatrix pack property (Bands sub) upper meas vert horiz height width a -> HeadSingleton sub superBandsSingleton :: Natural super => ArrayMatrix pack property lower (Bands super) meas vert horiz height width a -> HeadSingleton super packTag :: Packing pack => ArrayMatrix pack diag lower upper meas vert horiz height width a -> PackingSingleton pack diagTag :: TriDiag diag => ArrayMatrix pack diag lower upper meas vert horiz height width a -> DiagSingleton diag asPacked :: Id (ArrayMatrix Packed property lower upper meas vert horiz height width a) asUnpacked :: Id (ArrayMatrix Unpacked property lower upper meas vert horiz height width a) requirePacking :: PackingSingleton pack -> Id (ArrayMatrix pack property lower upper meas vert horiz height width a) reshape :: (Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => (C heightA, C widthA) => (C heightB, C widthB) => Omni packB propB lowerB upperB measB vertB horizB heightB widthB -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB a mapShape :: (Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => (C heightA, C widthA) => (C heightB, C widthB) => (Omni packA propA lowerA upperA measA vertA horizA heightA widthA -> Omni packB propB lowerB upperB measB vertB horizB heightB widthB) -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB a unwrap :: ArrayMatrix pack property lower upper meas vert horiz height width a -> OmniArray pack property lower upper meas vert horiz height width a toVector :: ToPlain pack property lower upper meas vert horiz height width => ArrayMatrix pack property lower upper meas vert horiz height width a -> PlainArray pack property lower upper meas vert horiz height width a fromVector :: FromPlain pack prop lower upper meas vert horiz height width => Plain pack prop lower upper meas vert horiz height width ~ shape => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Array shape a -> ArrayMatrix pack prop lower upper meas vert horiz height width a -- | lift0 is a synonym for fromVector but lacks the -- admissibility check. You may thus fool the type tags. This applies to -- the other lift functions, too. lift0 :: FromPlain pack prop lower upper meas vert horiz height width => PlainArray pack prop lower upper meas vert horiz height width a -> ArrayMatrix pack prop lower upper meas vert horiz height width a lift1 :: ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA => FromPlain packB propB lowerB upperB measB vertB horizB heightB widthB => (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a -> PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b) -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b lift2 :: ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA => ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB => FromPlain packC propC lowerC upperC measC vertC horizC heightC widthC => (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a -> PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b -> PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c) -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b -> ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c lift3 :: ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA => ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB => ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC => FromPlain packD propD lowerD upperD measD vertD horizD heightD widthD => (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a -> PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b -> PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c -> PlainArray packD propD lowerD upperD measD vertD horizD heightD widthD d) -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b -> ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c -> ArrayMatrix packD propD lowerD upperD measD vertD horizD heightD widthD d lift4 :: ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA => ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB => ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC => ToPlain packD propD lowerD upperD measD vertD horizD heightD widthD => FromPlain packE propE lowerE upperE measE vertE horizE heightE widthE => (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a -> PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b -> PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c -> PlainArray packD propD lowerD upperD measD vertD horizD heightD widthD d -> PlainArray packE propE lowerE upperE measE vertE horizE heightE widthE e) -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b -> ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c -> ArrayMatrix packD propD lowerD upperD measD vertD horizD heightD widthD d -> ArrayMatrix packE propE lowerE upperE measE vertE horizE heightE widthE e unlift1 :: FromPlain packA propA lowerA upperA measA vertA horizA heightA widthA => ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB => (ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b) -> PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a -> PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b unlift2 :: (FromPlain packA propA lowerA upperA measA vertA horizA heightA widthA, FromPlain packB propB lowerB upperB measB vertB horizB heightB widthB) => ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC => (ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b -> ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c) -> PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a -> PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b -> PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c unliftRow :: Order -> (General () height0 a -> General () height1 b) -> Vector height0 a -> Vector height1 b unliftColumn :: Order -> (General height0 () a -> General height1 () b) -> Vector height0 a -> Vector height1 b unpackedToVector :: (Property property, Strip lower, Strip upper) => UnpackedMatrix property lower upper meas vert horiz height width a -> FullArray meas vert horiz height width a liftUnpacked0 :: (Property propertyA, Strip lowerA, Strip upperA) => FullArray measA vertA horizA heightA widthA a -> UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a liftUnpacked1 :: (Property propertyA, Strip lowerA, Strip upperA) => (Property propertyB, Strip lowerB, Strip upperB) => (FullArray measA vertA horizA heightA widthA a -> FullArray measB vertB horizB heightB widthB b) -> UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a -> UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b liftUnpacked2 :: (Property propertyA, Strip lowerA, Strip upperA) => (Property propertyB, Strip lowerB, Strip upperB) => (Property propertyC, Strip lowerC, Strip upperC) => (FullArray measA vertA horizA heightA widthA a -> FullArray measB vertB horizB heightB widthB b -> FullArray measC vertC horizC heightC widthC c) -> UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a -> UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b -> UnpackedMatrix propertyC lowerC upperC measC vertC horizC heightC widthC c liftUnpacked3 :: (Property propertyA, Strip lowerA, Strip upperA) => (Property propertyB, Strip lowerB, Strip upperB) => (Property propertyC, Strip lowerC, Strip upperC) => (Property propertyD, Strip lowerD, Strip upperD) => (FullArray measA vertA horizA heightA widthA a -> FullArray measB vertB horizB heightB widthB b -> FullArray measC vertC horizC heightC widthC c -> FullArray measD vertD horizD heightD widthD d) -> UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a -> UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b -> UnpackedMatrix propertyC lowerC upperC measC vertC horizC heightC widthC c -> UnpackedMatrix propertyD lowerD upperD measD vertD horizD heightD widthD d liftOmni1 :: (OmniArray packA propA lowerA upperA measA vertA horizA heightA widthA a -> OmniArray packB propB lowerB upperB measB vertB horizB heightB widthB b) -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b liftOmni2 :: (OmniArray packA propA lowerA upperA measA vertA horizA heightA widthA a -> OmniArray packB propB lowerB upperB measB vertB horizB heightB widthB b -> OmniArray packC propC lowerC upperC measC vertC horizC heightC widthC c) -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b -> ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c class (Property property) => Homogeneous property class (Homogeneous property) => Scale property zero :: Homogeneous property => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Omni pack property lower upper meas vert horiz height width -> ArrayMatrix pack property lower upper meas vert horiz height width a negate :: Homogeneous property => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a scaleReal :: Homogeneous property => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => RealOf a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a scale :: (Measure meas, C vert, C horiz) => (Scale property, C height, C width, Floating a) => a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a scaleRealReal :: Homogeneous property => (Measure meas, C vert, C horiz) => (C height, C width, Real a) => a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a (.*#) :: (Measure meas, C vert, C horiz) => (Scale property, C height, C width, Floating a) => a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 7 .*# order :: ArrayMatrix pack property lower upper meas vert horiz height width a -> Order forceOrder :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Order -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -- | adaptOrder x y contains the data of y with the -- layout of x. adaptOrder :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a class (Property property) => Additive property add :: (Measure meas, C vert, C horiz) => (Additive property, C height, Eq height, C width, Eq width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 6 `add` (#+#) :: (Measure meas, C vert, C horiz) => (Additive property, C height, Eq height, C width, Eq width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 6 #+# class (Additive property) => Subtractive property sub :: (Measure meas, C vert, C horiz) => (Subtractive property, C height, Eq height, C width, Eq width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 6 `sub` (#-#) :: (Measure meas, C vert, C horiz) => (Subtractive property, C height, Eq height, C width, Eq width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 6 #-# class MapExtent pack property lower upper mapExtent :: (MapExtent pack property lower upper, Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => Map measA vertA horizA measB vertB horizB height width -> ArrayMatrix pack property lower upper measA vertA horizA height width a -> ArrayMatrix pack property lower upper measB vertB horizB height width a instance (Numeric.LAPACK.Matrix.Extent.Private.Measure meas, Numeric.LAPACK.Matrix.Extent.Private.C vert, Numeric.LAPACK.Matrix.Extent.Private.C horiz, Data.Array.Comfort.Shape.C height, Data.Array.Comfort.Shape.C width, Foreign.Storable.Storable a, GHC.Show.Show height, GHC.Show.Show width, GHC.Show.Show a) => GHC.Show.Show (Numeric.LAPACK.Matrix.Type.Matrix (Numeric.LAPACK.Matrix.Array.Array pack prop) xl xu lower upper meas vert horiz height width a) instance (Numeric.LAPACK.Matrix.Array.MapExtent pack property lower upper, xl GHC.Types.~ (), xu GHC.Types.~ ()) => Numeric.LAPACK.Matrix.Type.MapExtent (Numeric.LAPACK.Matrix.Array.Array pack property) xl xu lower upper instance Numeric.LAPACK.Matrix.Array.MapExtent Numeric.LAPACK.Matrix.Layout.Private.Unpacked Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled instance (Type.Data.Num.Unary.Natural sub, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Array.MapExtent Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) instance Numeric.LAPACK.Matrix.Array.Subtractive Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance Numeric.LAPACK.Matrix.Array.Subtractive Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, neg GHC.Types.~ pos) => Numeric.LAPACK.Matrix.Array.Subtractive (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) instance Numeric.LAPACK.Matrix.Array.Additive Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance Numeric.LAPACK.Matrix.Array.Additive Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Array.Additive (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) instance Numeric.LAPACK.Matrix.Array.Scale Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance Numeric.LAPACK.Matrix.Array.Scale Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance Numeric.LAPACK.Matrix.Array.Homogeneous Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance Numeric.LAPACK.Matrix.Array.Homogeneous Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance (zero GHC.Types.~ Type.Data.Bool.True, neg GHC.Types.~ pos, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Array.Homogeneous (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) instance Numeric.LAPACK.Matrix.Type.NFData (Numeric.LAPACK.Matrix.Array.Array pack property) instance Numeric.LAPACK.Matrix.Type.Box (Numeric.LAPACK.Matrix.Array.Array pack property) instance Numeric.LAPACK.Matrix.Type.Transpose (Numeric.LAPACK.Matrix.Array.Array pack property) instance Numeric.LAPACK.Matrix.Type.FormatMatrix (Numeric.LAPACK.Matrix.Array.Array pack property) instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, xl GHC.Types.~ (), xu GHC.Types.~ ()) => Numeric.LAPACK.Matrix.Type.MultiplySame (Numeric.LAPACK.Matrix.Array.Array pack diag) xl xu instance Numeric.LAPACK.Matrix.Type.ToQuadratic (Numeric.LAPACK.Matrix.Array.Array pack property) module Numeric.LAPACK.Permutation data Permutation sh newtype Shape sh Shape :: sh -> Shape sh newtype Element sh Element :: CInt -> Element sh size :: Permutation sh -> sh identity :: C sh => sh -> Permutation sh data Inversion NonInverted :: Inversion Inverted :: Inversion -- |
--   QC.forAll QC.arbitraryBoundedEnum $ \inv -> QC.forAll (QC.arbitrary >>= genPivots) $ \xs -> xs == Perm.toPivots inv (Perm.fromPivots inv xs)
--   
fromPivots :: C sh => Inversion -> Vector (Shape sh) (Element sh) -> Permutation sh toPivots :: C sh => Inversion -> Permutation sh -> Vector (Shape sh) (Element sh) toMatrix :: (C sh, Floating a) => Permutation sh -> Square sh a data Sign Positive :: Sign Negative :: Sign -- |
--   QC.forAll genPerm2 $ \(p0,p1) -> determinant (multiply p0 p1) == determinant p0 <> determinant p1
--   
determinant :: C sh => Permutation sh -> Sign -- |
--   numberFromSign s == (-1)^fromEnum s
--   
numberFromSign :: Floating a => Sign -> a -- |
--   QC.forAll genPerm2 $ \(p0,p1) -> transpose (multiply p0 p1) == multiply (transpose p1) (transpose p0)
--   
transpose :: C sh => Permutation sh -> Permutation sh inversionFromTransposition :: Transposition -> Inversion multiply :: (C sh, Eq sh) => Permutation sh -> Permutation sh -> Permutation sh apply :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Inversion -> Permutation height -> Full meas vert horiz height width a -> Full meas vert horiz height width a module Numeric.LAPACK.Matrix.Permutation type Permutation sh = FlexPermutation Filled Filled sh size :: FlexPermutation lower upper sh a -> sh identity :: C sh => sh -> FlexPermutation lower upper sh a data Inversion NonInverted :: Inversion Inverted :: Inversion inversionFromTransposition :: Transposition -> Inversion fromPermutation :: C sh => Permutation sh -> Permutation sh a toPermutation :: C sh => FlexPermutation lower upper sh a -> Permutation sh toSquare :: (Strip lower, Strip upper, C sh, Floating a) => FlexPermutation lower upper sh a -> Quadratic Unpacked Arbitrary lower upper sh a determinant :: (C sh, Floating a) => FlexPermutation lower upper sh a -> a transpose :: C sh => FlexPermutation lower upper sh a -> FlexPermutation upper lower sh a multiplyVector :: (C size, Eq size, Floating a) => Inversion -> FlexPermutation lower upper size a -> Vector size a -> Vector size a multiplyFull :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Inversion -> FlexPermutation lower upper height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a module Numeric.LAPACK.Matrix.Full type Full meas vert horiz height width = UnpackedMatrix Arbitrary Filled Filled meas vert horiz height width type Unpacked property lower upper meas vert horiz height width = ArrayMatrix Unpacked property lower upper meas vert horiz height width identity :: (Measure meas, C vert, C horiz) => (C sh, Floating a) => sh -> Full meas vert horiz sh sh a diagonal :: (Measure meas, C vert, C horiz) => (C sh, Floating a) => Vector sh a -> Full meas vert horiz sh sh a mapExtent :: (Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => Map measA vertA horizA measB vertB horizB height width -> Full measA vertA horizA height width a -> Full measB vertB horizB height width a -- | The number of rows must be maintained by the height mapping function. mapHeight :: (C vert, C horiz, C heightA, C heightB, C width) => (heightA -> heightB) -> Full Size vert horiz heightA width a -> Full Size vert horiz heightB width a -- | The number of columns must be maintained by the width mapping -- function. mapWidth :: (C vert, C horiz, C widthA, C widthB, C height) => (widthA -> widthB) -> Full Size vert horiz height widthA a -> Full Size vert horiz height widthB a transpose :: (Measure meas, C vert, C horiz) => Full meas vert horiz height width a -> Full meas 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.gramian a instead. adjoint :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> Full meas horiz vert width height a multiplyVector :: (Measure meas, C vert, C horiz, C height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Vector width a -> Vector height a multiply :: (Measure meas, C vert, C horiz, C height, C fuse, Eq fuse, C width, Floating a) => Full meas vert horiz height fuse a -> Full meas vert horiz fuse width a -> Full meas vert horiz height width a module Numeric.LAPACK.Matrix.BandedHermitian type BandedHermitian offDiag sh = Hermitian offDiag sh data Transposition NonTransposed :: Transposition Transposed :: Transposition class (C neg, C pos) => Semidefinite neg pos assureFullRank :: (Semidefinite neg pos, C zero) => AnyHermitianP pack neg zero pos bands sh a -> AnyHermitianP pack neg False pos bands sh a assureAnyRank :: (Semidefinite neg pos, C zero) => AnyHermitianP pack neg True pos bands sh a -> AnyHermitianP pack neg zero pos bands sh a relaxSemidefinite :: (C neg, C zero, C pos) => AnyHermitianP pack neg False pos bands sh a -> AnyHermitianP pack neg zero pos bands sh a relaxIndefinite :: (C neg, C zero, C pos) => AnyHermitianP pack neg zero pos bands sh a -> Quadratic pack HermitianUnknownDefiniteness bands bands sh a assurePositiveDefiniteness :: (C neg, C zero, C pos) => AnyHermitianP pack neg zero pos bands sh a -> Quadratic pack HermitianPositiveDefinite bands bands sh a relaxDefiniteness :: (C neg, C zero, C pos) => Quadratic pack HermitianPositiveDefinite bands bands sh a -> AnyHermitianP pack neg zero pos bands sh a size :: BandedHermitian offDiag sh a -> sh fromList :: (Natural offDiag, C size, Floating a) => UnaryProxy offDiag -> Order -> size -> [a] -> BandedHermitian offDiag size a identity :: (C sh, Floating a) => sh -> HermitianPosDef U0 sh a diagonal :: (C sh, Floating a) => Vector sh (RealOf a) -> Diagonal sh a takeDiagonal :: (C neg, C zero, C pos) => (Natural offDiag, C size, Floating a) => FlexHermitian neg zero pos offDiag size a -> Vector size (RealOf a) toHermitian :: (C neg, C zero, C pos) => (Natural offDiag, C size, Floating a) => FlexHermitian neg zero pos offDiag size a -> FlexHermitian neg zero pos size a toBanded :: (C neg, C zero, C pos, Natural offDiag, C size, Floating a) => FlexHermitian neg zero pos offDiag size a -> Square offDiag offDiag size a forceOrder :: (C neg, C zero, C pos, Natural offDiag, C size, Floating a) => Order -> FlexHermitian neg zero pos offDiag size a -> FlexHermitian neg zero pos offDiag size a takeTopLeft :: (C neg, C zero, C pos, Natural offDiag, C sh0, C sh1, Floating a) => FlexHermitian neg zero pos offDiag (sh0 ::+ sh1) a -> FlexHermitian neg zero pos offDiag sh0 a takeBottomRight :: (C neg, C zero, C pos, Natural offDiag, C sh0, C sh1, Floating a) => FlexHermitian neg zero pos offDiag (sh0 ::+ sh1) a -> FlexHermitian neg zero pos offDiag sh1 a negate :: (C neg, C zero, C pos, Natural offDiag, C sh, Floating a) => FlexHermitian neg zero pos offDiag sh a -> FlexHermitian pos zero neg offDiag sh a multiplyVector :: (C neg, C zero, C pos, Natural offDiag, C size, Eq size, Floating a) => Transposition -> FlexHermitian neg zero pos offDiag size a -> Vector size a -> Vector size a multiplyFull :: (C neg, C zero, C pos, Natural offDiag, Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Transposition -> FlexHermitian neg zero pos offDiag height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a gramian :: (C size, Eq size, Floating a, Natural sub, Natural super) => Square sub super size a -> HermitianPosSemidef (sub :+: super) size a -- | The list represents ragged rows of a sparse matrix. sumRank1 :: (Natural k, Indexed sh, Floating a) => Order -> sh -> [(RealOf a, (Index sh, StaticVector (Succ k) a))] -> HermitianPosSemidef k sh a eigenvalues :: (C neg, C zero, C pos, Natural offDiag) => (Permutable sh, Floating a) => FlexHermitian neg zero pos offDiag sh a -> Vector sh (RealOf a) -- | For symmetric eigenvalue problems, eigensystem and -- schur coincide. eigensystem :: (C neg, C zero, C pos, Natural offDiag) => (Permutable sh, Floating a) => FlexHermitian neg zero pos offDiag sh a -> (Square sh a, Vector sh (RealOf a)) module Numeric.LAPACK.Matrix.Triangular type Triangular lo diag up sh = TriangularP Packed lo diag up sh type UpLo lo up = (UpLoC lo up, UpLoC up lo) type Upper sh = FlexUpper Arbitrary sh type FlexUpper diag sh = Quadratic Packed diag Empty Filled sh type UnitUpper sh = FlexUpper Unit sh type QuasiUpper sh = Quadratic Unpacked Arbitrary (Bands U1) Filled sh type Lower sh = FlexLower Arbitrary sh type FlexLower diag sh = Quadratic Packed diag Filled Empty sh type UnitLower sh = FlexLower Unit sh size :: TriangularP pack lo diag up sh a -> sh fromList :: (UpLo lo up, C sh, Storable a) => Order -> sh -> [a] -> Triangular lo Arbitrary up sh a autoFromList :: (UpLo lo up, Storable a) => Order -> [a] -> Triangular lo Arbitrary up ShapeInt a lowerFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Lower sh a autoLowerFromList :: Storable a => Order -> [a] -> Lower ShapeInt a upperFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Upper sh a autoUpperFromList :: Storable a => Order -> [a] -> Upper ShapeInt a asLower :: Id (FlexLowerP pack diag sh a) asUpper :: Id (FlexUpperP pack diag sh a) requireUnitDiagonal :: Id (TriangularP pack lo Unit up sh a) requireArbitraryDiagonal :: Id (TriangularP pack lo Arbitrary up sh a) relaxUnitDiagonal :: TriDiag diag => TriangularP pack lo Unit up sh a -> TriangularP pack lo diag up sh a strictArbitraryDiagonal :: TriDiag diag => TriangularP pack lo diag up sh a -> TriangularP pack lo Arbitrary up sh a identityOrder :: (Quadratic pack property lower upper, C sh, Floating a) => Order -> sh -> Quadratic pack property lower upper sh a diagonal :: (UpLo lo up, C sh, Floating a) => Order -> Vector sh a -> Triangular lo Arbitrary up sh a takeDiagonal :: (PowerStrip lo, PowerStrip up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> Vector sh a transpose :: (PowerStrip lo, PowerStrip up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> TriangularP pack up diag lo sh a adjoint :: (PowerStrip lo, PowerStrip up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> TriangularP pack up diag lo sh a stackLower :: (Packing pack, TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLowerP pack diag sh0 a -> General sh1 sh0 a -> FlexLowerP pack diag sh1 a -> FlexLowerP pack diag (sh0 ::+ sh1) a (#%%%) :: (Packing pack, TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLowerP pack diag sh0 a -> (General sh1 sh0 a, FlexLowerP pack diag sh1 a) -> FlexLowerP pack diag (sh0 ::+ sh1) a infixl 2 #%%% stackUpper :: (Packing pack, TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexUpperP pack diag sh0 a -> General sh0 sh1 a -> FlexUpperP pack diag sh1 a -> FlexUpperP pack diag (sh0 ::+ sh1) a (%%%#) :: (Packing pack, TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (FlexUpperP pack diag sh0 a, General sh0 sh1 a) -> FlexUpperP pack diag sh1 a -> FlexUpperP pack diag (sh0 ::+ sh1) a infixr 2 %%%# splitLower :: (Packing pack, TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLowerP pack diag (sh0 ::+ sh1) a -> (FlexLowerP pack diag sh0 a, General sh1 sh0 a, FlexLowerP pack diag sh1 a) splitUpper :: (Packing pack, TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexUpperP pack diag (sh0 ::+ sh1) a -> (FlexUpperP pack diag sh0 a, General sh0 sh1 a, FlexUpperP pack diag sh1 a) takeTopLeft :: (Packing pack, UpLo lo up, TriDiag diag, C sh0, C sh1, Floating a) => TriangularP pack lo diag up (sh0 ::+ sh1) a -> TriangularP pack lo diag up sh0 a takeTopRight :: (Packing pack, TriDiag diag, C sh0, C sh1, Floating a) => FlexUpperP pack diag (sh0 ::+ sh1) a -> General sh0 sh1 a takeBottomLeft :: (Packing pack, TriDiag diag, C sh0, C sh1, Floating a) => FlexLowerP pack diag (sh0 ::+ sh1) a -> General sh1 sh0 a takeBottomRight :: (Packing pack, UpLo lo up, TriDiag diag, C sh0, C sh1, Floating a) => TriangularP pack lo diag up (sh0 ::+ sh1) a -> TriangularP pack lo diag up sh1 a pack :: (Packing pack, UpLo lo up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> Triangular lo diag up sh a toSquare :: (PowerStrip lo, PowerStrip up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> Square sh a takeLower :: (Property property, Strip upper) => (Measure meas, C horiz, C height, C width, Floating a) => Unpacked property Filled upper meas Small horiz height width a -> Lower height a takeUpper :: (Property property, Strip lower) => (Measure meas, C vert, C height, C width, Floating a) => Unpacked property lower Filled meas vert Small height width a -> Upper width 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 :: (PowerStrip lo, PowerStrip up, TriDiag diag, C sh, Floating a) => Order -> TriangularP pack lo diag up sh a -> TriangularP pack lo diag up sh a -- | adaptOrder x y contains the data of y with the -- layout of x. adaptOrder :: (PowerStrip lo, PowerStrip up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> TriangularP pack lo diag up sh a -> TriangularP pack lo diag up sh a add :: (PowerStrip lo, PowerStrip up, Eq lo, Eq up, Eq sh, C sh, Floating a) => TriangularP pack lo Arbitrary up sh a -> TriangularP pack lo Arbitrary up sh a -> TriangularP pack lo Arbitrary up sh a sub :: (PowerStrip lo, PowerStrip up, Eq lo, Eq up, Eq sh, C sh, Floating a) => TriangularP pack lo Arbitrary up sh a -> TriangularP pack lo Arbitrary up sh a -> TriangularP pack lo Arbitrary up sh a multiplyVector :: (Packing pack, UpLo lo up, TriDiag diag, C sh, Eq sh, Floating a) => TriangularP pack lo diag up sh a -> Vector sh a -> Vector sh a square :: (Packing pack, UpLo lo up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> TriangularP pack lo diag up sh a multiply :: (Packing pack, UpLo lo up, TriDiag diag, C sh, Eq sh, Floating a) => TriangularP pack lo diag up sh a -> TriangularP pack lo diag up sh a -> TriangularP pack lo diag up sh a multiplyFull :: (Packing pack, UpLo lo up, TriDiag diag, Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => TriangularP pack lo diag up height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a solve :: (Packing pack, UpLo lo up, TriDiag diag, Measure meas, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => TriangularP pack lo diag up sh a -> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a inverse :: (Packing pack, UpLo lo up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> TriangularP pack lo diag up sh a determinant :: (Packing pack, UpLo lo up, TriDiag diag, C sh, Floating a) => TriangularP pack lo diag up sh a -> a eigenvalues :: (Packing pack, DiagUpLo lo up, C sh, Floating a) => TriangularP pack 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, but not necessarily an identity matrix. -- This is because all eigenvectors are normalized such that -- normInf1 is 1. With the following scaling, the decomposition -- becomes perfect: -- --
--   let scal = takeDiagonal $ vlAdj <> vr
--   a == vr <> diagonal (Vector.divide d 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 :: (Packing pack, DiagUpLo lo up, C sh, Floating a) => TriangularP pack lo Arbitrary up sh a -> (TriangularP pack lo Arbitrary up sh a, Vector sh a, TriangularP pack lo Arbitrary up sh a) module Numeric.LAPACK.Matrix.Symmetric type Symmetric sh = SymmetricP Packed sh takeUpper :: Symmetric sh a -> Upper sh a fromUpper :: Upper sh a -> Symmetric sh a pack :: (Packing pack, C sh, Floating a) => SymmetricP pack sh a -> Symmetric sh a assureSymmetry :: (Packing pack, C sh, Floating a) => Square sh a -> SymmetricP pack sh a size :: SymmetricP pack sh a -> sh fromList :: (C sh, Storable a) => Order -> sh -> [a] -> Symmetric sh a autoFromList :: Storable a => Order -> [a] -> Symmetric ShapeInt a identity :: (C sh, Floating a) => Order -> sh -> Symmetric sh a diagonal :: (C sh, Floating a) => Order -> Vector sh a -> Symmetric sh a takeDiagonal :: (C sh, Floating a) => Symmetric sh a -> Vector sh a forceOrder :: (Packing pack, C sh, Floating a) => Order -> SymmetricP pack sh a -> SymmetricP pack sh a transpose :: SymmetricP pack sh a -> SymmetricP pack sh a adjoint :: (Packing pack, C sh, Floating a) => SymmetricP pack sh a -> SymmetricP pack sh a stack :: (Packing pack, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => SymmetricP pack sh0 a -> General sh0 sh1 a -> SymmetricP pack sh1 a -> SymmetricP pack (sh0 ::+ sh1) a (#%%%#) :: (Packing pack, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (SymmetricP pack sh0 a, General sh0 sh1 a) -> SymmetricP pack sh1 a -> SymmetricP pack (sh0 ::+ sh1) a infixr 2 #%%%# split :: (Packing pack, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => SymmetricP pack (sh0 ::+ sh1) a -> (SymmetricP pack sh0 a, General sh0 sh1 a, SymmetricP pack sh1 a) takeTopLeft :: (Packing pack, C sh0, C sh1, Floating a) => SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh0 a takeTopRight :: (Packing pack, C sh0, C sh1, Floating a) => SymmetricP pack (sh0 ::+ sh1) a -> General sh0 sh1 a takeBottomRight :: (Packing pack, C sh0, C sh1, Floating a) => SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh1 a toSquare :: (Packing pack, C sh, Floating a) => SymmetricP pack sh a -> Square sh a fromHermitian :: (Packing pack, C neg, C zero, C pos, C sh, Real a) => FlexHermitianP pack neg zero pos sh a -> SymmetricP pack sh a multiplyVector :: Packing pack => (C sh, Eq sh, Floating a) => SymmetricP pack sh a -> Vector sh a -> Vector sh a multiplyFull :: Packing pack => (Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => SymmetricP pack height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a square :: (Packing pack, C sh, Floating a) => SymmetricP pack sh a -> SymmetricP pack sh a tensorProduct :: (Packing pack, C sh, Floating a) => Order -> Vector sh a -> SymmetricP pack sh a sumRank1 :: (Packing pack, C sh, Eq sh, Floating a) => Order -> sh -> [(a, Vector sh a)] -> SymmetricP pack sh a sumRank1NonEmpty :: (Packing pack, C sh, Eq sh, Floating a) => Order -> T [] (a, Vector sh a) -> SymmetricP pack sh a -- | gramian A = A^T * A gramian :: Packing pack => (C height, C width, Floating a) => General height width a -> SymmetricP pack width a -- | gramianTransposed A = A * A^T = gramian (A^T) gramianTransposed :: Packing pack => (C height, C width, Floating a) => General height width a -> SymmetricP pack height a -- | congruenceDiagonal D A = A^T * D * A congruenceDiagonal :: Packing pack => (C height, Eq height, C width, Floating a) => Vector height a -> General height width a -> SymmetricP pack width a -- | congruenceDiagonalTransposed A D = A * D * A^T congruenceDiagonalTransposed :: Packing pack => (C height, C width, Eq width, Floating a) => General height width a -> Vector width a -> SymmetricP pack height a -- | congruence B A = A^T * B * A congruence :: Packing pack => (C height, Eq height, C width, Floating a) => SymmetricP pack height a -> General height width a -> SymmetricP pack width a -- | congruenceTransposed B A = A * B * A^T congruenceTransposed :: Packing pack => (C height, C width, Eq width, Floating a) => General height width a -> SymmetricP pack width a -> SymmetricP pack height a -- | anticommutator A B = A^T * B + B^T * A -- -- Not exactly a matrix anticommutator, thus I like to call it Symmetric -- anticommutator. anticommutator :: (Packing pack, Measure meas, C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Full meas vert horiz height width a -> SymmetricP pack width a -- | anticommutatorTransposed A B = A * B^T + B * A^T = anticommutator -- (transpose A) (transpose B) anticommutatorTransposed :: (Packing pack, Measure meas, C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Full meas vert horiz height width a -> SymmetricP pack height a -- | addTransposed A = A^T + A addTransposed :: (Packing pack, C sh, Floating a) => Square sh a -> SymmetricP pack sh a solve :: Packing pack => (Measure meas, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => SymmetricP pack sh a -> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a inverse :: (Packing pack, C sh, Floating a) => SymmetricP pack sh a -> SymmetricP pack sh a determinant :: (Packing pack, C sh, Floating a) => SymmetricP pack sh a -> a module Numeric.LAPACK.Matrix.Quadratic asDiagonal :: Id (FlexDiagonal diag sh a) asSymmetric :: Id (Symmetric sh a) size :: Quadratic pack property lower upper sh a -> sh -- | The number of rows and columns must be maintained by the shape mapping -- function. mapSize :: (C shA, C shB) => (shA -> shB) -> Quadratic pack property lower upper shA a -> Quadratic pack property lower upper shB a identity :: (Quadratic pack property lower upper, C sh, Floating a) => Order -> sh -> Quadratic pack property lower upper sh a diagonal :: (Diagonal property, Quadratic pack property lower upper, C sh, Floating a) => Order -> Vector sh a -> Quadratic pack property lower upper sh a class (Property property) => Diagonal property takeDiagonal :: (C sh, Floating a) => Quadratic pack property lower upper sh a -> Vector sh a takeTopLeft :: (C sh0, C sh1, Floating a) => Quadratic pack property lower upper (sh0 ::+ sh1) a -> Quadratic pack property lower upper sh0 a takeTopRight :: (C sh0, C sh1, Floating a) => Quadratic pack property lower Filled (sh0 ::+ sh1) a -> General sh0 sh1 a takeBottomLeft :: (C sh0, C sh1, Floating a) => Quadratic pack property Filled upper (sh0 ::+ sh1) a -> General sh1 sh0 a takeBottomRight :: (C sh0, C sh1, Floating a) => Quadratic pack property lower upper (sh0 ::+ sh1) a -> Quadratic pack property lower upper sh1 a instance Numeric.LAPACK.Matrix.Quadratic.Diagonal Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance Numeric.LAPACK.Matrix.Quadratic.Diagonal Numeric.LAPACK.Matrix.Shape.Omni.Symmetric module Numeric.LAPACK.Matrix.Square type Square sh = SquareMeas Shape sh sh size :: Square sh a -> sh mapSize :: (sh0 -> sh1) -> Square sh0 a -> Square sh1 a toFull :: (Measured meas vert, Measured meas horiz) => Square sh a -> Full meas vert horiz sh sh a toGeneral :: Square sh a -> General sh sh a fromFull :: (Measure meas, C vert, C horiz, Eq sh) => Full meas vert horiz sh sh a -> Square sh a liberalFromFull :: (Measure meas, C vert, C horiz, C height, C width) => Full meas vert horiz height width a -> LiberalSquare height width 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 ShapeInt 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 stack :: (Measure meas, C vert, C horiz, C sizeA, Eq sizeA, C sizeB, Eq sizeB, Floating a) => Square sizeA a -> Full meas vert horiz sizeA sizeB a -> Full meas horiz vert sizeB sizeA a -> Square sizeB a -> Square (sizeA ::+ sizeB) a (|=|) :: (Measure meas, C vert, C horiz, C sizeA, Eq sizeA, C sizeB, Eq sizeB, Floating a) => (Square sizeA a, Full meas vert horiz sizeA sizeB a) -> (Full meas horiz vert sizeB sizeA a, Square sizeB a) -> Square (sizeA ::+ sizeB) a infix 3 |=| takeTopLeft :: (C sizeA, C sizeB, Floating a) => Square (sizeA ::+ sizeB) a -> Square sizeA a takeBottomRight :: (C sizeA, C sizeB, Floating a) => Square (sizeA ::+ sizeB) a -> Square sizeB 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 -- | congruence B A = A^H * B * A -- -- The meaning and order of matrix factors of these functions is -- consistent: -- -- congruence :: (C height, Eq height, C width, Floating a) => Square height a -> General height width a -> Square width a -- | congruenceAdjoint A B = A * B * A^H congruenceAdjoint :: (C height, C width, Eq width, Floating a) => General height width a -> Square width a -> Square height a solve :: (Measure meas, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Square sh a -> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a inverse :: (Measure meas, C height, C width, Floating a) => SquareMeas meas height width a -> SquareMeas meas width height a determinant :: (C sh, Floating a) => Square sh a -> a eigenvalues :: (Permutable sh, Floating a) => Square sh a -> Vector sh (ComplexOf a) -- | If (q,r) = schur a, then a = q <> r <> -- 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. -- -- The meaning and order of matrix factors of these functions is -- consistent: -- -- schur :: (Permutable sh, Floating a) => Square sh a -> (Square sh a, QuasiUpper sh a) schurComplex :: (Permutable sh, Real a, Complex a ~ ac) => Square sh ac -> (Square sh ac, Upper sh ac) -- |
--   (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, but not necessarily an identity matrix. -- This is because all eigenvectors are normalized to Euclidean norm 1. -- With the following scaling, the decomposition becomes perfect: -- --
--   let scal = takeDiagonal $ vlAdj <> vr
--   a == vr #*\ Vector.divide d 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. -- -- The meaning and order of result matrices of these functions is -- consistent: -- -- eigensystem :: (Permutable sh, Floating a, ComplexOf a ~ ac) => Square sh a -> (Square sh ac, Vector sh ac, Square sh ac) type ComplexOf x = Complex (RealOf x) module Numeric.LAPACK.Matrix.HermitianPositiveDefinite class (C neg, C pos) => Semidefinite neg pos assureFullRank :: (Semidefinite neg pos, C zero) => AnyHermitianP pack neg zero pos bands sh a -> AnyHermitianP pack neg False pos bands sh a assureAnyRank :: (Semidefinite neg pos, C zero) => AnyHermitianP pack neg True pos bands sh a -> AnyHermitianP pack neg zero pos bands sh a relaxSemidefinite :: (C neg, C zero, C pos) => AnyHermitianP pack neg False pos bands sh a -> AnyHermitianP pack neg zero pos bands sh a relaxIndefinite :: (C neg, C zero, C pos) => AnyHermitianP pack neg zero pos bands sh a -> Quadratic pack HermitianUnknownDefiniteness bands bands sh a assurePositiveDefiniteness :: (C neg, C zero, C pos) => AnyHermitianP pack neg zero pos bands sh a -> Quadratic pack HermitianPositiveDefinite bands bands sh a relaxDefiniteness :: (C neg, C zero, C pos) => Quadratic pack HermitianPositiveDefinite bands bands sh a -> AnyHermitianP pack neg zero pos bands sh a solve :: (Measure meas, C vert, C horiz, Packing pack, C sh, Eq sh, C nrhs, Floating a) => HermitianPosDefP pack sh a -> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a -- |
--   solve a b == solveDecomposed (decompose a) b
--   solve (gramian u) b == solveDecomposed u b
--   
solveDecomposed :: (Measure meas, C vert, C horiz, Packing pack, C sh, Eq sh, C nrhs, Floating a) => UpperP pack sh a -> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a inverse :: (Packing pack, C sh, Floating a) => HermitianPosDefP pack sh a -> HermitianPosDefP pack sh a -- | Cholesky decomposition decompose :: (Packing pack, C sh, Floating a) => HermitianPosDefP pack sh a -> UpperP pack sh a determinant :: (Packing pack, C sh, Floating a) => HermitianPosDefP pack sh a -> RealOf a module Numeric.LAPACK.Matrix.Hermitian -- | The definiteness tags mean: -- -- -- -- If a tag is True then this imposes no further restriction on -- the matrix. type FlexHermitian neg zero pos sh = FlexHermitianP Packed neg zero pos sh type Hermitian sh = HermitianP Packed sh type HermitianPosDef sh = HermitianPosDefP Packed sh type HermitianPosSemidef sh = HermitianPosSemidefP Packed sh data Transposition NonTransposed :: Transposition Transposed :: Transposition class (C neg, C pos) => Semidefinite neg pos assureFullRank :: (Semidefinite neg pos, C zero) => AnyHermitianP pack neg zero pos bands sh a -> AnyHermitianP pack neg False pos bands sh a assureAnyRank :: (Semidefinite neg pos, C zero) => AnyHermitianP pack neg True pos bands sh a -> AnyHermitianP pack neg zero pos bands sh a relaxSemidefinite :: (C neg, C zero, C pos) => AnyHermitianP pack neg False pos bands sh a -> AnyHermitianP pack neg zero pos bands sh a relaxIndefinite :: (C neg, C zero, C pos) => AnyHermitianP pack neg zero pos bands sh a -> Quadratic pack HermitianUnknownDefiniteness bands bands sh a assurePositiveDefiniteness :: (C neg, C zero, C pos) => AnyHermitianP pack neg zero pos bands sh a -> Quadratic pack HermitianPositiveDefinite bands bands sh a relaxDefiniteness :: (C neg, C zero, C pos) => Quadratic pack HermitianPositiveDefinite bands bands sh a -> AnyHermitianP pack neg zero pos bands sh a asUnknownDefiniteness :: Id (Quadratic pack HermitianUnknownDefiniteness bands bands sh a) pack :: (Packing pack, C neg, C zero, C pos, C sh, Floating a) => FlexHermitianP pack neg zero pos sh a -> FlexHermitian neg zero pos sh a size :: FlexHermitianP pack neg zero pos sh a -> sh fromList :: (C sh, Floating a) => Order -> sh -> [a] -> Hermitian sh a autoFromList :: Floating a => Order -> [a] -> Hermitian ShapeInt a identity :: (C sh, Floating a) => Order -> sh -> HermitianPosDef sh a diagonal :: (C sh, Floating a) => Order -> Vector sh (RealOf a) -> Hermitian sh a takeDiagonal :: (C neg, C zero, C pos, C sh, Floating a) => FlexHermitian neg zero pos sh a -> Vector sh (RealOf a) forceOrder :: (Packing pack, C neg, C zero, C pos, C sh, Floating a) => Order -> FlexHermitianP pack neg zero pos sh a -> FlexHermitianP pack neg zero pos sh a -- |
--   toSquare (stack a b c)
--   
--   =
--   
--   toSquare a ||| b
--   ===
--   adjoint b ||| toSquare c
--   
-- -- It holds order (stack a b c) = order b. The function is most -- efficient when the order of all blocks match. stack :: (Packing pack, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => HermitianP pack sh0 a -> General sh0 sh1 a -> HermitianP pack sh1 a -> HermitianP pack (sh0 ::+ sh1) a (*%%%#) :: (Packing pack, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (HermitianP pack sh0 a, General sh0 sh1 a) -> HermitianP pack sh1 a -> HermitianP pack (sh0 ::+ sh1) a infixr 2 *%%%# split :: (Packing pack, C neg, C zero, C pos, C sh0, C sh1, Floating a) => FlexHermitianP pack neg zero pos (sh0 ::+ sh1) a -> (FlexHermitianP pack neg zero pos sh0 a, General sh0 sh1 a, FlexHermitianP pack neg zero pos sh1 a) -- | Sub-matrices maintain definiteness of the original matrix. Consider -- x^* A x > 0. Then y^* (take A) y = x^* A x where some components of -- x are zero. takeTopLeft :: (Packing pack, C neg, C zero, C pos, C sh0, C sh1, Floating a) => FlexHermitianP pack neg zero pos (sh0 ::+ sh1) a -> FlexHermitianP pack neg zero pos sh0 a takeTopRight :: (Packing pack, C neg, C zero, C pos, C sh0, C sh1, Floating a) => FlexHermitianP pack neg zero pos (sh0 ::+ sh1) a -> General sh0 sh1 a takeBottomRight :: (Packing pack, C neg, C zero, C pos, C sh0, C sh1, Floating a) => FlexHermitianP pack neg zero pos (sh0 ::+ sh1) a -> FlexHermitianP pack neg zero pos sh1 a toSquare :: (Packing pack, C neg, C zero, C pos, C sh, Floating a) => FlexHermitianP pack neg zero pos sh a -> Square sh a fromSymmetric :: (Packing pack, C sh, Real a) => SymmetricP pack sh a -> HermitianP pack sh a negate :: (C neg, C zero, C pos, C sh, Floating a) => AnyHermitianP pack neg zero pos bands sh a -> AnyHermitianP pack pos zero neg bands sh a multiplyVector :: Packing pack => (C neg, C zero, C pos, C sh, Eq sh, Floating a) => Transposition -> FlexHermitianP pack neg zero pos sh a -> Vector sh a -> Vector sh a multiplyFull :: Packing pack => (C neg, C zero, C pos, Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Transposition -> FlexHermitianP pack neg zero pos height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a square :: Packing pack => (C neg, C zero, C pos, C sh, Floating a) => FlexHermitianP pack neg zero pos sh a -> FlexHermitianP pack neg zero pos sh a outer :: (Packing pack, C sh, Floating a) => Order -> Vector sh a -> HermitianPosSemidefP pack sh a sumRank1 :: (Packing pack, C sh, Eq sh, Floating a) => Order -> sh -> [(RealOf a, Vector sh a)] -> HermitianPosSemidefP pack sh a sumRank1NonEmpty :: (Packing pack, C sh, Eq sh, Floating a) => Order -> T [] (RealOf a, Vector sh a) -> HermitianPosSemidefP pack sh a sumRank2 :: (Packing pack, C sh, Eq sh, Floating a) => Order -> sh -> [(a, (Vector sh a, Vector sh a))] -> HermitianP pack sh a sumRank2NonEmpty :: (Packing pack, C sh, Eq sh, Floating a) => Order -> T [] (a, (Vector sh a, Vector sh a)) -> HermitianP pack sh a -- | gramian A = A^H * A gramian :: Packing pack => (C height, C width, Floating a) => General height width a -> HermitianPosSemidefP pack width a -- | gramianAdjoint A = A * A^H = gramian (A^H) gramianAdjoint :: Packing pack => (C height, C width, Floating a) => General height width a -> HermitianPosSemidefP pack height a -- | congruenceDiagonal D A = A^H * D * A congruenceDiagonal :: Packing pack => (C height, Eq height, C width, Floating a) => Vector height (RealOf a) -> General height width a -> HermitianP pack width a -- | congruenceDiagonalAdjoint A D = A * D * A^H congruenceDiagonalAdjoint :: Packing pack => (C height, C width, Eq width, Floating a) => General height width a -> Vector width (RealOf a) -> HermitianP pack height a -- | congruence B A = A^H * B * A congruence :: Packing pack => (C neg, C pos, C height, Eq height, C width, Floating a) => FlexHermitianP pack neg True pos height a -> General height width a -> FlexHermitianP pack neg True pos width a -- | congruenceAdjoint B A = A * B * A^H congruenceAdjoint :: Packing pack => (C neg, C pos, C height, C width, Eq width, Floating a) => General height width a -> FlexHermitianP pack neg True pos width a -> FlexHermitianP pack neg True pos height a -- | anticommutator A B = A^H * B + B^H * A -- -- Not exactly a matrix anticommutator, thus I like to call it Hermitian -- anticommutator. anticommutator :: Packing pack => (Measure meas, C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Full meas vert horiz height width a -> HermitianP pack width a -- | anticommutatorAdjoint A B = A * B^H + B * A^H = anticommutator -- (adjoint A) (adjoint B) anticommutatorAdjoint :: Packing pack => (Measure meas, C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Full meas vert horiz height width a -> HermitianP pack height a -- | addAdjoint A = A^H + A addAdjoint :: (Packing pack, C sh, Floating a) => Square sh a -> HermitianP pack sh a solve :: Packing pack => (C neg, C zero, C pos, Measure meas, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => FlexHermitianP pack neg zero pos sh a -> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a inverse :: (Packing pack, C neg, C zero, C pos, C sh, Floating a) => FlexHermitianP pack neg zero pos sh a -> FlexHermitianP pack neg zero pos sh a determinant :: (Packing pack, C neg, C zero, C pos, C sh, Floating a) => FlexHermitianP pack neg zero pos sh a -> RealOf a eigenvalues :: (Packing pack, C neg, C zero, C pos, Permutable sh, Floating a) => FlexHermitianP pack neg zero pos sh a -> Vector sh (RealOf a) -- | For symmetric eigenvalue problems, eigensystem and -- schur coincide. eigensystem :: (Packing pack, C neg, C zero, C pos, Permutable sh, Floating a) => FlexHermitianP pack neg zero pos sh a -> (Square sh a, Vector sh (RealOf a)) module Numeric.LAPACK.Matrix.BandedHermitianPositiveDefinite class (C neg, C pos) => Semidefinite neg pos assureFullRank :: (Semidefinite neg pos, C zero) => AnyHermitianP pack neg zero pos bands sh a -> AnyHermitianP pack neg False pos bands sh a assureAnyRank :: (Semidefinite neg pos, C zero) => AnyHermitianP pack neg True pos bands sh a -> AnyHermitianP pack neg zero pos bands sh a relaxSemidefinite :: (C neg, C zero, C pos) => AnyHermitianP pack neg False pos bands sh a -> AnyHermitianP pack neg zero pos bands sh a relaxIndefinite :: (C neg, C zero, C pos) => AnyHermitianP pack neg zero pos bands sh a -> Quadratic pack HermitianUnknownDefiniteness bands bands sh a assurePositiveDefiniteness :: (C neg, C zero, C pos) => AnyHermitianP pack neg zero pos bands sh a -> Quadratic pack HermitianPositiveDefinite bands bands sh a relaxDefiniteness :: (C neg, C zero, C pos) => Quadratic pack HermitianPositiveDefinite bands bands sh a -> AnyHermitianP pack neg zero pos bands sh a solve :: (Natural offDiag, C size, Eq size, Measure meas, C vert, C horiz, C nrhs, Floating a) => HermitianPosDef offDiag size a -> Full meas vert horiz size nrhs a -> Full meas vert horiz size nrhs a -- |
--   solve a b == solveDecomposed (decompose a) b
--   solve (gramian u) b == solveDecomposed u b
--   
solveDecomposed :: (Natural offDiag, C size, Eq size, Measure meas, C vert, C horiz, C nrhs, Floating a) => Upper offDiag size a -> Full meas vert horiz size nrhs a -> Full meas vert horiz size nrhs a -- | Cholesky decomposition decompose :: (Natural offDiag, C size, Floating a) => HermitianPosDef offDiag size a -> Upper offDiag size a determinant :: (Natural offDiag, C size, Floating a) => HermitianPosDef offDiag size a -> RealOf a module Numeric.LAPACK.Matrix.Banded type Banded sub super meas vert horiz height width = FlexBanded Arbitrary sub super meas vert horiz height width type FlexBanded prop sub super meas vert horiz height width = ArrayMatrix Packed prop (Bands sub) (Bands super) meas vert horiz height width type General sub super height width = Banded sub super Size Big Big height width type Square sub super size = Quadratic Arbitrary sub super size type Upper super size = Square U0 super size type UnitUpper super size = UnitTriangular U0 super size type Lower sub size = Square sub U0 size type UnitLower sub size = UnitTriangular sub U0 size type Diagonal size = FlexDiagonal Arbitrary size type FlexDiagonal diag size = SymmQuadratic diag U0 size type RectangularDiagonal meas vert horiz height width = Banded U0 U0 meas vert horiz height width type Hermitian offDiag sh = SymmQuadratic HermitianUnknownDefiniteness offDiag sh type HermitianPosSemidef offDiag sh = SymmQuadratic HermitianPositiveSemidefinite offDiag sh type HermitianPosDef offDiag sh = SymmQuadratic HermitianPositiveDefinite offDiag sh type FlexHermitian neg zero pos offDiag sh = SymmQuadratic (Hermitian neg zero pos) offDiag sh height :: (Measure meas, C vert, C horiz) => Banded sub super meas vert horiz height width a -> height width :: (Measure meas, C vert, C horiz) => Banded sub super meas vert horiz height width a -> width 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) => (Natural sub, Natural super) => Map measA vertA horizA measB vertB horizB height width -> Banded sub super measA vertA horizA height width a -> Banded sub super measB vertB horizB height width a diagonal :: (C sh, Floating a) => Order -> Vector sh a -> Diagonal sh a takeDiagonal :: (Natural sub, Natural super, C sh, Floating a) => Square sub super sh a -> Vector sh a forceOrder :: (Natural sub, Natural super, Measure meas, C vert, C horiz, C height, C width, Floating a) => Order -> Banded sub super meas vert horiz height width a -> Banded sub super meas vert horiz height width a noUnit :: UnitTriangular sub super sh a -> Square sub super sh a toFull :: (Natural sub, Natural super, Measure meas, C vert, C horiz, C height, C width, Floating a) => Banded sub super meas vert horiz height width a -> Full meas 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 takeTopLeftSquare :: (Natural sub, Natural super, C sh0, C sh1, Floating a) => Square sub super (sh0 ::+ sh1) a -> Square sub super sh0 a takeBottomRightSquare :: (Natural sub, Natural super, C sh0, C sh1, Floating a) => Square sub super (sh0 ::+ sh1) a -> Square sub super sh1 a transpose :: (TriDiag diag, Natural sub, Natural super, Measure meas, C vert, C horiz) => FlexBanded diag sub super meas vert horiz height width a -> FlexBanded diag super sub meas horiz vert width height a adjoint :: (Natural sub, Natural super, Measure meas, C vert, C horiz, C height, C width, Floating a) => FlexBanded diag sub super meas vert horiz height width a -> FlexBanded diag super sub meas horiz vert width height a multiplyVector :: (Natural sub, Natural super, Measure meas, C vert, C horiz, C height, C width, Eq width, Floating a) => Banded sub super meas 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, Measure meas, C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) => Banded subA superA meas vert horiz height fuse a -> Banded subB superB meas vert horiz fuse width a -> Banded subC superC meas vert horiz height width a multiplyFull :: (Natural sub, Natural super, Measure meas, C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) => Banded sub super meas vert horiz height fuse a -> Full meas vert horiz fuse width a -> Full meas vert horiz height width a solve :: (TriDiag diag, Natural sub, Natural super, Measure meas, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Quadratic diag sub super sh a -> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a determinant :: (TriDiag diag, Natural sub, Natural super, C sh, Floating a) => Quadratic diag sub super sh a -> a module Numeric.LAPACK.Matrix.Diagonal type Diagonal size = FlexDiagonal Arbitrary size type FlexDiagonal diag size = SymmQuadratic diag U0 size fromList :: (C sh, Storable a) => Order -> sh -> [a] -> Diagonal sh a autoFromList :: Storable a => Order -> [a] -> Diagonal ShapeInt a lift :: (Packing pack, C sha, C shb, Floating a, Floating b) => (Array sha a -> Array shb b) -> FlexDiagonalP pack Arbitrary sha a -> FlexDiagonalP pack Arbitrary shb b stack :: Packing pack => (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonalP pack diag sh0 a -> FlexDiagonalP pack diag sh1 a -> FlexDiagonalP pack diag (sh0 ::+ sh1) a (%%%) :: Packing pack => (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonalP pack diag sh0 a -> FlexDiagonalP pack diag sh1 a -> FlexDiagonalP pack diag (sh0 ::+ sh1) a infixr 2 %%% split :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonalP pack diag (sh0 ::+ sh1) a -> (FlexDiagonalP pack diag sh0 a, FlexDiagonalP pack diag sh1 a) multiply :: (TriDiag diag, C sh, Eq sh, Floating a) => FlexDiagonal diag sh a -> FlexDiagonal diag sh a -> FlexDiagonal diag sh a solve :: (TriDiag diag, Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => FlexDiagonal diag height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a inverse :: (TriDiag diag, C sh, Floating a) => FlexDiagonal diag sh a -> FlexDiagonal diag sh a determinant :: (TriDiag diag, C sh, Floating a) => FlexDiagonal diag sh a -> a module Numeric.LAPACK.Orthogonal.Householder type Householder = HouseholderFlex Filled Filled type General height width = Householder Size Big Big height width type Tall height width = Householder Size Big Small height width type Wide height width = Householder Size Small Big height width type Square sh = SquareMeas Shape sh sh type LiberalSquare height width = SquareMeas Size height width mapExtent :: (Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => Map measA vertA horizA measB vertB horizB height width -> Householder measA vertA horizA height width a -> Householder measB vertB horizB height width a fromMatrix :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> Householder meas vert horiz height width a determinant :: (C sh, Floating a) => HouseholderFlex lower upper Shape Small Small sh sh a -> a determinantAbsolute :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Householder meas vert horiz height width a -> RealOf a leastSquares :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Eq width, C nrhs, Floating a) => Householder meas horiz Small height width a -> Full meas vert horiz height nrhs a -> Full meas vert horiz width nrhs a -- |
--   HH.minimumNorm (HH.fromMatrix a) b
--   ==
--   Ortho.minimumNorm (adjoint a) b
--   
minimumNorm :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Eq width, C nrhs, Floating a) => Householder meas vert Small width height a -> Full meas vert horiz height nrhs a -> Full meas vert horiz width nrhs a data Transposition NonTransposed :: Transposition Transposed :: Transposition data Conjugation NonConjugated :: Conjugation Conjugated :: Conjugation extractQ :: (Measure meas, C vert, C horiz, Permutable height, C width, Floating a) => Householder meas vert horiz height width a -> Square height a extractR :: (Measure meas, C vert, C horiz, Permutable height, C width, Floating a) => Householder meas vert horiz height width a -> UpperTrapezoid meas vert horiz height width a multiplyQ :: (Measure measA, C vertA, C horizA, C widthA, Measure measB, C vertB, C horizB, C widthB, Permutable height, Eq height, Floating a) => Transposition -> Conjugation -> Householder measA vertA horizA height widthA a -> Full measB vertB horizB height widthB a -> Full measB vertB horizB height widthB a tallExtractQ :: (Measure meas, C vert, C height, Permutable width, Floating a) => Householder meas vert Small height width a -> Full meas vert Small height width a tallExtractR :: (Measure meas, C vert, C height, Permutable width, Floating a) => Householder meas vert Small height width a -> Upper width a tallMultiplyQ :: (Measure meas, C vert, C horiz, Permutable height, Eq height, C width, C fuse, Eq fuse, Floating a) => Householder meas vert Small height fuse a -> Full meas vert horiz fuse width a -> Full meas vert horiz height width a tallMultiplyQAdjoint :: (Measure meas, C vert, C horiz, Permutable height, C width, C fuse, Eq fuse, Floating a) => Householder meas horiz Small fuse height a -> Full meas vert horiz fuse width a -> Full meas vert horiz height width a tallMultiplyR :: (Measure measA, C vertA, Measure meas, C vert, C horiz, Permutable height, Eq height, C heightA, C widthB, Floating a) => Transposition -> Householder measA vertA Small heightA height a -> Full meas vert horiz height widthB a -> Full meas vert horiz height widthB a tallSolveR :: (Measure measA, C vertA, Measure meas, C vert, C horiz, C height, Permutable width, Eq width, C nrhs, Floating a) => Transposition -> Conjugation -> Householder measA vertA Small height width a -> Full meas vert horiz width nrhs a -> Full meas vert horiz width nrhs 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 :: (Measure meas, C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => Full meas horiz Small height width a -> Full meas vert horiz height nrhs a -> Full meas 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 :: (Measure meas, C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => Full meas Small vert height width a -> Full meas vert horiz height nrhs a -> Full meas vert horiz width nrhs a -- | If (rank,x) = leastSquaresMinimumNormRCond rcond a b then -- x is the vector with minimum Vector.norm2 x that -- minimizes Vector.norm2 (a #*| x sub b). -- -- Matrix a can have any rank but you must specify the -- reciprocal condition of the rank-truncated matrix. leastSquaresMinimumNormRCond :: (Measure meas, C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => RealOf a -> Full meas horiz vert height width a -> Full meas vert horiz height nrhs a -> (Int, Full meas vert horiz width nrhs a) pseudoInverseRCond :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => RealOf a -> Full meas vert horiz height width a -> (Int, Full meas horiz vert width height a) -- | project b d x projects x on the plane described by -- B*x = d. -- -- b must have full rank. project :: (C height, Eq height, C width, Eq width, Floating a) => Wide height width a -> Vector height a -> Vector width a -> Vector width a -- | leastSquaresConstraint a c b d computes x with -- minimal || c - A*x ||_2 and constraint B*x = d. -- -- b must be wide and a===b must be tall and both -- matrices must have full rank. leastSquaresConstraint :: (C height, Eq height, C width, Eq width, C constraints, Eq constraints, Floating a) => General height width a -> Vector height a -> Wide constraints width a -> Vector constraints a -> Vector width a -- | gaussMarkovLinearModel a b d computes (x,y) with -- minimal || y ||_2 and constraint d = A*x + B*y. -- -- a must be tall and a|||b must be wide and both -- matrices must have full rank. gaussMarkovLinearModel :: (C height, Eq height, C width, Eq width, C opt, Eq opt, Floating a) => Tall height width a -> General height opt a -> Vector height a -> (Vector width a, Vector opt 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.gramian a))
--   
determinantAbsolute :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas 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 ShapeInt a -- |
--   affineFrameFromFiber a b == (c,d)
--   
-- -- Means: An affine subspace is given implicitly by {x : a#*|x == b}. -- Convert this into an explicit representation {c#*|y|+|d : y}. Matrix -- a must have full rank, otherwise the explicit representation -- will miss dimensions and we cannot easily determine the origin -- d as a minimum norm solution. -- -- The computation is like -- --
--   c = complement $ adjoint a
--   d = minimumNorm a b
--   
-- -- but the QR decomposition of a is computed only once. affineFrameFromFiber :: (C width, Eq width, C height, Eq height, Floating a) => Wide height width a -> Vector height a -> (Tall width ShapeInt a, Vector width a) -- | This conversion is somehow inverse to affineFrameFromFiber. -- However, it is not precisely inverse in either direction. This is -- because both affineFrameFromFiber and -- affineFiberFromFrame accept non-orthogonal matrices but always -- return orthogonal ones. -- -- In affineFiberFromFrame c d, matrix c should have -- full rank, otherwise the implicit representation will miss dimensions. affineFiberFromFrame :: (C width, Eq width, C height, Eq height, Floating a) => Tall height width a -> Vector height a -> (Wide ShapeInt height a, Vector ShapeInt a) householder :: (Measure meas, C vert, C horiz, Permutable height, C width, Floating a) => Full meas vert horiz height width a -> (Square height a, UpperTrapezoid meas vert horiz height width a) householderTall :: (Measure meas, C vert, C height, Permutable width, Floating a) => Full meas vert Small height width a -> (Full meas vert Small height width a, Upper width a) module Numeric.LAPACK.Matrix.Special data family Matrix typ extraLower extraUpper lower upper meas vert horiz height width a type Scale sh = Quadratic Scale () () Empty Empty sh type Inverse typ lower upper sh = Quadratic (Inverse typ) lower upper Filled Filled sh inverse :: (Strip lower, Fill lower ~ lowerf, Strip upper, Fill upper ~ upperf) => QuadraticMeas typ xl xu upper lower meas width height a -> QuadraticMeas (Inverse typ) (xl, lower) (xu, upper) lowerf upperf meas height width a module Numeric.LAPACK.Matrix data family Matrix typ extraLower extraUpper lower upper meas vert horiz height width a type Full meas vert horiz height width = UnpackedMatrix Arbitrary Filled Filled meas vert horiz height width type General height width = Full Size Big Big height width type Tall height width = Full Size Big Small height width type Wide height width = Full Size Small Big height width type Square sh = SquareMeas Shape sh sh type LiberalSquare height width = SquareMeas Size height width type Quadratic typ extraLower extraUpper lower upper sh = QuadraticMeas typ extraLower extraUpper lower upper Shape sh sh type Triangular lo diag up sh = TriangularP Packed lo diag up sh type Upper sh = FlexUpper Arbitrary sh type Lower sh = FlexLower Arbitrary sh type Symmetric sh = SymmetricP Packed sh type Hermitian sh = HermitianP Packed sh type HermitianPosDef sh = HermitianPosDefP Packed sh type HermitianPosSemidef sh = HermitianPosSemidefP Packed sh -- | The definiteness tags mean: -- -- -- -- If a tag is True then this imposes no further restriction on -- the matrix. type FlexHermitian neg zero pos sh = FlexHermitianP Packed neg zero pos sh type Diagonal size = FlexDiagonal Arbitrary size type FlexDiagonal diag size = SymmQuadratic diag U0 size type RectangularDiagonal meas vert horiz height width = Banded U0 U0 meas vert horiz height width type Banded sub super meas vert horiz height width = FlexBanded Arbitrary sub super meas vert horiz height width type BandedHermitian offDiag sh = Hermitian offDiag sh type Permutation sh = FlexPermutation Filled Filled sh type ShapeInt = ZeroBased Int shapeInt :: Int -> ShapeInt class (Box typ) => Transpose typ transpose :: (Transpose typ, Measure meas, C vert, C horiz) => (C width, C height, Floating a) => Matrix typ xl xu lower upper meas vert horiz height width a -> Matrix typ xu xl upper lower meas horiz vert width height a adjoint :: (Transpose typ, Complex typ) => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Matrix typ xl xu lower upper meas vert horiz height width a -> Matrix typ xu xl upper lower meas horiz vert width height a height :: (Box typ, Measure meas, C vert, C horiz) => Matrix typ xl xu lower upper meas vert horiz height width a -> height width :: (Box typ, Measure meas, C vert, C horiz) => Matrix typ xl xu lower upper meas vert horiz height width a -> width class Box typ indices :: (Box typ, Measure meas, C vert, C horiz) => (Indexed height, Indexed width) => Matrix typ xl xu lower upper meas vert horiz height width a -> [(Index height, Index width)] reshape :: (Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => (C heightA, C widthA) => (C heightB, C widthB) => Omni packB propB lowerB upperB measB vertB horizB heightB widthB -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB a mapShape :: (Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => (C heightA, C widthA) => (C heightB, C widthB) => (Omni packA propA lowerA upperA measA vertA horizA heightA widthA -> Omni packB propB lowerB upperB measB vertB horizB heightB widthB) -> ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a -> ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB a -- | Square matrices will be classified as Tall. caseTallWide :: (Measure meas, C vert, C horiz, C height, C width) => Full meas 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 :: (MapExtent typ xl xu lower upper, Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => Map measA vertA horizA measB vertB horizB height width -> Matrix typ xl xu lower upper measA vertA horizA height width a -> Matrix typ xl xu lower upper measB vertB horizB height width a fromFull :: (Measure meas, C vert, C horiz) => Full meas vert horiz height width a -> General height width a toFull :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> Full meas vert horiz height width a unpack :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix Unpacked property lower upper meas vert horiz height width a asGeneral :: Id (General height width a) asTall :: Id (Tall height width a) asWide :: Id (Wide height width a) tallFromGeneral :: (C height, C width, Storable a) => General height width a -> Tall height width a wideFromGeneral :: (C height, C width, Storable a) => General height width a -> Wide height width a generalizeTall :: (Measure meas, C vert, C horiz) => Full meas vert Small height width a -> Full Size vert horiz height width a generalizeWide :: (Measure meas, C vert, C horiz) => Full meas Small horiz height width a -> Full Size vert horiz height width a -- | The number of rows and columns must be maintained by the shape mapping -- function. mapHeight :: (MapSize typ, C vert, C horiz, C heightA, C heightB, C width) => (heightA -> heightB) -> Matrix typ extraLower extraUpper lower upper Size vert horiz heightA width a -> Matrix typ extraLower extraUpper lower upper Size vert horiz heightB width a mapWidth :: (MapSize typ, C vert, C horiz, C height, C widthA, C widthB) => (widthA -> widthB) -> Matrix typ extraLower extraUpper lower upper Size vert horiz height widthA a -> Matrix typ extraLower extraUpper lower upper Size vert horiz height widthB a -- | The number of rows and columns must be maintained by the shape mapping -- function. mapSquareSize :: (SquareShape typ, C shA, C shB) => (shA -> shB) -> Quadratic typ xl xu lower upper shA a -> Quadratic typ xl xu lower upper shB a identity :: (Quadratic pack property lower upper, C sh, Floating a) => Order -> sh -> Quadratic pack property lower upper sh a diagonal :: (Diagonal property, Quadratic pack property lower upper, C sh, Floating a) => Order -> Vector sh a -> Quadratic pack property lower upper sh a fromRowsNonEmpty :: (C width, Eq width, Storable a) => T [] (Vector width a) -> General ShapeInt 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 ShapeInt width a fromRowsNonEmptyContainer :: (f ~ T g, C g, C width, Eq width, Storable a) => f (Vector width a) -> General (Shape f) width a fromRowContainer :: (C f, C width, Eq width, Storable a) => width -> f (Vector width a) -> General (Shape f) width a fromColumnsNonEmpty :: (C height, Eq height, Storable a) => T [] (Vector height a) -> General height ShapeInt 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 ShapeInt a fromColumnsNonEmptyContainer :: (f ~ T g, C g, C height, Eq height, Storable a) => f (Vector height a) -> General height (Shape f) a fromColumnContainer :: (C f, C height, Eq height, Storable a) => height -> f (Vector height a) -> General height (Shape f) 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 liftRow :: Order -> (Vector height0 a -> Vector height1 b) -> General () height0 a -> General () height1 b liftColumn :: Order -> (Vector height0 a -> Vector height1 b) -> General height0 () a -> General height1 () b unliftRow :: Order -> (General () height0 a -> General () height1 b) -> Vector height0 a -> Vector height1 b unliftColumn :: Order -> (General height0 () a -> General height1 () b) -> Vector height0 a -> Vector height1 b toRows :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> [Vector width a] toColumns :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> [Vector height a] toRowArray :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> Array height (Vector width a) toColumnArray :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> Array width (Vector height a) toRowContainer :: (Measure meas, C vert, C horiz, C f, C width, Floating a) => Full meas vert horiz (Shape f) width a -> f (Vector width a) toColumnContainer :: (Measure meas, C vert, C horiz, C height, C f, Floating a) => Full meas vert horiz height (Shape f) a -> f (Vector height a) takeRow :: (Measure meas, C vert, C horiz, Indexed height, C width, Index height ~ ix, Floating a) => Full meas vert horiz height width a -> ix -> Vector width a takeColumn :: (Measure meas, C vert, C horiz, C height, Indexed width, Index width ~ ix, Floating a) => Full meas vert horiz height width a -> ix -> Vector height a takeRows :: (C vert, C width, Floating a) => Int -> Full Size vert Big ShapeInt width a -> Full Size vert Big ShapeInt width a takeColumns :: (C horiz, C height, Floating a) => Int -> Full Size Big horiz height ShapeInt a -> Full Size Big horiz height ShapeInt 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 :: (Measure meas, C vert, C horiz, Floating a) => Int -> Full meas vert horiz ShapeInt ShapeInt a -> Full meas vert horiz ShapeInt ShapeInt a dropRows :: (C vert, C width, Floating a) => Int -> Full Size vert Big ShapeInt width a -> Full Size vert Big ShapeInt width a dropColumns :: (C horiz, C height, Floating a) => Int -> Full Size Big horiz height ShapeInt a -> Full Size Big horiz height ShapeInt 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 :: (Measure meas, C vert, C horiz, Floating a) => Int -> Full meas vert horiz ShapeInt ShapeInt a -> Full meas vert horiz ShapeInt ShapeInt a takeTop :: (C vert, C height0, C height1, C width, Floating a) => Full Size vert Big (height0 ::+ height1) width a -> Full Size vert Big height0 width a takeBottom :: (C vert, C height0, C height1, C width, Floating a) => Full Size vert Big (height0 ::+ height1) width a -> Full Size vert Big height1 width a takeLeft :: (C vert, C height, C width0, C width1, Floating a) => Full Size Big vert height (width0 ::+ width1) a -> Full Size Big vert height width0 a takeRight :: (C vert, C height, C width0, C width1, Floating a) => Full Size Big vert height (width0 ::+ width1) a -> Full Size Big vert height width1 a -- | The function is optimized for blocks of consecutive rows. For -- scattered rows in column major order the function has quite ugly -- memory access patterns. takeRowArray :: (Indexed height, C width, C sh, Floating a) => Array sh (Index height) -> General height width a -> General sh width a takeColumnArray :: (C height, Indexed width, C sh, Floating a) => Array sh (Index width) -> General height width a -> General height sh a swapRows :: (Measure meas, C vert, C horiz, Indexed height, C width, Floating a) => Index height -> Index height -> Full meas vert horiz height width a -> Full meas vert horiz height width a swapColumns :: (Measure meas, C vert, C horiz, C height, Indexed width, Floating a) => Index width -> Index width -> Full meas vert horiz height width a -> Full meas vert horiz height width a reverseRows :: (Measure meas, C vert, C horiz, Permutable height, C width, Floating a) => Full meas vert horiz height width a -> Full meas vert horiz height width a reverseColumns :: (Measure meas, C vert, C horiz, C height, Permutable width, Floating a) => Full meas vert horiz height width a -> Full meas vert horiz height width a fromRowMajor :: (C height, C width, Floating a) => Array (height, width) a -> General height width a toRowMajor :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> Array (height, width) a forceOrder :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Order -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -- | adaptOrder x y contains the data of y with the -- layout of x. adaptOrder :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a data OrderBias -- | Use the element order of the first operand. leftBias :: OrderBias -- | Use the element order of the second operand. rightBias :: OrderBias -- | Choose element order such that, if possible, one part can be copied as -- one block. For above this means that RowMajor is -- chosen whenever at least one operand is RowMajor and -- ColumnMajor is chosen when both operands are -- ColumnMajor. contiguousBias :: OrderBias (|||) :: (C vertA, C vertB, C vertC, Append vertA vertB ~ vertC, C height, Eq height, C widthA, C widthB, Floating a) => Full Size vertA Big height widthA a -> Full Size vertB Big height widthB a -> Full Size vertC Big height (widthA ::+ widthB) a infixr 3 ||| beside :: (C vertA, C vertB, C vertC, C height, Eq height, C widthA, C widthB, Floating a) => OrderBias -> AppendMode vertA vertB vertC height widthA widthB -> Full Size vertA Big height widthA a -> Full Size vertB Big height widthB a -> Full Size vertC Big height (widthA ::+ widthB) a (===) :: (C horizA, C horizB, C horizC, Append horizA horizB ~ horizC, C width, Eq width, C heightA, C heightB, Floating a) => Full Size Big horizA heightA width a -> Full Size Big horizB heightB width a -> Full Size Big horizC (heightA ::+ heightB) width a infixr 2 === above :: (C horizA, C horizB, C horizC, C width, Eq width, C heightA, C heightB, Floating a) => OrderBias -> AppendMode horizA horizB horizC width heightA heightB -> Full Size Big horizA heightA width a -> Full Size Big horizB heightB width a -> Full Size Big horizC (heightA ::+ heightB) width a stack :: (Measure meas, C vert, C horiz, C heightA, Eq heightA, C heightB, Eq heightB, C widthA, Eq widthA, C widthB, Eq widthB, Floating a) => Full meas vert horiz heightA widthA a -> General heightA widthB a -> General heightB widthA a -> Full meas vert horiz heightB widthB a -> Full meas vert horiz (heightA ::+ heightB) (widthA ::+ widthB) a (|*-) :: (C height, Eq height, C width, Eq width, Floating a) => Vector height a -> Vector width a -> General height width a infixl 7 |*- -- |
--   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 kronecker :: (Measure meas, C vert, C horiz, C heightA, C widthA, C heightB, C widthB, Floating a) => Full meas vert horiz heightA widthA a -> Full meas vert horiz heightB widthB a -> Full meas vert horiz (heightA, heightB) (widthA, widthB) 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 map :: (Measure meas, C vert, C horiz, C height, C width, Storable a, Storable b) => (a -> b) -> Full meas vert horiz height width a -> Full meas vert horiz height width b class Complex typ conjugate :: (Complex typ, Matrix typ xl xu lower upper meas vert horiz height width ~ matrix, Measure meas, C vert, C horiz, C height, C width, Floating a) => matrix a -> matrix a fromReal :: (Complex typ, Matrix typ xl xu lower upper meas vert horiz height width ~ matrix, Measure meas, C vert, C horiz, C height, C width, Floating a) => matrix (RealOf a) -> matrix a toComplex :: (Complex typ, Matrix typ xl xu lower upper meas vert horiz height width ~ matrix, Measure meas, C vert, C horiz, C height, C width, Floating a) => matrix a -> matrix (ComplexOf a) class (Box typ) => SquareShape typ toSquare :: (SquareShape typ, C sh, Floating a) => Quadratic typ xl xu lower upper sh a -> Square sh a identityFromShape :: (C sh, Floating a) => Quadratic pack property lower upper sh -> Quadratic pack property lower upper sh a identityFrom :: (SquareShape typ, C sh, Floating a) => Quadratic typ xl xu lower upper sh a -> Quadratic typ xl xu lower upper sh a takeDiagonal :: (SquareShape typ, C sh, Floating a) => Quadratic typ xl xu lower upper sh a -> Vector sh a trace :: (SquareShape typ, C sh, Floating a) => Quadratic typ xl xu lower upper sh a -> a type family RealOf x rowSums :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> Vector height a columnSums :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> Vector width a rowArgAbsMaximums :: (Measure meas, C vert, C horiz, C height, InvIndexed width, Index width ~ ix, Storable ix, Floating a) => Full meas vert horiz height width a -> (Vector height ix, Vector height a) columnArgAbsMaximums :: (Measure meas, C vert, C horiz, InvIndexed height, C width, Index height ~ ix, Storable ix, Floating a) => Full meas vert horiz height width a -> (Vector width ix, Vector width a) scaleRows :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a scaleColumns :: (Measure meas, C vert, C horiz, C height, C width, Eq width, Floating a) => Vector width a -> Full meas vert horiz height width a -> Full meas vert horiz height width a scaleRowsReal :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height (RealOf a) -> Full meas vert horiz height width a -> Full meas vert horiz height width a scaleColumnsReal :: (Measure meas, C vert, C horiz, C height, C width, Eq width, Floating a) => Vector width (RealOf a) -> Full meas vert horiz height width a -> Full meas vert horiz height width a (\*#) :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a infixr 7 \*# (#*\) :: (Measure meas, C vert, C horiz, C height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Vector width a -> Full meas vert horiz height width a infixl 7 #*\ (\\#) :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a infixr 7 \\# (#/\) :: (Measure meas, C vert, C horiz, C height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Vector width a -> Full meas vert horiz height width a infixl 7 #/\ multiply :: (Measure meas, C vert, C horiz, C height, C fuse, Eq fuse, C width, Floating a) => Full meas vert horiz height fuse a -> Full meas vert horiz fuse width a -> Full meas vert horiz height width a multiplyVector :: (Measure meas, C vert, C horiz, C height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Vector width a -> Vector height a class (Box typ) => ToQuadratic typ zero :: Homogeneous property => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Omni pack property lower upper meas vert horiz height width -> ArrayMatrix pack property lower upper meas vert horiz height width a negate :: Homogeneous property => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a scale :: (Measure meas, C vert, C horiz) => (Scale property, C height, C width, Floating a) => a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a scaleReal :: Homogeneous property => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => RealOf a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a scaleRealReal :: Homogeneous property => (Measure meas, C vert, C horiz) => (C height, C width, Real a) => a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a (.*#) :: (Measure meas, C vert, C horiz) => (Scale property, C height, C width, Floating a) => a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 7 .*# add :: (Measure meas, C vert, C horiz) => (Additive property, C height, Eq height, C width, Eq width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 6 `add` sub :: (Measure meas, C vert, C horiz) => (Subtractive property, C height, Eq height, C width, Eq width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 6 `sub` (#+#) :: (Measure meas, C vert, C horiz) => (Additive property, C height, Eq height, C width, Eq width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 6 #+# (#-#) :: (Measure meas, C vert, C horiz) => (Subtractive property, C height, Eq height, C width, Eq width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a -> ArrayMatrix pack property lower upper meas vert horiz height width a infixl 6 #-# class (Box typA, Box typB) => Multiply typA xlA xuA typB xlB xuB lowerC upperC measC (#*#) :: (Box typA, Strip lowerA, Strip upperA) => (Box typB, Strip lowerB, Strip upperB) => (Box typC, Strip lowerC, Strip upperC) => Multiply typA xlA xuA typB xlB xuB lowerC upperC measC => Multiplied typA xlA xuA typB xlB xuB lowerC upperC measC ~ typC => MultipliedExtra typA xlA xuA typB xlB xuB ~ xlC => MultipliedExtra typA xuA xlA typB xuB xlB ~ xuC => MultipliedStrip lowerA lowerB ~ lowerC => MultipliedStrip lowerB lowerA ~ lowerC => MultipliedStrip upperA upperB ~ upperC => MultipliedStrip upperB upperA ~ upperC => MultipliedBands lowerA lowerB ~ lowerC => MultipliedBands lowerB lowerA ~ lowerC => MultipliedBands upperA upperB ~ upperC => MultipliedBands upperB upperA ~ upperC => (Measure measA, C vertA, C horizA) => (Measure measB, C vertB, C horizB) => MultiplyMeasure measA measB ~ measC => MultiplyMeasure measB measA ~ measC => Multiply vertA vertB ~ vertC => Multiply vertB vertA ~ vertC => Multiply horizA horizB ~ horizC => Multiply horizB horizA ~ horizC => (C height, C fuse, Eq fuse, C width) => Floating a => Matrix typA xlA xuA lowerA upperA measA vertA horizA height fuse a -> Matrix typB xlB xuB lowerB upperB measB vertB horizB fuse width a -> Matrix typC xlC xuC lowerC upperC measC vertC horizC height width a infixl 7 #*# class (Box typ) => MultiplyVector typ xl xu (#*|) :: (MultiplyVector typ xl xu, Strip lower, Strip upper) => (Measure meas, C vert, C horiz, C height, C width, Eq width, Floating a) => Matrix typ xl xu lower upper meas vert horiz height width a -> Vector width a -> Vector height a infixr 7 #*| (-*#) :: (MultiplyVector typ xl xu, Strip lower, Strip upper) => (Measure meas, C vert, C horiz, C height, C width, Eq height, Floating a) => Vector height a -> Matrix typ xl xu lower upper meas vert horiz height width a -> Vector width a infixl 7 -*# class (Box typ) => MultiplySquare typ xl xu multiplySquare :: MultiplySquare typ xl xu => (Strip lower, Strip upper) => (Measure meas, C vert, C horiz, C height, Eq height, C width, Floating a) => Transposition -> Quadratic typ xl xu lower upper height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a class (Box typ) => Power typ xl xu square :: (Power typ xl xu, PowerStrip lower, PowerStrip upper) => (C sh, Floating a) => Quadratic typ xl xu lower upper sh a -> Quadratic typ xl xu lower upper sh a power :: (Power typ xl xu, PowerStrip lower, PowerStrip upper) => (C sh, Floating a) => Integer -> Quadratic typ xl xu lower upper sh a -> Quadratic typ xl xu lower upper sh a powers :: (Power typ xl xu, SquareShape typ) => (PowerStrip lower, PowerStrip upper) => (C sh, Floating a) => Quadratic typ xl xu lower upper sh a -> Stream (Quadratic typ xl xu lower upper sh a) powers1 :: (Power typ xl xu, PowerStrip lower, PowerStrip upper) => (C sh, Floating a) => Quadratic typ xl xu lower upper sh a -> Stream (Quadratic typ xl xu lower upper sh a) (##*#) :: (MultiplySquare typ xl xu, ToQuadratic typ) => (Strip lowerA, Strip upperA) => (Strip lowerB, Strip upperB) => (Strip lowerC, Strip upperC) => MultipliedBands lowerA lowerB ~ lowerC => MultipliedBands lowerB lowerA ~ lowerC => MultipliedBands upperA upperB ~ upperC => MultipliedBands upperB upperA ~ upperC => (Measure measA, Measure measB, Measure measC, MultiplyMeasure measA measB ~ measC) => (C vert, C horiz) => (C height, C fuse, Eq fuse, C width, Floating a) => Unpacked lowerB upperB measB vert horiz height fuse a -> QuadraticMeas typ xl xu lowerA upperA measA fuse width a -> Unpacked lowerC upperC measC vert horiz height width a infixl 7 ##*# (#*##) :: (MultiplySquare typ xl xu, ToQuadratic typ) => (Strip lowerA, Strip upperA) => (Strip lowerB, Strip upperB) => (Strip lowerC, Strip upperC) => MultipliedBands lowerA lowerB ~ lowerC => MultipliedBands lowerB lowerA ~ lowerC => MultipliedBands upperA upperB ~ upperC => MultipliedBands upperB upperA ~ upperC => (Measure measA, Measure measB, Measure measC, MultiplyMeasure measA measB ~ measC) => (C vert, C horiz) => (C height, C fuse, Eq fuse, C width, Floating a) => QuadraticMeas typ xl xu lowerA upperA measA height fuse a -> Unpacked lowerB upperB measB vert horiz fuse width a -> Unpacked lowerC upperC measC vert horiz height width a infixr 7 #*## class (Box typ) => Indexed typ (#!) :: (Indexed typ, Measure meas, C vert, C horiz, Indexed height, Indexed width, Floating a) => Matrix typ xl xu lower upper meas vert horiz height width a -> (Index height, Index width) -> a infixl 9 #! class (Box typ) => Determinant typ xl xu determinant :: (Determinant typ xl xu, Strip lower, Strip upper) => (C sh, Floating a) => Quadratic typ xl xu lower upper sh a -> a class (Box typ) => Solve typ xl xu solve :: (Solve typ xl xu, Strip lower, Strip upper) => (Measure meas, C vert, C horiz) => (C height, C width, Eq height, Floating a) => Transposition -> Quadratic typ xl xu lower upper height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a solveLeft :: (Solve typ xl xu, Strip lower, Strip upper) => (Measure meas, C vert, C horiz) => (C height, C width, Eq width, Floating a) => Full meas vert horiz height width a -> Quadratic typ xl xu lower upper width a -> Full meas vert horiz height width a solveRight :: (Solve typ xl xu, Strip lower, Strip upper) => (Measure meas, C vert, C horiz) => (C height, C width, Eq height, Floating a) => Quadratic typ xl xu lower upper height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a (##/#) :: (Solve typ xl xu, ToQuadratic typ, Strip lower, Strip upper, C height, C width, Eq width, C nrhs, Measure measA, Measure measB, Measure measC, MultiplyMeasure measA measB ~ measC, C vert, C horiz, Floating a) => Full measB vert horiz nrhs width a -> QuadraticMeas typ xl xu lower upper measA height width a -> Full measC vert horiz nrhs height a infixl 7 ##/# (#\##) :: (Solve typ xl xu, ToQuadratic typ, Strip lower, Strip upper, C height, Eq height, C width, C nrhs, Measure measA, Measure measB, Measure measC, MultiplyMeasure measA measB ~ measC, C vert, C horiz, Floating a) => QuadraticMeas typ xl xu lower upper measA height width a -> Full measB vert horiz height nrhs a -> Full measC vert horiz width nrhs a infixr 7 #\## solveVector :: (Solve typ xl xu, Strip lower, Strip upper, C sh, Eq sh, Floating a) => Transposition -> Quadratic typ xl xu lower upper sh a -> Vector sh a -> Vector sh a (-/#) :: (Solve typ xl xu, ToQuadratic typ, Strip lower, Strip upper, Measure meas, C height, C width, Eq width, Floating a) => Vector width a -> QuadraticMeas typ xl xu lower upper meas height width a -> Vector height a infixl 7 -/# (#\|) :: (Solve typ xl xu, ToQuadratic typ, Strip lower, Strip upper, Measure meas, C height, C width, Eq height, Floating a) => QuadraticMeas typ xl xu lower upper meas height width a -> Vector height a -> Vector width a infixr 7 #\| class (Solve typ xl xu) => Inverse typ xl xu inverse :: (Inverse typ xl xu, PowerStrip lower, PowerStrip upper, Measure meas, C height, C width, Floating a) => QuadraticMeas typ xl xu lower upper meas height width a -> QuadraticMeas typ xl xu lower upper meas width height a data Transposition NonTransposed :: Transposition Transposed :: Transposition module Numeric.LAPACK.Singular values :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Full meas vert horiz height width a -> RectangularDiagonal meas vert horiz height width (RealOf a) valuesTall :: (Measure meas, C vert, C height, C width, Floating a) => Full meas vert Small height width a -> RealVector width a valuesWide :: (Measure meas, C horiz, C height, C width, Floating a) => Full meas Small horiz height width a -> RealVector height a decompose :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Full meas vert horiz height width a -> (Square height a, RectangularDiagonal meas vert horiz height width (RealOf a), Square width a) -- |
--   let (u,s,vt) = Singular.decomposeTall a
--   in a  ==  u ##*# Matrix.scaleRowsReal s vt
--   
decomposeTall :: (Measure meas, C vert, C height, C width, Floating a) => Full meas vert Small height width a -> (Full meas vert Small height width a, RealVector width a, Square width a) -- |
--   let (u,s,vt) = Singular.decomposeWide a
--   in a  ==  u #*## Matrix.scaleRowsReal s vt
--   
decomposeWide :: (Measure meas, C horiz, C height, C width, Floating a) => Full meas Small horiz height width a -> (Square height a, RealVector height a, Full meas Small horiz height width a) determinantAbsolute :: (C height, C width, Floating a) => General height width a -> RealOf a leastSquaresMinimumNormRCond :: (Measure meas, C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => RealOf a -> Full meas horiz vert height width a -> Full meas vert horiz height nrhs a -> (Int, Full meas vert horiz width nrhs a) pseudoInverseRCond :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => RealOf a -> Full meas vert horiz height width a -> (Int, Full meas horiz vert width height a) -- | In decomposePolar a = (u,h), u is the orthogonal -- matrix closest to a with respect to the 2- and the Frobenius -- norm. (Higham: Functions of Matrices - Theory and Computation.) decomposePolar :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> (Full meas vert horiz height width a, Hermitian width a) type family RealOf x -- | This module provides an infix operator and some data constructors that -- shall resemble mathematical notation. E.g. you can write a#^T -- for Matrix.transpose a. It is clearly abuse of the type -- system because I suspect you will never write algorithms that are -- generic in the superscript type. module Numeric.LAPACK.Matrix.Superscript -- | left associative in contrast to ^, ^^ etc. because there is no law -- analogous to power law (x^a)^b = x^(a*b). class Superscript sup where { data family Exponent sup typA xlA xuA lowerA upperA measA vertA horizA heightA widthA typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a; } (#^) :: (Superscript sup, Measure measA, C vertA, C horizA) => (C widthA, C heightA) => (Measure measB, C vertB, C horizB) => (C widthB, C heightB) => Floating a => Matrix typA xlA xuA lowerA upperA measA vertA horizA heightA widthA a -> Exponent sup typA xlA xuA lowerA upperA measA vertA horizA heightA widthA typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a -> Matrix typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a infixl 8 #^ data None data Transpose data Adjoint data Conjugate data Inverse data PseudoInverse data Power instance Numeric.LAPACK.Matrix.Superscript.Superscript Numeric.LAPACK.Matrix.Superscript.Power instance Numeric.LAPACK.Matrix.Superscript.Superscript Numeric.LAPACK.Matrix.Superscript.PseudoInverse instance Numeric.LAPACK.Matrix.Superscript.Superscript Numeric.LAPACK.Matrix.Superscript.Inverse instance Numeric.LAPACK.Matrix.Superscript.Superscript Numeric.LAPACK.Matrix.Superscript.Conjugate instance Numeric.LAPACK.Matrix.Superscript.Superscript Numeric.LAPACK.Matrix.Superscript.Adjoint instance Numeric.LAPACK.Matrix.Superscript.Superscript Numeric.LAPACK.Matrix.Superscript.Transpose instance Numeric.LAPACK.Matrix.Superscript.Superscript Numeric.LAPACK.Matrix.Superscript.None module Numeric.LAPACK.Matrix.Function class (Property property) => SqRt property sqrt :: (SqRt property, Packing pack, PowerStrip lower, PowerStrip upper, C sh, Real a) => Quadratic pack property lower upper sh a -> Quadratic pack property lower upper sh a -- | Square root solver that works on the Schur decomposition. -- -- Schur decomposition enables computing the square root of (some) -- singular matrices like ((1,0),(0,0)). However, the Schur -- decomposition might emit small negative values on the diagonal, where -- exact computation would yield zeros. This would let the square root -- solver fail. And there are singular matrices that have no square root, -- at all, e.g. ((0,1),(0,0)). -- -- The solver is restricted to a real triangular Schur matrix. The check -- for non-real eigenvalues may exclude matrices that actually have a -- real-valued square root. E.g. sqrt ((0,-2),(2,0)) = -- ((1,-1),(1,-1)) -- -- In the future we might fix this by solving 2x2 blocks at the diagonal -- using sqrt2. sqrtSchur :: (C sh, Real a) => Square sh a -> Square sh a -- | Iterative square root solver, similar to Newton iteration. -- -- Eigenvalues must all be positive, otherwise, the iteration might loop -- forever, or if an eigenvalue is zero, the computation of matrix -- inverse will fail. sqrtDenmanBeavers :: (Homogeneous prop, Additive prop) => (Packing pack, PowerStrip lower, PowerStrip upper) => (C sh, Floating a, RealOf a ~ ar, Real ar) => Quadratic pack prop lower upper sh a -> Quadratic pack prop lower upper sh a class (Property property) => Exp property exp :: (Exp property, Packing pack, PowerStrip lower, PowerStrip upper, C sh, Floating a) => Quadratic pack property lower upper sh a -> Quadratic pack property lower upper sh a -- | Mathematically the name expRealSymmetric would be more -- common, but we support definiteness tags only for the -- Hermitian type. Formally the result is always positive -- definite, but negative eigenvalues easily yield numerically singular -- matrices as result. expRealHermitian :: (Packing pack, C sh, Real a) => HermitianP pack sh a -> HermitianPosSemidefP pack sh a class (Property property) => Log property log :: (Log property, Packing pack, PowerStrip lower, PowerStrip upper, C sh, Real a) => Quadratic pack property lower upper sh a -> Quadratic pack property lower upper sh a logUnipotentUpper :: (Packing pack, C sh, Floating a) => UnitUpperP pack sh a -> UpperP pack sh a class (Property property) => LiftReal property -- | Lift any function with a Taylor expansion to a diagonalizable matrix. liftReal :: (LiftReal property, Packing pack, PowerStrip lower, PowerStrip upper, C sh, Real a) => (a -> a) -> Quadratic pack property lower upper sh a -> Quadratic pack property lower upper sh a instance Numeric.LAPACK.Matrix.Function.Log Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance (neg GHC.Types.~ Type.Data.Bool.True, zero GHC.Types.~ Type.Data.Bool.True, pos GHC.Types.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.Log (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) instance Numeric.LAPACK.Matrix.Function.Log Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance Numeric.LAPACK.Matrix.Function.LiftReal Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance (neg GHC.Types.~ Type.Data.Bool.True, zero GHC.Types.~ Type.Data.Bool.True, pos GHC.Types.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.LiftReal (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) instance Numeric.LAPACK.Matrix.Function.LiftReal Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance Numeric.LAPACK.Matrix.Function.Exp Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance (neg GHC.Types.~ Type.Data.Bool.True, zero GHC.Types.~ Type.Data.Bool.True, pos GHC.Types.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.Exp (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) instance Numeric.LAPACK.Matrix.Function.Exp Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance Numeric.LAPACK.Matrix.Function.SqRt Numeric.LAPACK.Matrix.Shape.Omni.Unit instance Numeric.LAPACK.Matrix.Function.SqRt Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary instance Numeric.LAPACK.Matrix.Function.SqRt Numeric.LAPACK.Matrix.Shape.Omni.Symmetric instance (neg GHC.Types.~ Type.Data.Bool.False, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Function.SqRt (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) module Numeric.LAPACK.Linear.LowerUpper type LowerUpper = LowerUpperFlex Filled Filled type Tall height width = LowerUpper Size Big Small height width type Wide height width = LowerUpper Size Small Big height width type Square sh = SquareMeas Shape sh sh type LiberalSquare height width = SquareMeas Size height width 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 measA vertA horizA measB vertB horizB height width -> LowerUpperFlex lower upper measA vertA horizA height width a -> LowerUpperFlex lower upper measB 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 whether -- a is tall or wide. -- --
--   LU.multiplyP NonInverted lu $ LU.extractL lu ##*# LU.tallExtractU lu
--   LU.multiplyP NonInverted lu $ LU.wideExtractL lu #*## LU.extractU lu
--   
fromMatrix :: (Measure meas, C vert, C horiz, C height, C width, Floating a) => Full meas vert horiz height width a -> LowerUpper meas vert horiz height width a toMatrix :: (Measure meas, C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => LowerUpper meas vert horiz height width a -> Full meas vert horiz height width a solve :: (Measure meas, C vert, C horiz, Eq height, C height, C width, Floating a) => Square height a -> Full meas vert horiz height width a -> Full meas vert horiz height width a multiplyFull :: (Measure meas, C vert, C horiz, C height, Eq height, C width, C fuse, Eq fuse, Floating a) => LowerUpper meas vert horiz height fuse a -> Full meas vert horiz fuse width a -> Full meas vert horiz height width a -- | Caution: LU.determinant . LU.fromMatrix will fail for -- singular matrices. determinant :: (Measure meas, C height, C width, Floating a) => LowerUpperFlex lower upper meas Small Small height width a -> a extractP :: (Measure meas, C vert, C horiz, Permutable height, C width) => Inversion -> LowerUpper meas vert horiz height width a -> Permutation height a multiplyP :: (Measure measA, C vertA, C horizA, Measure measB, C vertB, C horizB, Eq height, Permutable height, C widthA, C widthB, Floating a) => Inversion -> LowerUpper measA vertA horizA height widthA a -> Full measB vertB horizB height widthB a -> Full measB vertB horizB height widthB a extractL :: (Measure meas, C vert, C horiz, Permutable height, Permutable width, Floating a) => LowerUpper meas vert horiz height width a -> LowerTrapezoid meas vert horiz height width a wideExtractL :: (Measure meas, C horiz, Permutable height, C width, Floating a) => LowerUpper meas 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 NonTransposed lu a == wideExtractL lu #*## a
--   wideMultiplyL Transposed lu a == Tri.transpose (wideExtractL lu) #*## a
--   
wideMultiplyL :: (Measure measA, C horizA, Measure meas, C vert, C horiz, Permutable height, Eq height, C widthA, C widthB, Floating a) => Transposition -> LowerUpper measA Small horizA height widthA a -> Full meas vert horiz height widthB a -> Full meas vert horiz height widthB a wideSolveL :: (Measure measA, C horizA, Measure meas, C vert, C horiz, Permutable height, Eq height, C width, C nrhs, Floating a) => Transposition -> Conjugation -> LowerUpper measA Small horizA height width a -> Full meas vert horiz height nrhs a -> Full meas vert horiz height nrhs a extractU :: (Measure meas, C vert, C horiz, Permutable height, Permutable width, Floating a) => LowerUpper meas vert horiz height width a -> UpperTrapezoid meas vert horiz height width a tallExtractU :: (Measure meas, C vert, C height, Permutable width, Floating a) => LowerUpper meas 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 NonTransposed lu a == tallExtractU lu #*## a
--   tallMultiplyU Transposed lu a == Tri.transpose (tallExtractU lu) #*## a
--   
tallMultiplyU :: (Measure measA, C vertA, Measure meas, C vert, C horiz, Permutable height, Eq height, C heightA, C widthB, Floating a) => Transposition -> LowerUpper measA vertA Small heightA height a -> Full meas vert horiz height widthB a -> Full meas vert horiz height widthB a tallSolveU :: (Measure measA, C vertA, Measure meas, C vert, C horiz, C height, Permutable width, Eq width, C nrhs, Floating a) => Transposition -> Conjugation -> LowerUpper measA vertA Small height width a -> Full meas vert horiz width nrhs a -> Full meas vert horiz width nrhs a caseTallWide :: (Measure meas, C vert, C horiz, C height, C width) => LowerUpperFlex lower upper meas vert horiz height width a -> Either (Tall height width a) (Wide height width a) module Numeric.LAPACK.Format (##) :: Format a => a -> String -> IO () infix 0 ## print :: Format a => String -> a -> IO () hyper :: Format a => String -> a -> Graphic class Format a format :: (Format a, Output out) => String -> a -> out class (C sh) => FormatArray sh formatArray :: (FormatArray sh, Floating a, Output out) => String -> Array sh a -> out class FormatMatrix typ formatMatrix :: (FormatMatrix typ, Measure meas, C vert, C horiz, C width, C height, Floating a, Output out) => String -> Matrix typ xl xu lower upper meas vert horiz height width a -> out deflt :: String instance Numeric.LAPACK.Format.Format GHC.Types.Int instance Numeric.LAPACK.Format.Format GHC.Types.Float instance Numeric.LAPACK.Format.Format GHC.Types.Double instance Numeric.Netlib.Class.Real a => Numeric.LAPACK.Format.Format (Data.Complex.Complex a) instance Numeric.LAPACK.Format.Format a => Numeric.LAPACK.Format.Format [a] instance (Numeric.LAPACK.Format.Format a, Numeric.LAPACK.Format.Format b) => Numeric.LAPACK.Format.Format (a, b) instance (Numeric.LAPACK.Format.Format a, Numeric.LAPACK.Format.Format b, Numeric.LAPACK.Format.Format c) => Numeric.LAPACK.Format.Format (a, b, c) instance Data.Array.Comfort.Shape.C sh => Numeric.LAPACK.Format.Format (Numeric.LAPACK.Permutation.Private.Permutation sh) instance (Numeric.LAPACK.Matrix.Plain.Format.FormatArray sh, Numeric.Netlib.Class.Floating a) => Numeric.LAPACK.Format.Format (Data.Array.Comfort.Storable.Private.Array sh a) instance (Numeric.LAPACK.Matrix.Type.FormatMatrix typ, Numeric.LAPACK.Matrix.Extent.Private.Measure meas, Numeric.LAPACK.Matrix.Extent.Private.C vert, Numeric.LAPACK.Matrix.Extent.Private.C horiz, Data.Array.Comfort.Shape.C width, Data.Array.Comfort.Shape.C height, Numeric.Netlib.Class.Floating a) => Numeric.LAPACK.Format.Format (Numeric.LAPACK.Matrix.Type.Matrix typ xl xu lower upper meas vert horiz height width a) -- | Do not import this module. It is only for demonstration purposes. module Numeric.LAPACK.Example.EconomicAllocation type ZeroInt2 = ShapeInt ::+ ShapeInt type Vector sh = Vector sh Double type Matrix height width = General height width Double type SquareMatrix size = Square size Double balances0 :: Vector ZeroInt2 expenses0 :: Matrix ShapeInt ZeroInt2 normalize :: (Eq height, C height, C width) => Matrix height width -> Matrix height width normalizeSplit :: (C sh0, C sh1, Eq sh1) => Matrix sh1 (sh0 ::+ sh1) -> (Matrix sh0 sh1, SquareMatrix sh1) completeIdSquare :: (C sh0, Eq sh0, C sh1, Eq sh1) => Matrix sh1 (sh0 ::+ sh1) -> SquareMatrix (sh0 ::+ sh1) iterated :: (C sh0, Eq sh0, C sh1, Eq sh1) => Matrix sh1 (sh0 ::+ sh1) -> Vector (sh0 ::+ sh1) -> Vector (sh0 ::+ sh1) compensated :: (C sh0, Eq sh0, C sh1, Eq sh1) => Matrix sh1 (sh0 ::+ sh1) -> Vector (sh0 ::+ sh1) -> Vector sh0 -- |
--   let result = iterated expenses0 balances0 in approxVector result $ compensated expenses0 balances0 +++ Vector.zero (Array.shape $ Vector.takeRight result)
--   
main :: IO () -- | This module demonstrates triangular matrices. -- -- It verifies that the divided difference scheme nicely fits into a -- triangular matrix, where function addition is mapped to matrix -- addition and function multiplication is mapped to matrix -- multiplication. -- -- http://en.wikipedia.org/wiki/Divided_difference module Numeric.LAPACK.Example.DividedDifference size :: Vector ShapeInt a -> Int subSlices :: Int -> Vector ShapeInt Float -> Vector ShapeInt Float parameterDifferences :: Vector ShapeInt Float -> [Vector ShapeInt Float] dividedDifferences :: Vector ShapeInt Float -> Vector ShapeInt Float -> [Vector ShapeInt Float] upperFromPyramid :: (C sh, Storable a) => sh -> [Vector sh a] -> Upper sh a -- |
--   QC.forAll genDD $ \(xs, (ys0,ys1)) -> approxArray (dividedDifferencesMatrix xs (ys0|+|ys1)) (dividedDifferencesMatrix xs ys0 #+# dividedDifferencesMatrix xs ys1)
--   
-- --
--   QC.forAll genDD $ \(xs, (ys0,ys1)) -> approxArray (dividedDifferencesMatrix xs (Vector.mul ys0 ys1)) (dividedDifferencesMatrix xs ys0 <> dividedDifferencesMatrix xs ys1)
--   
dividedDifferencesMatrix :: Vector ShapeInt Float -> Vector ShapeInt Float -> Upper ShapeInt Float -- |
--   QC.forAll (QC.choose (0,10)) $ \n -> let sh = shapeInt n in QC.forAll (Util.genDistinct [-10..10] [-10..10] sh) $ \xs -> approxArray (DD.parameterDifferencesMatrix xs) (DD.upperFromPyramid sh (Vector.zero sh : DD.parameterDifferences xs))
--   
parameterDifferencesMatrix :: Vector ShapeInt Float -> Upper ShapeInt Float main :: IO ()