-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Numerical Linear Algebra using LAPACK -- -- This is a high-level interface to LAPACK. It provides solvers for -- simultaneous linear equations, linear least-squares problems, -- eigenvalue and singular value problems for matrices with certain kinds -- of structures. -- -- Features: -- -- -- -- See also: hmatrix. @package lapack @version 0.3.2 module Numeric.LAPACK.Matrix.Shape.Box class (C shape) => Box shape where { type family HeightOf shape; type family WidthOf shape; } height :: Box shape => shape -> HeightOf shape width :: Box shape => shape -> WidthOf shape indices :: (Box shape, HeightOf shape ~ height, Indexed height, WidthOf shape ~ width, Indexed width) => shape -> [(Index height, Index width)] module Numeric.LAPACK.Output class Output out text :: Output out => String -> out above :: Output out => out -> out -> out beside :: Output out => out -> out -> out formatRow :: Output out => [out] -> out formatColumn :: Output out => [out] -> out formatAligned :: (Output out, Foldable f) => [[f out]] -> out formatSeparateTriangle :: (Output out, Foldable f) => [[f out]] -> out (/+/) :: Output out => out -> out -> out (<+>) :: Output out => out -> out -> out hyper :: Html -> Graphic instance GHC.Show.Show Numeric.LAPACK.Output.Separator instance GHC.Classes.Ord Numeric.LAPACK.Output.Separator instance GHC.Classes.Eq Numeric.LAPACK.Output.Separator instance Numeric.LAPACK.Output.Output Text.PrettyPrint.Boxes.Box instance Numeric.LAPACK.Output.Output Numeric.LAPACK.Output.Html module Numeric.LAPACK.Shape -- | Uses the indices of the second shape, but the list of indices is -- restricted by the size of the first shape. data Min sh0 sh1 Min :: sh0 -> sh1 -> Min sh0 sh1 [minShape0] :: Min sh0 sh1 -> sh0 [minShape1] :: Min sh0 sh1 -> sh1 instance (GHC.Show.Show sh0, GHC.Show.Show sh1) => GHC.Show.Show (Numeric.LAPACK.Shape.Min sh0 sh1) instance (GHC.Classes.Eq sh0, GHC.Classes.Eq sh1) => GHC.Classes.Eq (Numeric.LAPACK.Shape.Min sh0 sh1) instance (Data.Array.Comfort.Shape.C sh0, Data.Array.Comfort.Shape.C sh1) => Data.Array.Comfort.Shape.C (Numeric.LAPACK.Shape.Min sh0 sh1) instance (Data.Array.Comfort.Shape.C sh0, Data.Array.Comfort.Shape.Indexed sh1) => Data.Array.Comfort.Shape.Indexed (Numeric.LAPACK.Shape.Min sh0 sh1) instance (Data.Array.Comfort.Shape.C sh0, Data.Array.Comfort.Shape.InvIndexed sh1) => Data.Array.Comfort.Shape.InvIndexed (Numeric.LAPACK.Shape.Min sh0 sh1) module Numeric.LAPACK.Scalar type family RealOf x type ComplexOf x = Complex (RealOf x) zero :: Floating a => a one :: Floating a => a minusOne :: Floating a => a isZero :: Floating a => a -> Bool selectReal :: Real a => Float -> Double -> a selectFloating :: Floating a => Float -> Double -> Complex Float -> Complex Double -> a equal :: Floating a => a -> a -> Bool fromReal :: Floating a => RealOf a -> a toComplex :: Floating a => a -> ComplexOf a absolute :: Floating a => a -> RealOf a absoluteSquared :: Floating a => a -> RealOf a norm1 :: Floating a => a -> RealOf a realPart :: Floating a => a -> RealOf a conjugate :: Floating a => a -> a module Numeric.LAPACK.ShapeStatic -- | ZeroBased denotes a range starting at zero and has a certain -- length. newtype ZeroBased n ZeroBased :: UnaryProxy n -> ZeroBased n [zeroBasedSize] :: ZeroBased n -> UnaryProxy n vector :: (Natural n, Storable a) => T n a -> Array (ZeroBased n) a instance Type.Data.Num.Unary.Natural n => GHC.Show.Show (Numeric.LAPACK.ShapeStatic.ZeroBased n) instance GHC.Classes.Eq (Numeric.LAPACK.ShapeStatic.ZeroBased n) instance Type.Data.Num.Unary.Natural n => Data.Array.Comfort.Shape.C (Numeric.LAPACK.ShapeStatic.ZeroBased n) instance Type.Data.Num.Unary.Natural n => Data.Array.Comfort.Shape.Indexed (Numeric.LAPACK.ShapeStatic.ZeroBased n) instance Type.Data.Num.Unary.Natural n => Data.Array.Comfort.Shape.InvIndexed (Numeric.LAPACK.ShapeStatic.ZeroBased n) instance Type.Data.Num.Unary.Natural n => Data.Array.Comfort.Shape.Static (Numeric.LAPACK.ShapeStatic.ZeroBased n) module Numeric.LAPACK.Matrix.Shape type General height width = Full Big Big height width type Tall height width = Full Big Small height width type Wide height width = Full Small Big height width type Square size = Full Small Small size size data Full vert horiz height width Full :: Order -> Extent vert horiz height width -> Full vert horiz height width [fullOrder] :: Full vert horiz height width -> Order [fullExtent] :: Full vert horiz height width -> Extent vert horiz height width fullHeight :: (C vert, C horiz) => Full vert horiz height width -> height fullWidth :: (C vert, C horiz) => Full vert horiz height width -> width data Order RowMajor :: Order ColumnMajor :: Order flipOrder :: Order -> Order general :: Order -> height -> width -> General height width square :: Order -> sh -> Square sh wide :: (C height, C width) => Order -> height -> width -> Wide height width tall :: (C height, C width) => Order -> height -> width -> Tall height width data Split lower vert horiz height width type SplitGeneral lower height width = Split lower Big Big height width data Triangle Triangle :: Triangle data Reflector Reflector :: Reflector splitGeneral :: lower -> Order -> height -> width -> SplitGeneral lower height width splitFromFull :: lower -> Full vert horiz height width -> Split lower vert horiz height width -- | Store the upper triangular half of a real symmetric or complex -- Hermitian matrix. data Hermitian size Hermitian :: Order -> size -> Hermitian size [hermitianOrder] :: Hermitian size -> Order [hermitianSize] :: Hermitian size -> size hermitian :: Order -> size -> Hermitian size data Triangular lo diag up size Triangular :: diag -> (lo, up) -> Order -> size -> Triangular lo diag up size [triangularDiag] :: Triangular lo diag up size -> diag [triangularUplo] :: Triangular lo diag up size -> (lo, up) [triangularOrder] :: Triangular lo diag up size -> Order [triangularSize] :: Triangular lo diag up size -> size type Identity = Triangular Empty Unit Empty type Diagonal = Triangular Empty NonUnit Empty type LowerTriangular diag = Triangular Filled diag Empty type UpperTriangular diag = Triangular Empty diag Filled type Symmetric = FlexSymmetric NonUnit diagonal :: Order -> size -> Triangular Empty NonUnit Empty size lowerTriangular :: Order -> size -> LowerTriangular NonUnit size upperTriangular :: Order -> size -> UpperTriangular NonUnit size symmetric :: Order -> size -> Symmetric size autoDiag :: TriDiag diag => diag autoUplo :: (Content lo, Content up) => (lo, up) type DiagUpLo lo up = (DiagUpLoC lo up, DiagUpLoC up lo) switchDiagUpLo :: DiagUpLoC lo up => f Empty Empty -> f Empty Filled -> f Filled Empty -> f lo up switchDiagUpLoSym :: (Content lo, Content up) => f Empty Empty -> f Empty Filled -> f Filled Empty -> f Filled Filled -> f lo up class TriDiag diag switchTriDiag :: TriDiag diag => f Unit -> f NonUnit -> f diag data Unit Unit :: Unit data NonUnit NonUnit :: NonUnit data Banded sub super vert horiz height width Banded :: (UnaryProxy sub, UnaryProxy super) -> Order -> Extent vert horiz height width -> Banded sub super vert horiz height width [bandedOffDiagonals] :: Banded sub super vert horiz height width -> (UnaryProxy sub, UnaryProxy super) [bandedOrder] :: Banded sub super vert horiz height width -> Order [bandedExtent] :: Banded sub super vert horiz height width -> Extent vert horiz height width type BandedGeneral sub super = Banded sub super Big Big type BandedSquare sub super size = Banded sub super Small Small size size type BandedLowerTriangular sub size = BandedSquare sub U0 size type BandedUpperTriangular super size = BandedSquare U0 super size type BandedDiagonal size = BandedSquare U0 U0 size data BandedIndex row column InsideBox :: row -> column -> BandedIndex row column VertOutsideBox :: Int -> column -> BandedIndex row column HorizOutsideBox :: row -> Int -> BandedIndex row column bandedGeneral :: (UnaryProxy sub, UnaryProxy super) -> Order -> height -> width -> Banded sub super Big Big height width bandedSquare :: (UnaryProxy sub, UnaryProxy super) -> Order -> size -> Banded sub super Small Small size size bandedFromFull :: (UnaryProxy sub, UnaryProxy super) -> Full vert horiz height width -> Banded sub super vert horiz height width type UnaryProxy a = Proxy (Un a) addOffDiagonals :: (Natural subA, Natural superA, Natural subB, Natural superB, (subA :+: subB) ~ subC, (superA :+: superB) ~ superC) => (UnaryProxy subA, UnaryProxy superA) -> (UnaryProxy subB, UnaryProxy superB) -> ((Nat subC, Nat superC), (UnaryProxy subC, UnaryProxy superC)) class Content c data BandedHermitian off size BandedHermitian :: UnaryProxy off -> Order -> size -> BandedHermitian off size [bandedHermitianOffDiagonals] :: BandedHermitian off size -> UnaryProxy off [bandedHermitianOrder] :: BandedHermitian off size -> Order [bandedHermitianSize] :: BandedHermitian off size -> size bandedHermitian :: UnaryProxy off -> Order -> size -> BandedHermitian off size class (C shape) => Box shape type family HeightOf shape type family WidthOf shape height :: Box shape => shape -> HeightOf shape width :: Box shape => shape -> WidthOf shape module Numeric.LAPACK.Matrix.Extent class C tag switchTag :: C tag => f Small -> f Big -> f tag data family Extent vertical horizontal :: * -> * -> * data Map vertA horizA vertB horizB height width data Small data Big height :: (C vert, C horiz) => Extent vert horiz height width -> height width :: (C vert, C horiz) => Extent vert horiz height width -> width squareSize :: Extent Small Small height width -> height dimensions :: (C vert, C horiz) => Extent vert horiz height width -> (height, width) transpose :: (C vert, C horiz) => Extent vert horiz height width -> Extent horiz vert width height fuse :: (C vert, C horiz, Eq fuse) => Extent vert horiz height fuse -> Extent vert horiz fuse width -> Maybe (Extent vert horiz height width) square :: sh -> Square sh toGeneral :: (C vert, C horiz) => Map vert horiz Big Big height width fromSquare :: (C vert, C horiz) => Map Small Small vert horiz size size fromSquareLiberal :: (C vert, C horiz) => Map Small Small vert horiz height width generalizeTall :: (C vert, C horiz) => Map vert Small vert horiz height width generalizeWide :: (C vert, C horiz) => Map Small horiz vert horiz height width class (C vert, C horiz) => GeneralTallWide vert horiz 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 -- | 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 +++ take :: (Integral n, Storable a) => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a drop :: (Integral n, Storable a) => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a 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 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 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.Format (##) :: Format a => a -> String -> IO () infix 0 ## 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, Floating a, Output out) => String -> Matrix typ 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.Netlib.Class.Floating a) => Numeric.LAPACK.Format.Format (Numeric.LAPACK.Matrix.Type.Matrix typ a) module Numeric.LAPACK.Matrix.Array data family Matrix typ a type ArrayMatrix shape = Matrix (Array shape) data Array shape type Full vert horiz height width = ArrayMatrix (Full vert horiz height width) type General height width = ArrayMatrix (General height width) type Tall height width = ArrayMatrix (Tall height width) type Wide height width = ArrayMatrix (Wide height width) type Square sh = ArrayMatrix (Square sh) shape :: ArrayMatrix sh a -> sh reshape :: (C sh0, C sh1) => sh1 -> ArrayMatrix sh0 a -> ArrayMatrix sh1 a mapShape :: (C sh0, C sh1) => (sh0 -> sh1) -> ArrayMatrix sh0 a -> ArrayMatrix sh1 a toVector :: ArrayMatrix sh a -> Array sh a fromVector :: (Admissible sh, Floating a) => Array sh a -> ArrayMatrix sh 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 :: Array shA a -> ArrayMatrix shA a lift1 :: (Array shA a -> Array shB b) -> ArrayMatrix shA a -> ArrayMatrix shB b lift2 :: (Array shA a -> Array shB b -> Array shC c) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c lift3 :: (Array shA a -> Array shB b -> Array shC c -> Array shD d) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c -> ArrayMatrix shD d lift4 :: (Array shA a -> Array shB b -> Array shC c -> Array shD d -> Array shE e) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c -> ArrayMatrix shD d -> ArrayMatrix shE e unlift1 :: (ArrayMatrix shA a -> ArrayMatrix shB b) -> Array shA a -> Array shB b unlift2 :: (ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c) -> Array shA a -> Array shB b -> Array shC 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 class (C shape) => Homogeneous shape zero :: (Homogeneous shape, Floating a) => shape -> ArrayMatrix shape a negate :: (Homogeneous shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a scaleReal :: (Homogeneous shape, Floating a) => RealOf a -> ArrayMatrix shape a -> ArrayMatrix shape a scale :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a scaleRealReal :: (Homogeneous shape, Real a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a (.*#) :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 7 .*# class (C shape) => ShapeOrder shape forceOrder :: (ShapeOrder shape, Floating a) => Order -> ArrayMatrix shape a -> ArrayMatrix shape a shapeOrder :: ShapeOrder shape => shape -> Order -- | adaptOrder x y contains the data of y with the -- layout of x. adaptOrder :: (ShapeOrder shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a class (Homogeneous shape, Eq shape) => Additive shape add :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 6 `add` sub :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 6 `sub` (#+#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 6 #+# (#-#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 6 #-# class (C shape) => Complex shape class (Box shape, HeightOf shape ~ WidthOf shape) => SquareShape shape class (Box shape) => MultiplyVector shape class (SquareShape shape) => MultiplySquare shape class (SquareShape shape) => Power shape -- | This class allows to Basic.multiply two matrices of arbitrary special -- features and returns the most special matrix type possible. At the -- first glance, this is handy. At the second glance, this has some -- problems. First of all, we may refine the types in future and then -- multiplication may return a different, more special type than before. -- Second, if you write code with polymorphic matrix types, then -- matrixMatrix may leave you with constraints like -- ExtentPriv.Multiply vert vert ~ vert. That constraint is -- always fulfilled but the compiler cannot infer that. Because of these -- problems you may instead consider using specialised multiply -- functions from the various modules for production use. Btw. -- MultiplyVector and MultiplySquare are much less -- problematic, because the input and output are always dense vectors or -- dense matrices. class (C shapeA, C shapeB) => Multiply shapeA shapeB class (SquareShape shape) => Determinant shape class (SquareShape shape) => Solve shape class (Solve shape, Power shape) => Inverse shape instance (Data.Array.Comfort.Shape.C shape, Foreign.Storable.Storable a, GHC.Show.Show shape, GHC.Show.Show a) => GHC.Show.Show (Numeric.LAPACK.Matrix.Type.Matrix (Numeric.LAPACK.Matrix.Array.Array shape) a) instance Control.DeepSeq.NFData shape => Numeric.LAPACK.Matrix.Type.NFData (Numeric.LAPACK.Matrix.Array.Array shape) instance Numeric.LAPACK.Matrix.Shape.Box.Box sh => Numeric.LAPACK.Matrix.Type.Box (Numeric.LAPACK.Matrix.Array.Array sh) instance Numeric.LAPACK.Matrix.Plain.Format.FormatArray sh => Numeric.LAPACK.Matrix.Type.FormatMatrix (Numeric.LAPACK.Matrix.Array.Array sh) instance Numeric.LAPACK.Matrix.Plain.Multiply.MultiplySame sh => Numeric.LAPACK.Matrix.Type.MultiplySame (Numeric.LAPACK.Matrix.Array.Array sh) instance (Numeric.LAPACK.Matrix.Plain.Class.SquareShape sh, Numeric.LAPACK.Matrix.Shape.Box.WidthOf sh GHC.Types.~ width, Data.Array.Comfort.Shape.Static width) => Numeric.LAPACK.Matrix.Type.StaticIdentity (Numeric.LAPACK.Matrix.Array.Array sh) 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 -> Array.toList xs == Array.toList (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 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) -> equating (Array.toList . Perm.toPivots NonInverted) (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 :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Inversion -> Permutation height -> Full vert horiz height width a -> Full vert horiz height width a module Numeric.LAPACK.Matrix.Permutation data Permutation sh size :: Matrix (Permutation sh) a -> sh identity :: C sh => sh -> Matrix (Permutation sh) a data Inversion NonInverted :: Inversion Inverted :: Inversion inversionFromTransposition :: Transposition -> Inversion fromPermutation :: C sh => Permutation sh -> Matrix (Permutation sh) a toPermutation :: C sh => Matrix (Permutation sh) a -> Permutation sh toMatrix :: (C sh, Floating a) => Matrix (Permutation sh) a -> Square sh a determinant :: (C sh, Floating a) => Matrix (Permutation sh) a -> a transpose :: C sh => Matrix (Permutation sh) a -> Matrix (Permutation sh) a multiplyVector :: (C size, Eq size, Floating a) => Inversion -> Matrix (Permutation size) a -> Vector size a -> Vector size a multiplyFull :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Inversion -> Matrix (Permutation height) a -> Full vert horiz height width a -> Full vert horiz height width a module Numeric.LAPACK.Matrix.Triangular type Triangular lo diag up sh = ArrayMatrix (Triangular lo diag up sh) type UpLo lo up = (UpLoC lo up, UpLoC up lo) type Diagonal sh = FlexDiagonal NonUnit sh type FlexDiagonal diag sh = ArrayMatrix (Triangular Empty diag Empty sh) type Upper sh = FlexUpper NonUnit sh type FlexUpper diag sh = ArrayMatrix (UpperTriangular diag sh) type UnitUpper sh = FlexUpper Unit sh type Lower sh = FlexLower NonUnit sh type FlexLower diag sh = ArrayMatrix (LowerTriangular diag sh) type UnitLower sh = FlexLower Unit sh type Symmetric sh = FlexSymmetric NonUnit sh type FlexSymmetric diag sh = ArrayMatrix (FlexSymmetric diag sh) size :: Triangular lo diag up sh a -> sh fromList :: (Content lo, Content up, C sh, Storable a) => Order -> sh -> [a] -> Triangular lo NonUnit up sh a autoFromList :: (Content lo, Content up, Storable a) => Order -> [a] -> Triangular lo NonUnit up ShapeInt a diagonalFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Diagonal sh a autoDiagonalFromList :: Storable a => Order -> [a] -> Diagonal 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 symmetricFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Symmetric sh a autoSymmetricFromList :: Storable a => Order -> [a] -> Symmetric ShapeInt a asDiagonal :: FlexDiagonal diag sh a -> FlexDiagonal diag sh a asLower :: FlexLower diag sh a -> FlexLower diag sh a asUpper :: FlexUpper diag sh a -> FlexUpper diag sh a asSymmetric :: FlexSymmetric diag sh a -> FlexSymmetric diag sh a requireUnitDiagonal :: Triangular lo Unit up sh a -> Triangular lo Unit up sh a requireNonUnitDiagonal :: Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a relaxUnitDiagonal :: TriDiag diag => Triangular lo Unit up sh a -> Triangular lo diag up sh a strictNonUnitDiagonal :: TriDiag diag => Triangular lo diag up sh a -> Triangular lo NonUnit up sh a identity :: (Content lo, Content up, C sh, Floating a) => Order -> sh -> Triangular lo Unit up sh a diagonal :: (Content lo, Content up, C sh, Floating a) => Order -> Vector sh a -> Triangular lo NonUnit up sh a takeDiagonal :: (Content lo, Content up, C sh, Floating a) => Triangular lo diag up sh a -> Vector sh a transpose :: (Content lo, Content up, TriDiag diag) => Triangular lo diag up sh a -> Triangular up diag lo sh a adjoint :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular up diag lo sh a stackDiagonal :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag sh0 a -> FlexDiagonal diag sh1 a -> FlexDiagonal diag (sh0 :+: sh1) a (%%%) :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag sh0 a -> FlexDiagonal diag sh1 a -> FlexDiagonal diag (sh0 :+: sh1) a infixr 2 %%% stackLower :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag sh0 a -> General sh1 sh0 a -> FlexLower diag sh1 a -> FlexLower diag (sh0 :+: sh1) a (#%%%) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag sh0 a -> (General sh1 sh0 a, FlexLower diag sh1 a) -> FlexLower diag (sh0 :+: sh1) a infixl 2 #%%% stackUpper :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexUpper diag sh0 a -> General sh0 sh1 a -> FlexUpper diag sh1 a -> FlexUpper diag (sh0 :+: sh1) a (%%%#) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (FlexUpper diag sh0 a, General sh0 sh1 a) -> FlexUpper diag sh1 a -> FlexUpper diag (sh0 :+: sh1) a infixr 2 %%%# stackSymmetric :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexSymmetric diag sh0 a -> General sh0 sh1 a -> FlexSymmetric diag sh1 a -> FlexSymmetric diag (sh0 :+: sh1) a (#%%%#) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (FlexSymmetric diag sh0 a, General sh0 sh1 a) -> FlexSymmetric diag sh1 a -> FlexSymmetric diag (sh0 :+: sh1) a infixr 2 #%%%# splitDiagonal :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag (sh0 :+: sh1) a -> (FlexDiagonal diag sh0 a, FlexDiagonal diag sh1 a) splitLower :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag (sh0 :+: sh1) a -> (FlexLower diag sh0 a, General sh1 sh0 a, FlexLower diag sh1 a) splitUpper :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexUpper diag (sh0 :+: sh1) a -> (FlexUpper diag sh0 a, General sh0 sh1 a, FlexUpper diag sh1 a) splitSymmetric :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexSymmetric diag (sh0 :+: sh1) a -> (FlexSymmetric diag sh0 a, General sh0 sh1 a, FlexSymmetric diag sh1 a) takeTopLeft :: (Content lo, TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular lo diag up (sh0 :+: sh1) a -> Triangular lo diag up sh0 a takeTopRight :: (Content lo, TriDiag diag, C sh0, C sh1, Floating a) => Triangular lo diag Filled (sh0 :+: sh1) a -> General sh0 sh1 a takeBottomLeft :: (TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular Filled diag up (sh0 :+: sh1) a -> General sh1 sh0 a takeBottomRight :: (Content lo, TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular lo diag up (sh0 :+: sh1) a -> Triangular lo diag up sh1 a toSquare :: (Content lo, Content up, C sh, Floating a) => Triangular lo diag up sh a -> Square sh a takeLower :: (C horiz, C height, C width, Floating a) => Full Small horiz height width a -> Lower height a takeUpper :: (C vert, C height, C width, Floating a) => Full 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 :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Order -> Triangular lo diag up sh a -> Triangular lo diag up sh a -- | adaptOrder x y contains the data of y with the -- layout of x. adaptOrder :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -> Triangular lo diag up sh a add :: (Content lo, Content up, Eq lo, Eq up, Eq sh, C sh, Floating a) => Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a sub :: (Content lo, Content up, Eq lo, Eq up, Eq sh, C sh, Floating a) => Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a type family PowerDiag lo up diag type PowerContentDiag lo diag up = (Content lo, Content up, TriDiag diag, PowerDiag lo up diag ~ diag, PowerDiag up lo diag ~ diag) multiplyVector :: (Content lo, Content up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Vector sh a -> Vector sh a -- | Include symmetric matrices. However, symmetric matrices do not -- preserve unit diagonals. square :: (Content lo, Content up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo (PowerDiag lo up diag) up sh a multiply :: (DiagUpLo lo up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -> Triangular lo diag up sh a multiplyFull :: (Content lo, Content up, TriDiag diag, C vert, C horiz, C height, Eq height, C width, Floating a) => Triangular lo diag up height a -> Full vert horiz height width a -> Full vert horiz height width a solve :: (Content lo, Content up, TriDiag diag, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Triangular lo diag up sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a inverse :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo (PowerDiag lo up diag) up sh a determinant :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> a eigenvalues :: (DiagUpLo lo up, C sh, Floating a) => Triangular lo diag up sh a -> Vector sh a -- |
--   (vr,d,vlAdj) = eigensystem a
--   
-- -- Counterintuitively, vr contains the right eigenvectors as -- columns and vlAdj contains the left conjugated eigenvectors -- as rows. The idea is to provide a decomposition of a. If -- a is diagonalizable, then vr and vlAdj are -- almost inverse to each other. More precisely, vlAdj <> -- vr is a diagonal matrix, 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 :: (DiagUpLo lo up, C sh, Floating a) => Triangular lo NonUnit up sh a -> (Triangular lo NonUnit up sh a, Vector sh a, Triangular lo NonUnit up sh a) module Numeric.LAPACK.Matrix.Square type Square sh = ArrayMatrix (Square sh) size :: Square sh a -> sh mapSize :: (sh0 -> sh1) -> Square sh0 a -> Square sh1 a toFull :: (C vert, C horiz) => Square sh a -> Full vert horiz sh sh a toGeneral :: Square sh a -> General sh sh a fromGeneral :: Eq sh => General sh sh a -> Square sh a fromScalar :: Storable a => a -> Square () a toScalar :: Storable a => Square () a -> a fromList :: (C sh, Storable a) => sh -> [a] -> Square sh a autoFromList :: Storable a => [a] -> Square 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 :: (C vert, C horiz, C sizeA, Eq sizeA, C sizeB, Eq sizeB, Floating a) => Square sizeA a -> Full vert horiz sizeA sizeB a -> Full horiz vert sizeB sizeA a -> Square sizeB a -> Square (sizeA :+: sizeB) a (|=|) :: (C vert, C horiz, C sizeA, Eq sizeA, C sizeB, Eq sizeB, Floating a) => (Square sizeA a, Full vert horiz sizeA sizeB a) -> (Full horiz vert sizeB sizeA a, Square sizeB a) -> Square (sizeA :+: sizeB) a infix 3 |=| multiply :: (C sh, Eq sh, Floating a) => Square sh a -> Square sh a -> Square sh a square :: (C sh, Floating a) => Square sh a -> Square sh a power :: (C sh, Floating a) => Integer -> Square sh a -> Square sh a -- | congruence B A = A^H * B * A -- -- The meaning and order of matrix factors of these functions is -- consistent: -- -- congruence :: (C height, Eq height, C width, Floating a) => Square height a -> General height width a -> Square width a -- | congruenceAdjoint A B = A * B * A^H congruenceAdjoint :: (C height, C width, Eq width, Floating a) => General height width a -> Square width a -> Square height a solve :: (C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Square sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a inverse :: (C sh, Floating a) => Square sh a -> Square sh a determinant :: (C sh, Floating a) => Square sh a -> a eigenvalues :: (C sh, Floating a) => Square sh a -> Vector sh (ComplexOf a) -- | If (q,r) = schur a, then a = q <> r <> -- adjoint q, where q is unitary (orthogonal) and -- r is a right-upper triangular matrix for complex a -- and a 1x1-or-2x2-block upper triangular matrix for real a. -- With takeDiagonal r you get all eigenvalues of a if -- a is complex and the real parts of the eigenvalues if -- a is real. Complex conjugated eigenvalues of a real matrix -- a are encoded as 2x2 blocks along the diagonal. -- -- The meaning and order of matrix factors of these functions is -- consistent: -- -- schur :: (C sh, Floating a) => Square sh a -> (Square sh a, Square sh a) schurComplex :: (C sh, Real a, Complex a ~ ac) => Square sh ac -> (Square sh ac, Upper sh ac) -- |
--   (vr,d,vlAdj) = eigensystem a
--   
-- -- Counterintuitively, vr contains the right eigenvectors as -- columns and vlAdj contains the left conjugated eigenvectors -- as rows. The idea is to provide a decomposition of a. If -- a is diagonalizable, then vr and vlAdj are -- almost inverse to each other. More precisely, vlAdj <> -- vr is a diagonal matrix, but not necessarily an identity matrix. -- This is because all eigenvectors are normalized to Euclidean norm 1. -- With the following scaling, the decomposition becomes perfect: -- --
--   let scal = takeDiagonal $ vlAdj <> vr
--   a == vr #*\ Vector.divide d scal ##*# vlAdj
--   
-- -- If a is non-diagonalizable then some columns of vr -- and corresponding rows of vlAdj are left zero and the above -- property does not hold. -- -- The meaning and order of result matrices of these functions is -- consistent: -- -- eigensystem :: (C sh, Floating a, ComplexOf a ~ ac) => Square sh a -> (Square sh ac, Vector sh ac, Square sh ac) type ComplexOf x = Complex (RealOf x) module Numeric.LAPACK.Matrix.Symmetric type Symmetric sh = FlexSymmetric NonUnit sh size :: Symmetric 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 transpose :: Symmetric sh a -> Symmetric sh a adjoint :: (C sh, Floating a) => Symmetric sh a -> Symmetric sh a stack :: (C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => Symmetric sh0 a -> General sh0 sh1 a -> Symmetric sh1 a -> Symmetric (sh0 :+: sh1) a (#%%%#) :: (C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (Symmetric sh0 a, General sh0 sh1 a) -> Symmetric sh1 a -> Symmetric (sh0 :+: sh1) a infixr 2 #%%%# split :: (C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => Symmetric (sh0 :+: sh1) a -> (Symmetric sh0 a, General sh0 sh1 a, Symmetric sh1 a) toSquare :: (C sh, Floating a) => Symmetric sh a -> Square sh a fromHermitian :: (C sh, Real a) => Hermitian sh a -> Symmetric sh a -- | gramian A = A^T * A gramian :: (C height, C width, Floating a) => General height width a -> Symmetric width a -- | gramianTransposed A = A * A^T = gramian (A^T) gramianTransposed :: (C height, C width, Floating a) => General height width a -> Symmetric height a -- | congruenceDiagonal D A = A^T * D * A congruenceDiagonal :: (C height, Eq height, C width, Floating a) => Vector height a -> General height width a -> Symmetric width a -- | congruenceDiagonalTransposed A D = A * D * A^T congruenceDiagonalTransposed :: (C height, C width, Eq width, Floating a) => General height width a -> Vector width a -> Symmetric height a -- | congruence B A = A^T * B * A congruence :: (C height, Eq height, C width, Floating a) => Symmetric height a -> General height width a -> Symmetric width a -- | congruenceTransposed B A = A * B * A^T congruenceTransposed :: (C height, C width, Eq width, Floating a) => General height width a -> Symmetric width a -> Symmetric 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 :: (C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Full vert horiz height width a -> Full vert horiz height width a -> Symmetric width a -- | anticommutatorTransposed A B = A * B^T + B * A^T = anticommutator -- (transpose A) (transpose B) anticommutatorTransposed :: (C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Full vert horiz height width a -> Full vert horiz height width a -> Symmetric height a module Numeric.LAPACK.Matrix.HermitianPositiveDefinite solve :: (C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Hermitian sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a -- |
--   solve a b == solveDecomposed (decompose a) b
--   solve (gramian u) b == solveDecomposed u b
--   
solveDecomposed :: (C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Upper sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a inverse :: (C sh, Floating a) => Hermitian sh a -> Hermitian sh a -- | Cholesky decomposition decompose :: (C sh, Floating a) => Hermitian sh a -> Upper sh a determinant :: (C sh, Floating a) => Hermitian sh a -> RealOf a module Numeric.LAPACK.Matrix.Hermitian type Hermitian sh = ArrayMatrix (Hermitian sh) data Transposition NonTransposed :: Transposition Transposed :: Transposition size :: Hermitian sh a -> sh fromList :: (C sh, Storable a) => Order -> sh -> [a] -> Hermitian sh a autoFromList :: Storable a => Order -> [a] -> Hermitian ShapeInt a identity :: (C sh, Floating a) => Order -> sh -> Hermitian sh a diagonal :: (C sh, Floating a) => Order -> Vector sh (RealOf a) -> Hermitian sh a takeDiagonal :: (C sh, Floating a) => Hermitian sh a -> Vector sh (RealOf a) forceOrder :: (C sh, Floating a) => Order -> Hermitian sh a -> Hermitian sh a -- |
--   toSquare (stack a b c)
--   
--   =
--   
--   toSquare a ||| b
--   ===
--   adjoint b ||| toSquare c
--   
-- -- It holds order (stack a b c) = order b. The function is most -- efficient when the order of all blocks match. stack :: (C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => Hermitian sh0 a -> General sh0 sh1 a -> Hermitian sh1 a -> Hermitian (sh0 :+: sh1) a (*%%%#) :: (C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (Hermitian sh0 a, General sh0 sh1 a) -> Hermitian sh1 a -> Hermitian (sh0 :+: sh1) a infixr 2 *%%%# split :: (C sh0, C sh1, Floating a) => Hermitian (sh0 :+: sh1) a -> (Hermitian sh0 a, General sh0 sh1 a, Hermitian sh1 a) takeTopLeft :: (C sh0, C sh1, Floating a) => Hermitian (sh0 :+: sh1) a -> Hermitian sh0 a takeTopRight :: (C sh0, C sh1, Floating a) => Hermitian (sh0 :+: sh1) a -> General sh0 sh1 a takeBottomRight :: (C sh0, C sh1, Floating a) => Hermitian (sh0 :+: sh1) a -> Hermitian sh1 a multiplyVector :: (C sh, Eq sh, Floating a) => Transposition -> Hermitian sh a -> Vector sh a -> Vector sh a square :: (C sh, Eq sh, Floating a) => Hermitian sh a -> Hermitian sh a multiplyFull :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Transposition -> Hermitian height a -> Full vert horiz height width a -> Full vert horiz height width a outer :: (C sh, Floating a) => Order -> Vector sh a -> Hermitian sh a sumRank1 :: (C sh, Eq sh, Floating a) => Order -> sh -> [(RealOf a, Vector sh a)] -> Hermitian sh a sumRank1NonEmpty :: (C sh, Eq sh, Floating a) => Order -> T [] (RealOf a, Vector sh a) -> Hermitian sh a sumRank2 :: (C sh, Eq sh, Floating a) => Order -> sh -> [(a, (Vector sh a, Vector sh a))] -> Hermitian sh a sumRank2NonEmpty :: (C sh, Eq sh, Floating a) => Order -> T [] (a, (Vector sh a, Vector sh a)) -> Hermitian sh a toSquare :: (C sh, Floating a) => Hermitian sh a -> Square sh a fromSymmetric :: (C sh, Real a) => Symmetric sh a -> Hermitian sh a -- | gramian A = A^H * A gramian :: (C height, C width, Floating a) => General height width a -> Hermitian width a -- | gramianAdjoint A = A * A^H = gramian (A^H) gramianAdjoint :: (C height, C width, Floating a) => General height width a -> Hermitian height a -- | congruenceDiagonal D A = A^H * D * A congruenceDiagonal :: (C height, Eq height, C width, Floating a) => Vector height (RealOf a) -> General height width a -> Hermitian width a -- | congruenceDiagonalAdjoint A D = A * D * A^H congruenceDiagonalAdjoint :: (C height, C width, Eq width, Floating a) => General height width a -> Vector width (RealOf a) -> Hermitian height a -- | congruence B A = A^H * B * A congruence :: (C height, Eq height, C width, Floating a) => Hermitian height a -> General height width a -> Hermitian width a -- | congruenceAdjoint B A = A * B * A^H congruenceAdjoint :: (C height, C width, Eq width, Floating a) => General height width a -> Hermitian width a -> Hermitian 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 :: (C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Full vert horiz height width a -> Full vert horiz height width a -> Hermitian width a -- | anticommutatorAdjoint A B = A * B^H + B * A^H = anticommutator -- (adjoint A) (adjoint B) anticommutatorAdjoint :: (C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => Full vert horiz height width a -> Full vert horiz height width a -> Hermitian height a -- | addAdjoint A = A^H + A addAdjoint :: (C sh, Floating a) => Square sh a -> Hermitian sh a solve :: (C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Hermitian sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a inverse :: (C sh, Floating a) => Hermitian sh a -> Hermitian sh a determinant :: (C sh, Floating a) => Hermitian sh a -> RealOf a eigenvalues :: (C sh, Floating a) => Hermitian sh a -> Vector sh (RealOf a) -- | For symmetric eigenvalue problems, eigensystem and -- schur coincide. eigensystem :: (C sh, Floating a) => Hermitian sh a -> (Square sh a, Vector sh (RealOf a)) module Numeric.LAPACK.Orthogonal.Householder type Householder vert horiz height width = Matrix (Hh vert horiz height width) type General height width = Householder Big Big height width type Tall height width = Householder Big Small height width type Wide height width = Householder Small Big height width type Square sh = Householder Small Small sh sh mapExtent :: (C vertA, C horizA) => (C vertB, C horizB) => Map vertA horizA vertB horizB height width -> Householder vertA horizA height width a -> Householder vertB horizB height width a fromMatrix :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Householder vert horiz height width a determinant :: (C sh, Floating a) => Square sh a -> a determinantAbsolute :: (C vert, C horiz, C height, C width, Floating a) => Householder vert horiz height width a -> RealOf a leastSquares :: (C vert, C horiz, C height, Eq height, C width, Eq width, C nrhs, Floating a) => Householder horiz Small height width a -> Full vert horiz height nrhs a -> Full vert horiz width nrhs a -- |
--   HH.minimumNorm (HH.fromMatrix a) b
--   ==
--   Ortho.minimumNorm (adjoint a) b
--   
minimumNorm :: (C vert, C horiz, C height, Eq height, C width, Eq width, C nrhs, Floating a) => Householder vert Small width height a -> Full vert horiz height nrhs a -> Full vert horiz width nrhs a data Transposition NonTransposed :: Transposition Transposed :: Transposition data Conjugation NonConjugated :: Conjugation Conjugated :: Conjugation extractQ :: (C vert, C horiz, C height, C width, Floating a) => Householder vert horiz height width a -> Square height a extractR :: (C vert, C horiz, C height, C width, Floating a) => Householder vert horiz height width a -> Full vert horiz height width a multiplyQ :: (C vertA, C horizA, C widthA, C vertB, C horizB, C widthB, C height, Eq height, Floating a) => Transposition -> Conjugation -> Householder vertA horizA height widthA a -> Full vertB horizB height widthB a -> Full vertB horizB height widthB a tallExtractQ :: (C vert, C height, C width, Floating a) => Householder vert Small height width a -> Full vert Small height width a tallExtractR :: (C vert, C height, C width, Floating a) => Householder vert Small height width a -> Upper width a tallMultiplyQ :: (C vert, C horiz, C height, Eq height, C width, C fuse, Eq fuse, Floating a) => Householder vert Small height fuse a -> Full vert horiz fuse width a -> Full vert horiz height width a tallMultiplyQAdjoint :: (C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) => Householder horiz Small fuse height a -> Full vert horiz fuse width a -> Full vert horiz height width a tallMultiplyR :: (C vertA, C vert, C horiz, C height, Eq height, C heightA, C widthB, Floating a) => Transposition -> Householder vertA Small heightA height a -> Full vert horiz height widthB a -> Full vert horiz height widthB a tallSolveR :: (C vertA, C vert, C horiz, C height, C width, Eq width, C nrhs, Floating a) => Transposition -> Conjugation -> Householder vertA Small height width a -> Full vert horiz width nrhs a -> Full vert horiz width nrhs a module Numeric.LAPACK.Orthogonal -- | If x = leastSquares a b then x minimizes -- Vector.norm2 (multiply a x sub b). -- -- Precondition: a must have full rank and height a >= -- width a. leastSquares :: (C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => Full horiz Small height width a -> Full vert horiz height nrhs a -> Full vert horiz width nrhs a -- | The vector x with x = minimumNorm a b is the vector -- with minimal Vector.norm2 x that satisfies multiply a x -- == b. -- -- Precondition: a must have full rank and height a <= -- width a. minimumNorm :: (C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => Full Small vert height width a -> Full vert horiz height nrhs a -> Full vert horiz width nrhs a -- | If (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 :: (C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => RealOf a -> Full horiz vert height width a -> Full vert horiz height nrhs a -> (Int, Full vert horiz width nrhs a) pseudoInverseRCond :: (C vert, C horiz, C height, C width, Floating a) => RealOf a -> Full vert horiz height width a -> (Int, Full 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 :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> RealOf a -- | For an m-by-n-matrix a with m>=n this function computes an -- m-by-(m-n)-matrix b such that Matrix.multiply (adjoint b) -- a is a zero matrix. The function does not try to compensate a -- rank deficiency of a. That is, a|||b has full rank -- if and only if a has full rank. -- -- For full-rank matrices you might also call this kernel or -- nullspace. complement :: (C height, C width, Floating a) => Tall height width a -> Tall height ShapeInt a -- |
--   affineSpanFromKernel 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. affineSpanFromKernel :: (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 affineSpanFromKernel. -- However, it is not precisely inverse in either direction. This is -- because both affineSpanFromKernel and -- affineKernelFromSpan accept non-orthogonal matrices but always -- return orthogonal ones. -- -- In affineKernelFromSpan c d, matrix c should have -- full rank, otherwise the implicit representation will miss dimensions. affineKernelFromSpan :: (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 :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> (Square height a, Full vert horiz height width a) householderTall :: (C vert, C height, C width, Floating a) => Full vert Small height width a -> (Full vert Small height width a, Upper width a) module Numeric.LAPACK.Matrix.Special data family Matrix typ a type Scale sh = Matrix (Scale sh) type Inverse typ = Matrix (Inverse typ) module Numeric.LAPACK.Matrix.BandedHermitianPositiveDefinite solve :: (Natural offDiag, C size, Eq size, C vert, C horiz, C nrhs, Floating a) => Hermitian offDiag size a -> Full vert horiz size nrhs a -> Full 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, C vert, C horiz, C nrhs, Floating a) => Upper offDiag size a -> Full vert horiz size nrhs a -> Full vert horiz size nrhs a -- | Cholesky decomposition decompose :: (Natural offDiag, C size, Floating a) => Hermitian offDiag size a -> Upper offDiag size a determinant :: (Natural offDiag, C size, Floating a) => Hermitian offDiag size a -> RealOf a module Numeric.LAPACK.Matrix.BandedHermitian type BandedHermitian offDiag sh = Hermitian offDiag sh data Transposition NonTransposed :: Transposition Transposed :: Transposition size :: BandedHermitian offDiag sh a -> sh fromList :: (Natural offDiag, C size, Storable a) => UnaryProxy offDiag -> Order -> size -> [a] -> BandedHermitian offDiag size a identity :: (C sh, Floating a) => sh -> Diagonal sh a diagonal :: (C sh, Floating a) => Vector sh (RealOf a) -> Diagonal sh a takeDiagonal :: (Natural offDiag, C size, Floating a) => BandedHermitian offDiag size a -> Vector size (RealOf a) toHermitian :: (Natural offDiag, C size, Floating a) => BandedHermitian offDiag size a -> Hermitian size a toBanded :: (Natural offDiag, C size, Floating a) => BandedHermitian offDiag size a -> Square offDiag offDiag size a multiplyVector :: (Natural offDiag, C size, Eq size, Floating a) => Transposition -> BandedHermitian offDiag size a -> Vector size a -> Vector size a multiplyFull :: (Natural offDiag, C vert, C horiz, C height, Eq height, C width, Floating a) => Transposition -> BandedHermitian offDiag height a -> Full vert horiz height width a -> Full vert horiz height width a gramian :: (C size, Eq size, Floating a, Natural sub, Natural super) => Square sub super size a -> BandedHermitian (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))] -> BandedHermitian k sh a eigenvalues :: (Natural offDiag, C sh, Floating a) => BandedHermitian offDiag sh a -> Vector sh (RealOf a) -- | For symmetric eigenvalue problems, eigensystem and -- schur coincide. eigensystem :: (Natural offDiag, C sh, Floating a) => BandedHermitian offDiag sh a -> (Square sh a, Vector sh (RealOf a)) module Numeric.LAPACK.Matrix data family Matrix typ a type Full vert horiz height width = ArrayMatrix (Full vert horiz height width) type General height width = ArrayMatrix (General height width) type Tall height width = ArrayMatrix (Tall height width) type Wide height width = ArrayMatrix (Wide height width) type Square sh = ArrayMatrix (Square sh) type Triangular lo diag up sh = ArrayMatrix (Triangular lo diag up sh) type Upper sh = FlexUpper NonUnit sh type Lower sh = FlexLower NonUnit sh type Diagonal sh = FlexDiagonal NonUnit sh type Symmetric sh = FlexSymmetric NonUnit sh type Hermitian sh = ArrayMatrix (Hermitian sh) type Permutation sh = Matrix (Permutation sh) type ShapeInt = ZeroBased Int shapeInt :: Int -> ShapeInt transpose :: (C vert, C horiz) => Full vert horiz height width a -> Full horiz vert width height a -- | conjugate transpose -- -- Problem: adjoint a <> a is always square, but how to -- convince the type checker to choose the Square type? Anser: Use -- Hermitian.toSquare $ Hermitian.gramian a instead. adjoint :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Full horiz vert width height a height :: Box typ => Matrix typ a -> HeightOf typ width :: Box typ => Matrix typ a -> WidthOf typ type family HeightOf typ type family WidthOf typ class Box typ indices :: (Box typ, HeightOf typ ~ height, Indexed height, WidthOf typ ~ width, Indexed width) => Matrix typ a -> [(Index height, Index width)] reshape :: (C sh0, C sh1) => sh1 -> ArrayMatrix sh0 a -> ArrayMatrix sh1 a mapShape :: (C sh0, C sh1) => (sh0 -> sh1) -> ArrayMatrix sh0 a -> ArrayMatrix sh1 a -- | Square matrices will be classified as Tall. caseTallWide :: (C vert, C horiz, C height, C width) => Full vert horiz height width a -> Either (Tall height width a) (Wide height width a) fromScalar :: Storable a => a -> General () () a toScalar :: Storable a => General () () a -> a fromList :: (C height, C width, Storable a) => height -> width -> [a] -> General height width a mapExtent :: (C vertA, C horizA) => (C vertB, C horizB) => Map vertA horizA vertB horizB height width -> Full vertA horizA height width a -> Full vertB horizB height width a fromFull :: (C vert, C horiz) => Full vert horiz height width a -> General height width a asGeneral :: General height width a -> General height width a asTall :: Tall height width a -> Tall height width a asWide :: Wide height width a -> Wide height width a tallFromGeneral :: (C height, C width, Storable a) => General height width a -> Tall height width a wideFromGeneral :: (C height, C width, Storable a) => General height width a -> Wide height width a generalizeTall :: (C vert, C horiz) => Full vert Small height width a -> Full vert horiz height width a generalizeWide :: (C vert, C horiz) => Full Small horiz height width a -> Full vert horiz height width a -- | The number of rows must be maintained by the height mapping function. mapHeight :: (C heightA, C heightB, GeneralTallWide vert horiz, GeneralTallWide horiz vert) => (heightA -> heightB) -> Full vert horiz heightA width a -> Full vert horiz heightB width a -- | The number of columns must be maintained by the width mapping -- function. mapWidth :: (C widthA, C widthB, GeneralTallWide vert horiz, GeneralTallWide horiz vert) => (widthA -> widthB) -> Full vert horiz height widthA a -> Full vert horiz height widthB a identity :: (C sh, Floating a) => sh -> General sh sh a diagonal :: (C sh, Floating a) => Vector sh a -> General sh sh a fromRowsNonEmpty :: (C width, Eq width, Storable a) => T [] (Vector width a) -> General ShapeInt width a fromRowArray :: (C height, C width, Eq width, Storable a) => width -> Array height (Vector width a) -> General height width a fromRows :: (C width, Eq width, Storable a) => width -> [Vector width a] -> General ShapeInt width a fromRowsNonEmptyContainer :: (f ~ T g, C g, C width, Eq width, Storable a) => f (Vector width a) -> General (Shape f) width a fromRowContainer :: (C f, C width, Eq width, Storable a) => width -> f (Vector width a) -> General (Shape f) width a fromColumnsNonEmpty :: (C height, Eq height, Storable a) => T [] (Vector height a) -> General height ShapeInt a fromColumnArray :: (C height, Eq height, C width, Storable a) => height -> Array width (Vector height a) -> General height width a fromColumns :: (C height, Eq height, Storable a) => height -> [Vector height a] -> General height ShapeInt a fromColumnsNonEmptyContainer :: (f ~ T g, C g, C height, Eq height, Storable a) => f (Vector height a) -> General height (Shape f) a fromColumnContainer :: (C f, C height, Eq height, Storable a) => height -> f (Vector height a) -> General height (Shape f) a singleRow :: Order -> Vector width a -> General () width a singleColumn :: Order -> Vector height a -> General height () a flattenRow :: General () width a -> Vector width a flattenColumn :: General height () a -> Vector height a liftRow :: Order -> (Vector height0 a -> Vector height1 b) -> General () height0 a -> General () height1 b liftColumn :: Order -> (Vector height0 a -> Vector height1 b) -> General height0 () a -> General height1 () b unliftRow :: Order -> (General () height0 a -> General () height1 b) -> Vector height0 a -> Vector height1 b unliftColumn :: Order -> (General height0 () a -> General height1 () b) -> Vector height0 a -> Vector height1 b toRows :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> [Vector width a] toColumns :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> [Vector height a] toRowArray :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Array height (Vector width a) toColumnArray :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Array width (Vector height a) toRowContainer :: (C vert, C horiz, C f, C width, Floating a) => Full vert horiz (Shape f) width a -> f (Vector width a) toColumnContainer :: (C vert, C horiz, C height, C f, Floating a) => Full vert horiz height (Shape f) a -> f (Vector height a) takeRow :: (C vert, C horiz, Indexed height, C width, Index height ~ ix, Floating a) => Full vert horiz height width a -> ix -> Vector width a takeColumn :: (C vert, C horiz, C height, Indexed width, Index width ~ ix, Floating a) => Full vert horiz height width a -> ix -> Vector height a takeRows :: (C vert, C width, Floating a) => Int -> Full vert Big ShapeInt width a -> Full vert Big ShapeInt width a takeColumns :: (C horiz, C height, Floating a) => Int -> Full Big horiz height ShapeInt a -> Full Big horiz height ShapeInt a -- | Take a left-top aligned square or as much as possible of it. The -- advantange of this function is that it maintains the matrix size -- relation, e.g. Square remains Square, Tall remains Tall. takeEqually :: (C vert, C horiz, Floating a) => Int -> Full vert horiz ShapeInt ShapeInt a -> Full vert horiz ShapeInt ShapeInt a dropRows :: (C vert, C width, Floating a) => Int -> Full vert Big ShapeInt width a -> Full vert Big ShapeInt width a dropColumns :: (C horiz, C height, Floating a) => Int -> Full Big horiz height ShapeInt a -> Full Big horiz height ShapeInt a -- | Drop the same number of top-most rows and left-most columns. The -- advantange of this function is that it maintains the matrix size -- relation, e.g. Square remains Square, Tall remains Tall. dropEqually :: (C vert, C horiz, Floating a) => Int -> Full vert horiz ShapeInt ShapeInt a -> Full vert horiz ShapeInt ShapeInt a takeTop :: (C vert, C height0, C height1, C width, Floating a) => Full vert Big (height0 :+: height1) width a -> Full vert Big height0 width a takeBottom :: (C vert, C height0, C height1, C width, Floating a) => Full vert Big (height0 :+: height1) width a -> Full vert Big height1 width a takeLeft :: (C vert, C height, C width0, C width1, Floating a) => Full Big vert height (width0 :+: width1) a -> Full Big vert height width0 a takeRight :: (C vert, C height, C width0, C width1, Floating a) => Full Big vert height (width0 :+: width1) a -> Full Big vert height width1 a -- | The function is optimized for blocks of consecutive rows. For -- scattered rows in column major order the function has quite ugly -- memory access patterns. takeRowArray :: (Indexed height, C width, C sh, Floating a) => Array sh (Index height) -> General height width a -> General sh width a takeColumnArray :: (C height, Indexed width, C sh, Floating a) => Array sh (Index width) -> General height width a -> General height sh a swapRows :: (C vert, C horiz, Indexed height, C width, Floating a) => Index height -> Index height -> Full vert horiz height width a -> Full vert horiz height width a swapColumns :: (C vert, C horiz, C height, Indexed width, Floating a) => Index width -> Index width -> Full vert horiz height width a -> Full vert horiz height width a reverseRows :: (C vert, C horiz, C width, Floating a) => Full vert horiz ShapeInt width a -> Full vert horiz ShapeInt width a reverseColumns :: (C vert, C horiz, C height, Floating a) => Full vert horiz height ShapeInt a -> Full vert horiz height ShapeInt a fromRowMajor :: (C height, C width, Floating a) => Array (height, width) a -> General height width a toRowMajor :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Array (height, width) a forceOrder :: (ShapeOrder shape, Floating a) => Order -> ArrayMatrix shape a -> ArrayMatrix shape a -- | adaptOrder x y contains the data of y with the -- layout of x. adaptOrder :: (ShapeOrder shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a data OrderBias -- | Use the element order of the first operand. leftBias :: OrderBias -- | Use the element order of the second operand. rightBias :: OrderBias -- | Choose element order such that, if possible, one part can be copied as -- one block. For above this means that RowMajor is -- chosen whenever at least one operand is RowMajor and -- ColumnMajor is chosen when both operands are -- ColumnMajor. contiguousBias :: OrderBias (|||) :: (C vertA, C vertB, C vertC, Append vertA vertB ~ vertC, C height, Eq height, C widthA, C widthB, Floating a) => Full vertA Big height widthA a -> Full vertB Big height widthB a -> Full vertC Big height (widthA :+: widthB) a infixr 3 ||| beside :: (C vertA, C vertB, C vertC, C height, Eq height, C widthA, C widthB, Floating a) => OrderBias -> AppendMode vertA vertB vertC height widthA widthB -> Full vertA Big height widthA a -> Full vertB Big height widthB a -> Full vertC Big height (widthA :+: widthB) a (===) :: (C horizA, C horizB, C horizC, Append horizA horizB ~ horizC, C width, Eq width, C heightA, C heightB, Floating a) => Full Big horizA heightA width a -> Full Big horizB heightB width a -> Full Big horizC (heightA :+: heightB) width a infixr 2 === above :: (C horizA, C horizB, C horizC, C width, Eq width, C heightA, C heightB, Floating a) => OrderBias -> AppendMode horizA horizB horizC width heightA heightB -> Full Big horizA heightA width a -> Full Big horizB heightB width a -> Full Big horizC (heightA :+: heightB) width a stack :: (C vert, C horiz, C heightA, Eq heightA, C heightB, Eq heightB, C widthA, Eq widthA, C widthB, Eq widthB, Floating a) => Full vert horiz heightA widthA a -> General heightA widthB a -> General heightB widthA a -> Full vert horiz heightB widthB a -> Full vert horiz (heightA :+: heightB) (widthA :+: widthB) a (|*-) :: (C height, Eq height, C width, Eq width, Floating a) => Vector height a -> Vector width a -> General height width a infixl 7 |*- -- |
--   tensorProduct order x y = singleColumn order x #*# singleRow order y
--   
tensorProduct :: (C height, Eq height, C width, Eq width, Floating a) => Order -> Vector height a -> Vector width a -> General height width a -- |
--   outer order x y = tensorProduct order x (Vector.conjugate y)
--   
outer :: (C height, Eq height, C width, Eq width, Floating a) => Order -> Vector height a -> Vector width a -> General height width a kronecker :: (C vert, C horiz, C heightA, C widthA, C heightB, C widthB, Floating a) => Full vert horiz heightA widthA a -> Full vert horiz heightB widthB a -> Full 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 :: (C vert, C horiz, C height, C width, Storable a, Storable b) => (a -> b) -> Full vert horiz height width a -> Full vert horiz height width b class Complex typ conjugate :: (Complex typ, Floating a) => Matrix typ a -> Matrix typ a fromReal :: (Complex typ, Floating a) => Matrix typ (RealOf a) -> Matrix typ a toComplex :: (Complex typ, Floating a) => Matrix typ a -> Matrix typ (ComplexOf a) class SquareShape typ toSquare :: (SquareShape typ, HeightOf typ ~ sh, Floating a) => Matrix typ a -> Square sh a identityFrom :: (SquareShape shape, ShapeOrder shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a identityFromHeight :: (ShapeOrder shape, Box shape, HeightOf shape ~ HeightOf typ, SquareShape typ, Floating a) => ArrayMatrix shape a -> Matrix typ a identityFromWidth :: (ShapeOrder shape, Box shape, WidthOf shape ~ HeightOf typ, SquareShape typ, Floating a) => ArrayMatrix shape a -> Matrix typ a takeDiagonal :: (SquareShape typ, HeightOf typ ~ sh, Floating a) => Matrix typ a -> Vector sh a trace :: (SquareShape typ, HeightOf typ ~ sh, C sh, Floating a) => Matrix typ a -> a type family RealOf x rowSums :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Vector height a columnSums :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> Vector width a rowArgAbsMaximums :: (C vert, C horiz, C height, InvIndexed width, Index width ~ ix, Storable ix, Floating a) => Full vert horiz height width a -> (Vector height ix, Vector height a) columnArgAbsMaximums :: (C vert, C horiz, InvIndexed height, C width, Index height ~ ix, Storable ix, Floating a) => Full vert horiz height width a -> (Vector width ix, Vector width a) scaleRows :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height a -> Full vert horiz height width a -> Full vert horiz height width a scaleColumns :: (C vert, C horiz, C height, C width, Eq width, Floating a) => Vector width a -> Full vert horiz height width a -> Full vert horiz height width a scaleRowsReal :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height (RealOf a) -> Full vert horiz height width a -> Full vert horiz height width a scaleColumnsReal :: (C vert, C horiz, C height, C width, Eq width, Floating a) => Vector width (RealOf a) -> Full vert horiz height width a -> Full vert horiz height width a (\*#) :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height a -> Full vert horiz height width a -> Full vert horiz height width a infixr 7 \*# (#*\) :: (C vert, C horiz, C height, C width, Eq width, Floating a) => Full vert horiz height width a -> Vector width a -> Full vert horiz height width a infixl 7 #*\ (\\#) :: (C vert, C horiz, C height, Eq height, C width, Floating a) => Vector height a -> Full vert horiz height width a -> Full vert horiz height width a infixr 7 \\# (#/\) :: (C vert, C horiz, C height, C width, Eq width, Floating a) => Full vert horiz height width a -> Vector width a -> Full vert horiz height width a infixl 7 #/\ multiply :: (C vert, C horiz, C height, C fuse, Eq fuse, C width, Floating a) => Full vert horiz height fuse a -> Full vert horiz fuse width a -> Full vert horiz height width a multiplyVector :: (C vert, C horiz, C height, C width, Eq width, Floating a) => Full vert horiz height width a -> Vector width a -> Vector height a zero :: (Homogeneous shape, Floating a) => shape -> ArrayMatrix shape a negate :: (Homogeneous shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a scale :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a scaleReal :: (Homogeneous shape, Floating a) => RealOf a -> ArrayMatrix shape a -> ArrayMatrix shape a scaleRealReal :: (Homogeneous shape, Real a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a (.*#) :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 7 .*# add :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 6 `add` sub :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 6 `sub` (#+#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 6 #+# (#-#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a infixl 6 #-# class (Box typA, Box typB) => Multiply typA typB (#*#) :: (Multiply typA typB, Floating a) => Matrix typA a -> Matrix typB a -> Matrix (Multiplied typA typB) a infixl 7 #*# class (Box typ) => MultiplyVector typ (#*|) :: (MultiplyVector typ, WidthOf typ ~ width, Eq width, Floating a) => Matrix typ a -> Vector width a -> Vector (HeightOf typ) a infixr 7 #*| (-*#) :: (MultiplyVector typ, HeightOf typ ~ height, Eq height, Floating a) => Vector height a -> Matrix typ a -> Vector (WidthOf typ) a infixl 7 -*# class (Box typ, HeightOf typ ~ WidthOf typ) => MultiplySquare typ multiplySquare :: (MultiplySquare typ, HeightOf typ ~ height, Eq height, C width, C vert, C horiz, Floating a) => Transposition -> Matrix typ a -> Full vert horiz height width a -> Full vert horiz height width a class (Box typ, HeightOf typ ~ WidthOf typ) => Power typ square :: (Power typ, Floating a) => Matrix typ a -> Matrix typ a power :: (Power typ, Floating a) => Int -> Matrix typ a -> Matrix typ a (##*#) :: (MultiplySquare typ, WidthOf typ ~ width, Eq width, C height, C vert, C horiz, Floating a) => Full vert horiz height width a -> Matrix typ a -> Full vert horiz height width a infixl 7 ##*# (#*##) :: (MultiplySquare typ, HeightOf typ ~ height, Eq height, C width, C vert, C horiz, Floating a) => Matrix typ a -> Full vert horiz height width a -> Full vert horiz height width a infixr 7 #*## class (Box typ) => Indexed typ (#!) :: (Indexed typ, Floating a) => Matrix typ a -> (Index (HeightOf typ), Index (WidthOf typ)) -> a infixl 9 #! class (Box typ, HeightOf typ ~ WidthOf typ) => Determinant typ determinant :: (Determinant typ, Floating a) => Matrix typ a -> a class (Box typ, HeightOf typ ~ WidthOf typ) => Solve typ solve :: (Solve typ, HeightOf typ ~ height, Eq height, C width, C vert, C horiz, Floating a) => Transposition -> Matrix typ a -> Full vert horiz height width a -> Full vert horiz height width a solveLeft :: (Solve typ, WidthOf typ ~ width, Eq width, C height, C vert, C horiz, Floating a) => Full vert horiz height width a -> Matrix typ a -> Full vert horiz height width a solveRight :: (Solve typ, HeightOf typ ~ height, Eq height, C width, C vert, C horiz, Floating a) => Matrix typ a -> Full vert horiz height width a -> Full vert horiz height width a (##/#) :: (Solve typ, WidthOf typ ~ width, Eq width, C height, C vert, C horiz, Floating a) => Full vert horiz height width a -> Matrix typ a -> Full vert horiz height width a infixl 7 ##/# (#\##) :: (Solve typ, HeightOf typ ~ height, Eq height, C width, C vert, C horiz, Floating a) => Matrix typ a -> Full vert horiz height width a -> Full vert horiz height width a infixr 7 #\## solveVector :: (Solve typ, HeightOf typ ~ height, Eq height, Floating a) => Transposition -> Matrix typ a -> Vector height a -> Vector height a (-/#) :: (Solve typ, HeightOf typ ~ height, Eq height, Floating a) => Vector height a -> Matrix typ a -> Vector height a infixl 7 -/# (#\|) :: (Solve typ, HeightOf typ ~ height, Eq height, Floating a) => Matrix typ a -> Vector height a -> Vector height a infixr 7 #\| class (Solve typ, Power typ) => Inverse typ inverse :: (Inverse typ, Floating a) => Matrix typ a -> Matrix typ a data Transposition NonTransposed :: Transposition Transposed :: Transposition module Numeric.LAPACK.Singular values :: (C height, C width, Floating a) => General height width a -> Vector (Min height width) (RealOf a) valuesTall :: (C vert, C height, C width, Floating a) => Full vert Small height width a -> Vector width (RealOf a) valuesWide :: (C horiz, C height, C width, Floating a) => Full Small horiz height width a -> Vector height (RealOf a) decompose :: (C height, C width, Floating a) => General height width a -> (Square height a, Vector (Min height width) (RealOf a), Square width a) -- |
--   let (u,s,vt) = Singular.decomposeTall a
--   in a  ==  u ##*# Matrix.scaleRowsReal s vt
--   
decomposeTall :: (C vert, C height, C width, Floating a) => Full vert Small height width a -> (Full vert Small height width a, Vector width (RealOf a), Square width a) -- |
--   let (u,s,vt) = Singular.decomposeWide a
--   in a  ==  u #*## Matrix.scaleRowsReal s vt
--   
decomposeWide :: (C horiz, C height, C width, Floating a) => Full Small horiz height width a -> (Square height a, Vector height (RealOf a), Full Small horiz height width a) determinantAbsolute :: (C height, C width, Floating a) => General height width a -> RealOf a leastSquaresMinimumNormRCond :: (C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => RealOf a -> Full horiz vert height width a -> Full vert horiz height nrhs a -> (Int, Full vert horiz width nrhs a) pseudoInverseRCond :: (C vert, C horiz, C height, C width, Floating a) => RealOf a -> Full vert horiz height width a -> (Int, Full horiz vert width height a) decomposePolar :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> (Full vert horiz height width a, Hermitian width a) type family RealOf x -- | 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] -- |
--   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 parameterDifferencesMatrix :: Vector ShapeInt Float -> Upper ShapeInt Float main :: IO () -- | 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 () module Numeric.LAPACK.Matrix.Banded type Banded sub super vert horiz height width = ArrayMatrix (Banded sub super vert horiz height width) type General sub super height width = ArrayMatrix (BandedGeneral sub super height width) type Square sub super size = ArrayMatrix (BandedSquare sub super size) type Upper super size = Square U0 super size type Lower sub size = Square sub U0 size type Diagonal size = Square U0 U0 size type Hermitian offDiag sh = ArrayMatrix (BandedHermitian offDiag sh) height :: (C vert, C horiz) => Banded sub super vert horiz height width a -> height width :: (C vert, C horiz) => Banded sub super vert horiz height width a -> width fromList :: (Natural sub, Natural super, C height, C width, Storable a) => (UnaryProxy sub, UnaryProxy super) -> Order -> height -> width -> [a] -> General sub super height width a squareFromList :: (Natural sub, Natural super, C size, Storable a) => (UnaryProxy sub, UnaryProxy super) -> Order -> size -> [a] -> Square sub super size a lowerFromList :: (Natural sub, C size, Storable a) => UnaryProxy sub -> Order -> size -> [a] -> Lower sub size a upperFromList :: (Natural super, C size, Storable a) => UnaryProxy super -> Order -> size -> [a] -> Upper super size a mapExtent :: (C vertA, C horizA) => (C vertB, C horizB) => Map vertA horizA vertB horizB height width -> Banded super sub vertA horizA height width a -> Banded super sub vertB horizB height width a diagonal :: (C sh, Floating a) => Order -> Vector sh a -> Diagonal sh a takeDiagonal :: (Natural sub, Natural super, C sh, Floating a) => Square sub super sh a -> Vector sh a toFull :: (Natural sub, Natural super, C vert, C horiz, C height, C width, Floating a) => Banded sub super vert horiz height width a -> Full vert horiz height width a toLowerTriangular :: (Natural sub, C sh, Floating a) => Lower sub sh a -> Lower sh a toUpperTriangular :: (Natural super, C sh, Floating a) => Upper super sh a -> Upper sh a transpose :: (C vert, C horiz) => Banded sub super vert horiz height width a -> Banded super sub horiz vert width height a adjoint :: (Natural sub, Natural super, C vert, C horiz, C height, C width, Floating a) => Banded sub super vert horiz height width a -> Banded super sub horiz vert width height a multiplyVector :: (Natural sub, Natural super, C vert, C horiz, C height, C width, Eq width, Floating a) => Banded sub super vert horiz height width a -> Vector width a -> Vector height a multiply :: (Natural subA, Natural superA, Natural subB, Natural superB, (subA :+: subB) ~ subC, (superA :+: superB) ~ superC, C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) => Banded subA superA vert horiz height fuse a -> Banded subB superB vert horiz fuse width a -> Banded subC superC vert horiz height width a multiplyFull :: (Natural sub, Natural super, C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) => Banded sub super vert horiz height fuse a -> Full vert horiz fuse width a -> Full vert horiz height width a solve :: (Natural sub, Natural super, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Square sub super sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a determinant :: (Natural sub, Natural super, C sh, Floating a) => Square sub super sh a -> a module Numeric.LAPACK.Linear.LowerUpper type LowerUpper vert horiz height width = Matrix (LU vert horiz height width) type Square sh = LowerUpper Small Small sh sh type Tall height width = LowerUpper Big Small height width type Wide height width = LowerUpper Small Big 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 vertA horizA vertB horizB height width -> LowerUpper vertA horizA height width a -> LowerUpper vertB horizB height width a -- | LowerUpper.fromMatrix a computes the LU decomposition of -- matrix a with row pivotisation. -- -- You can reconstruct a from lu depending on 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 :: (C vert, C horiz, C height, C width, Floating a) => Full vert horiz height width a -> LowerUpper vert horiz height width a toMatrix :: (C vert, C horiz, C height, Eq height, C width, Eq width, Floating a) => LowerUpper vert horiz height width a -> Full vert horiz height width a solve :: (C vert, C horiz, Eq height, C height, C width, Floating a) => Square height a -> Full vert horiz height width a -> Full vert horiz height width a multiplyFull :: (C vert, C horiz, C height, Eq height, C width, C fuse, Eq fuse, Floating a) => LowerUpper vert horiz height fuse a -> Full vert horiz fuse width a -> Full vert horiz height width a -- | Caution: LU.determinant . LU.fromMatrix will fail for -- singular matrices. determinant :: (C sh, Floating a) => Square sh a -> a extractP :: (C vert, C horiz, C height, C width) => Inversion -> LowerUpper vert horiz height width a -> Permutation height a multiplyP :: (C vertA, C horizA, C vertB, C horizB, Eq height, C height, C widthA, C widthB, Floating a) => Inversion -> LowerUpper vertA horizA height widthA a -> Full vertB horizB height widthB a -> Full vertB horizB height widthB a extractL :: (C vert, C horiz, C height, C width, Floating a) => LowerUpper vert horiz height width a -> Full vert horiz height width a wideExtractL :: (C horiz, C height, C width, Floating a) => LowerUpper Small horiz height width a -> UnitLower height a -- | wideMultiplyL transposed lu a multiplies the square part of -- lu containing the lower triangular matrix with a. -- --
--   wideMultiplyL NonTransposed lu a == wideExtractL lu #*## a
--   wideMultiplyL Transposed lu a == Tri.transpose (wideExtractL lu) #*## a
--   
wideMultiplyL :: (C horizA, C vert, C horiz, C height, Eq height, C widthA, C widthB, Floating a) => Transposition -> LowerUpper Small horizA height widthA a -> Full vert horiz height widthB a -> Full vert horiz height widthB a wideSolveL :: (C horizA, C vert, C horiz, C height, Eq height, C width, C nrhs, Floating a) => Transposition -> Conjugation -> LowerUpper Small horizA height width a -> Full vert horiz height nrhs a -> Full vert horiz height nrhs a extractU :: (C vert, C horiz, C height, C width, Floating a) => LowerUpper vert horiz height width a -> Full vert horiz height width a tallExtractU :: (C vert, C height, C width, Floating a) => LowerUpper vert Small height width a -> Upper width a -- | tallMultiplyU transposed lu a multiplies the square part of -- lu containing the upper triangular matrix with a. -- --
--   tallMultiplyU NonTransposed lu a == tallExtractU lu #*## a
--   tallMultiplyU Transposed lu a == Tri.transpose (tallExtractU lu) #*## a
--   
tallMultiplyU :: (C vertA, C vert, C horiz, C height, Eq height, C heightA, C widthB, Floating a) => Transposition -> LowerUpper vertA Small heightA height a -> Full vert horiz height widthB a -> Full vert horiz height widthB a tallSolveU :: (C vertA, C vert, C horiz, C height, C width, Eq width, C nrhs, Floating a) => Transposition -> Conjugation -> LowerUpper vertA Small height width a -> Full vert horiz width nrhs a -> Full vert horiz width nrhs a caseTallWide :: (C vert, C horiz, C height, C width) => LowerUpper vert horiz height width a -> Either (Tall height width a) (Wide height width a)