-- 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: -- --
-- 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: -- --
-- (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: -- --
-- 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: -- --
-- 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: -- --
-- 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 ()