{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GADTs #-}
module Numeric.LAPACK.Matrix.Triangular (
   Triangular, MatrixShape.UpLo,
   Upper, FlexUpper, Triangular.UnitUpper, Triangular.QuasiUpper,
   Lower, FlexLower, Triangular.UnitLower,
   size,
   fromList, autoFromList,
   lowerFromList, autoLowerFromList,
   upperFromList, autoUpperFromList,
   asLower, asUpper,
   requireUnitDiagonal, requireArbitraryDiagonal,
   relaxUnitDiagonal, strictArbitraryDiagonal,
   OmniMatrix.identityOrder,
   diagonal,
   takeDiagonal,
   transpose,
   adjoint,

   stackLower, (#%%%),
   stackUpper, (%%%#),
   splitLower,
   splitUpper,
   takeTopLeft,
   takeTopRight,
   takeBottomLeft,
   takeBottomRight,

   pack,
   toSquare,
   takeLower,
   takeUpper,

   fromLowerRowMajor, toLowerRowMajor,
   fromUpperRowMajor, toUpperRowMajor,
   forceOrder, adaptOrder,

   add, sub,

   multiplyVector,
   square,
   multiply,
   multiplyFull,

   solve,
   inverse,
   determinant,

   eigenvalues,
   eigensystem,
   ) where

import qualified Numeric.LAPACK.Matrix.Triangular.Eigen as Eigen
import qualified Numeric.LAPACK.Matrix.Triangular.Linear as Linear
import qualified Numeric.LAPACK.Matrix.Triangular.Basic as Basic
import qualified Numeric.LAPACK.Matrix.Mosaic.Basic as Mosaic
import qualified Numeric.LAPACK.Matrix.Mosaic.Packed as Packed
import qualified Numeric.LAPACK.Matrix.Mosaic.Generic as Mos
import qualified Numeric.LAPACK.Matrix.Basic as FullBasic

import qualified Numeric.LAPACK.Matrix.Array.Mosaic as Triangular
import qualified Numeric.LAPACK.Matrix.Array.Unpacked as ArrUnpacked
import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix
import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix
import qualified Numeric.LAPACK.Matrix.Type as Matrix
import qualified Numeric.LAPACK.Matrix.Class as MatrixClass
import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni
import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape
import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout
import qualified Numeric.LAPACK.Matrix.Extent as Extent
import qualified Numeric.LAPACK.Vector as Vector
import qualified Numeric.LAPACK.Scalar as Scalar
import Numeric.LAPACK.Matrix.Array.Mosaic (
   Triangular, TriangularP,
   Lower, FlexLower, FlexLowerP,
   Upper, FlexUpper, FlexUpperP,
   )
import Numeric.LAPACK.Matrix.Array.Unpacked (Unpacked)
import Numeric.LAPACK.Matrix.Array (Full, General, Square, packTag, diagTag)
import Numeric.LAPACK.Matrix.Shape.Omni (Arbitrary, Unit)
import Numeric.LAPACK.Matrix.Layout.Private (Order, Filled)
import Numeric.LAPACK.Matrix.Private (ShapeInt)
import Numeric.LAPACK.Vector (Vector)

import qualified Numeric.Netlib.Class as Class

import qualified Data.Array.Comfort.Storable as Array
import qualified Data.Array.Comfort.Shape as Shape
import Data.Array.Comfort.Storable (Array)
import Data.Array.Comfort.Shape ((::+))

import Foreign.Storable (Storable)

import Data.Tuple.HT (mapPair)
import Data.Function.HT (Id)


size :: TriangularP pack lo diag up sh a -> sh
size :: TriangularP pack lo diag up sh a -> sh
size = Omni pack diag lo up Shape Small Small sh sh -> sh
forall pack property lower upper sh.
Omni pack property lower upper Shape Small Small sh sh -> sh
Omni.squareSize (Omni pack diag lo up Shape Small Small sh sh -> sh)
-> (TriangularP pack lo diag up sh a
    -> Omni pack diag lo up Shape Small Small sh sh)
-> TriangularP pack lo diag up sh a
-> sh
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TriangularP pack lo diag up sh a
-> Omni pack diag lo up Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width a.
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> Omni pack property lower upper meas vert horiz height width
ArrMatrix.shape

transpose ::
   (MatrixShape.PowerStrip lo, MatrixShape.PowerStrip up,
    MatrixShape.TriDiag diag, Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a -> TriangularP pack up diag lo sh a
transpose :: TriangularP pack lo diag up sh a
-> TriangularP pack up diag lo sh a
transpose = TriangularP pack lo diag up sh a
-> TriangularP pack up diag lo sh a
forall typ meas vert horiz width height a xl xu lower upper.
(Transpose typ, Measure meas, C vert, C horiz, C width, C height,
 Floating a) =>
Matrix typ xl xu lower upper meas vert horiz height width a
-> Matrix typ xu xl upper lower meas horiz vert width height a
Matrix.transpose

adjoint ::
   (MatrixShape.PowerStrip lo, MatrixShape.PowerStrip up,
    MatrixShape.TriDiag diag, Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a -> TriangularP pack up diag lo sh a
adjoint :: TriangularP pack lo diag up sh a
-> TriangularP pack up diag lo sh a
adjoint = TriangularP pack lo diag up sh a
-> TriangularP pack up diag lo sh a
forall typ meas vert horiz height width a xl xu lower upper.
(Transpose typ, Complex typ, Measure meas, C vert, C horiz,
 C height, C width, Floating a) =>
Matrix typ xl xu lower upper meas vert horiz height width a
-> Matrix typ xu xl upper lower meas horiz vert width height a
MatrixClass.adjoint


fromList ::
   (MatrixShape.UpLo lo up, Shape.C sh, Storable a) =>
   Order -> sh -> [a] -> Triangular lo Arbitrary up sh a
fromList :: Order -> sh -> [a] -> Triangular lo Arbitrary up sh a
fromList Order
order sh
sh [a]
xs =
   let m :: Triangular lo Arbitrary up sh a
m =
         case Triangular lo Arbitrary up sh a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag Triangular lo Arbitrary up sh a
m of
            UpLoSingleton lo up
MatrixShape.Upper -> Order -> sh -> [a] -> Upper sh a
forall sh a. (C sh, Storable a) => Order -> sh -> [a] -> Upper sh a
upperFromList Order
order sh
sh [a]
xs
            UpLoSingleton lo up
MatrixShape.Lower -> Order -> sh -> [a] -> Lower sh a
forall sh a. (C sh, Storable a) => Order -> sh -> [a] -> Lower sh a
lowerFromList Order
order sh
sh [a]
xs
   in Triangular lo Arbitrary up sh a
m

lowerFromList :: (Shape.C sh, Storable a) => Order -> sh -> [a] -> Lower sh a
lowerFromList :: Order -> sh -> [a] -> Lower sh a
lowerFromList Order
order sh
sh = Array (LowerTriangularP Packed sh) a -> Lower sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (Array (LowerTriangularP Packed sh) a -> Lower sh a)
-> ([a] -> Array (LowerTriangularP Packed sh) a)
-> [a]
-> Lower sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> sh -> [a] -> Array (LowerTriangularP Packed sh) a
forall pack mirror uplo sh a.
(Packing pack, Mirror mirror, UpLo uplo, C sh, Storable a) =>
Order -> sh -> [a] -> Mosaic pack mirror uplo sh a
Mos.fromList Order
order sh
sh

upperFromList :: (Shape.C sh, Storable a) => Order -> sh -> [a] -> Upper sh a
upperFromList :: Order -> sh -> [a] -> Upper sh a
upperFromList Order
order sh
sh = Array (UpperTriangularP Packed sh) a -> Upper sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (Array (UpperTriangularP Packed sh) a -> Upper sh a)
-> ([a] -> Array (UpperTriangularP Packed sh) a)
-> [a]
-> Upper sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> sh -> [a] -> Array (UpperTriangularP Packed sh) a
forall pack mirror uplo sh a.
(Packing pack, Mirror mirror, UpLo uplo, C sh, Storable a) =>
Order -> sh -> [a] -> Mosaic pack mirror uplo sh a
Mos.fromList Order
order sh
sh


autoFromList ::
   (MatrixShape.UpLo lo up, Storable a) =>
   Order -> [a] -> Triangular lo Arbitrary up ShapeInt a
autoFromList :: Order -> [a] -> Triangular lo Arbitrary up ShapeInt a
autoFromList Order
order [a]
xs =
   let m :: Triangular lo Arbitrary up ShapeInt a
m =
         case Triangular lo Arbitrary up ShapeInt a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag Triangular lo Arbitrary up ShapeInt a
m of
            UpLoSingleton lo up
MatrixShape.Upper -> Order -> [a] -> Upper ShapeInt a
forall a. Storable a => Order -> [a] -> Upper ShapeInt a
autoUpperFromList Order
order [a]
xs
            UpLoSingleton lo up
MatrixShape.Lower -> Order -> [a] -> Lower ShapeInt a
forall a. Storable a => Order -> [a] -> Lower ShapeInt a
autoLowerFromList Order
order [a]
xs
   in Triangular lo Arbitrary up ShapeInt a
m

autoLowerFromList :: (Storable a) => Order -> [a] -> Lower ShapeInt a
autoLowerFromList :: Order -> [a] -> Lower ShapeInt a
autoLowerFromList Order
order = Array (LowerTriangularP Packed ShapeInt) a -> Lower ShapeInt a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (Array (LowerTriangularP Packed ShapeInt) a -> Lower ShapeInt a)
-> ([a] -> Array (LowerTriangularP Packed ShapeInt) a)
-> [a]
-> Lower ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> [a] -> Array (LowerTriangularP Packed ShapeInt) a
forall pack mirror uplo a.
(Packing pack, Mirror mirror, UpLo uplo, Storable a) =>
Order -> [a] -> Mosaic pack mirror uplo ShapeInt a
Mos.autoFromList Order
order

autoUpperFromList :: (Storable a) => Order -> [a] -> Upper ShapeInt a
autoUpperFromList :: Order -> [a] -> Upper ShapeInt a
autoUpperFromList Order
order = Array (UpperTriangularP Packed ShapeInt) a -> Upper ShapeInt a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (Array (UpperTriangularP Packed ShapeInt) a -> Upper ShapeInt a)
-> ([a] -> Array (UpperTriangularP Packed ShapeInt) a)
-> [a]
-> Upper ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> [a] -> Array (UpperTriangularP Packed ShapeInt) a
forall pack mirror uplo a.
(Packing pack, Mirror mirror, UpLo uplo, Storable a) =>
Order -> [a] -> Mosaic pack mirror uplo ShapeInt a
Mos.autoFromList Order
order


asLower :: Id (FlexLowerP pack diag sh a)
asLower :: Id (FlexLowerP pack diag sh a)
asLower = Id (FlexLowerP pack diag sh a)
forall a. a -> a
id

asUpper :: Id (FlexUpperP pack diag sh a)
asUpper :: Id (FlexUpperP pack diag sh a)
asUpper = Id (FlexUpperP pack diag sh a)
forall a. a -> a
id


requireUnitDiagonal :: Id (TriangularP pack lo Unit up sh a)
requireUnitDiagonal :: Id (TriangularP pack lo Unit up sh a)
requireUnitDiagonal = Id (TriangularP pack lo Unit up sh a)
forall a. a -> a
id

requireArbitraryDiagonal :: Id (TriangularP pack lo Arbitrary up sh a)
requireArbitraryDiagonal :: Id (TriangularP pack lo Arbitrary up sh a)
requireArbitraryDiagonal = Id (TriangularP pack lo Arbitrary up sh a)
forall a. a -> a
id


pack ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a -> Triangular lo diag up sh a
pack :: TriangularP pack lo diag up sh a -> Triangular lo diag up sh a
pack TriangularP pack lo diag up sh a
a =
   case TriangularP pack lo diag up sh a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up sh a
a of
      UpLoSingleton lo up
MatrixShape.Lower -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray Packed diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a -> Triangular lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray pack diag lo up Shape Small Small sh sh a
-> PlainArray Packed diag lo up Shape Small Small sh sh a
forall uplo sh a pack mirror.
(UpLo uplo, C sh, Floating a) =>
Mosaic pack mirror uplo sh a -> Mosaic mirror uplo sh a
Mosaic.pack TriangularP pack lo diag up sh a
a
      UpLoSingleton lo up
MatrixShape.Upper -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray Packed diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a -> Triangular lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray pack diag lo up Shape Small Small sh sh a
-> PlainArray Packed diag lo up Shape Small Small sh sh a
forall uplo sh a pack mirror.
(UpLo uplo, C sh, Floating a) =>
Mosaic pack mirror uplo sh a -> Mosaic mirror uplo sh a
Mosaic.pack TriangularP pack lo diag up sh a
a

toSquare ::
   (MatrixShape.PowerStrip lo, MatrixShape.PowerStrip up,
    MatrixShape.TriDiag diag,
    Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a -> Square sh a
toSquare :: TriangularP pack lo diag up sh a -> Square sh a
toSquare = TriangularP pack lo diag up sh a -> Square sh a
forall meas vert horiz height width a pack property lower upper.
(Measure meas, C vert, C horiz, C height, C width, Floating a) =>
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> Full meas vert horiz height width a
OmniMatrix.toFull

takeLower ::
   (Omni.Property property, Omni.Strip upper) =>
   (Extent.Measure meas, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Unpacked property Filled upper meas Extent.Small horiz height width a ->
   Lower height a
takeLower :: Unpacked property Filled upper meas Small horiz height width a
-> Lower height a
takeLower = Array (LowerTriangularP Packed height) a -> Lower height a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (Array (LowerTriangularP Packed height) a -> Lower height a)
-> (Unpacked property Filled upper meas Small horiz height width a
    -> Array (LowerTriangularP Packed height) a)
-> Unpacked property Filled upper meas Small horiz height width a
-> Lower height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full meas Small horiz height width a
-> Array (LowerTriangularP Packed height) a
forall meas horiz height width a.
(Measure meas, C horiz, C height, C width, Floating a) =>
Full meas Small horiz height width a -> Lower height a
Basic.takeLower (Full meas Small horiz height width a
 -> Array (LowerTriangularP Packed height) a)
-> (Unpacked property Filled upper meas Small horiz height width a
    -> Full meas Small horiz height width a)
-> Unpacked property Filled upper meas Small horiz height width a
-> Array (LowerTriangularP Packed height) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unpacked property Filled upper meas Small horiz height width a
-> Full meas Small horiz height width a
forall property lower upper meas vert horiz height width a.
(Property property, Strip lower, Strip upper) =>
UnpackedMatrix property lower upper meas vert horiz height width a
-> FullArray meas vert horiz height width a
ArrMatrix.unpackedToVector

takeUpper ::
   (Omni.Property property, Omni.Strip lower) =>
   (Extent.Measure meas, Extent.C vert,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Unpacked property lower Filled meas vert Extent.Small height width a ->
   Upper width a
takeUpper :: Unpacked property lower Filled meas vert Small height width a
-> Upper width a
takeUpper = Array (UpperTriangularP Packed width) a -> Upper width a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (Array (UpperTriangularP Packed width) a -> Upper width a)
-> (Unpacked property lower Filled meas vert Small height width a
    -> Array (UpperTriangularP Packed width) a)
-> Unpacked property lower Filled meas vert Small height width a
-> Upper width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full meas vert Small height width a
-> Array (UpperTriangularP Packed width) a
forall meas vert height width a.
(Measure meas, C vert, C height, C width, Floating a) =>
Full meas vert Small height width a -> Upper width a
Basic.takeUpper (Full meas vert Small height width a
 -> Array (UpperTriangularP Packed width) a)
-> (Unpacked property lower Filled meas vert Small height width a
    -> Full meas vert Small height width a)
-> Unpacked property lower Filled meas vert Small height width a
-> Array (UpperTriangularP Packed width) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unpacked property lower Filled meas vert Small height width a
-> Full meas vert Small height width a
forall property lower upper meas vert horiz height width a.
(Property property, Strip lower, Strip upper) =>
UnpackedMatrix property lower upper meas vert horiz height width a
-> FullArray meas vert horiz height width a
ArrMatrix.unpackedToVector

fromLowerRowMajor ::
   (Shape.C sh, Class.Floating a) =>
   Array (Shape.Triangular Shape.Lower sh) a -> Lower sh a
fromLowerRowMajor :: Array (Triangular Lower sh) a -> Lower sh a
fromLowerRowMajor = Array (LowerTriangularP Packed sh) a -> Lower sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (Array (LowerTriangularP Packed sh) a -> Lower sh a)
-> (Array (Triangular Lower sh) a
    -> Array (LowerTriangularP Packed sh) a)
-> Array (Triangular Lower sh) a
-> Lower sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array (Triangular Lower sh) a
-> Array (LowerTriangularP Packed sh) a
forall sh a.
(C sh, Floating a) =>
Array (Triangular Lower sh) a -> Lower sh a
Basic.fromLowerRowMajor

fromUpperRowMajor ::
   (Shape.C sh, Class.Floating a) =>
   Array (Shape.Triangular Shape.Upper sh) a -> Upper sh a
fromUpperRowMajor :: Array (Triangular Upper sh) a -> Upper sh a
fromUpperRowMajor = Array (UpperTriangularP Packed sh) a -> Upper sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (Array (UpperTriangularP Packed sh) a -> Upper sh a)
-> (Array (Triangular Upper sh) a
    -> Array (UpperTriangularP Packed sh) a)
-> Array (Triangular Upper sh) a
-> Upper sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array (Triangular Upper sh) a
-> Array (UpperTriangularP Packed sh) a
forall sh a.
(C sh, Floating a) =>
Array (Triangular Upper sh) a -> Upper sh a
Basic.fromUpperRowMajor

toLowerRowMajor ::
   (Shape.C sh, Class.Floating a) =>
   Lower sh a -> Array (Shape.Triangular Shape.Lower sh) a
toLowerRowMajor :: Lower sh a -> Array (Triangular Lower sh) a
toLowerRowMajor = Lower sh a -> Array (Triangular Lower sh) a
forall sh a.
(C sh, Floating a) =>
Lower sh a -> Array (Triangular Lower sh) a
Basic.toLowerRowMajor (Lower sh a -> Array (Triangular Lower sh) a)
-> (Lower sh a -> Lower sh a)
-> Lower sh a
-> Array (Triangular Lower sh) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lower sh a -> Lower sh a
forall pack property lower upper meas vert horiz height width a.
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
ArrMatrix.toVector

toUpperRowMajor ::
   (Shape.C sh, Class.Floating a) =>
   Upper sh a -> Array (Shape.Triangular Shape.Upper sh) a
toUpperRowMajor :: Upper sh a -> Array (Triangular Upper sh) a
toUpperRowMajor = Upper sh a -> Array (Triangular Upper sh) a
forall sh a.
(C sh, Floating a) =>
Upper sh a -> Array (Triangular Upper sh) a
Basic.toUpperRowMajor (Upper sh a -> Array (Triangular Upper sh) a)
-> (Upper sh a -> Upper sh a)
-> Upper sh a
-> Array (Triangular Upper sh) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Upper sh a -> Upper sh a
forall pack property lower upper meas vert horiz height width a.
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
ArrMatrix.toVector

forceOrder ::
   (MatrixShape.PowerStrip lo, MatrixShape.PowerStrip up,
    MatrixShape.TriDiag diag,
    Shape.C sh, Class.Floating a) =>
   Order -> TriangularP pack lo diag up sh a -> TriangularP pack lo diag up sh a
forceOrder :: Order
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forceOrder = Order
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forall meas vert horiz height width a pack property lower upper.
(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
ArrMatrix.forceOrder

{- |
@adaptOrder x y@ contains the data of @y@ with the layout of @x@.
-}
adaptOrder ::
   (MatrixShape.PowerStrip lo, MatrixShape.PowerStrip up,
    MatrixShape.TriDiag diag,
    Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a ->
   TriangularP pack lo diag up sh a ->
   TriangularP pack lo diag up sh a
adaptOrder :: TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
adaptOrder = TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forall meas vert horiz height width a pack property lower upper.
(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
ArrMatrix.adaptOrder

add, sub ::
   (MatrixShape.PowerStrip lo, MatrixShape.PowerStrip up,
    Eq lo, Eq up, Eq sh, Shape.C sh, Class.Floating a) =>
   TriangularP pack lo Arbitrary up sh a ->
   TriangularP pack lo Arbitrary up sh a ->
   TriangularP pack lo Arbitrary up sh a
add :: TriangularP pack lo Arbitrary up sh a
-> TriangularP pack lo Arbitrary up sh a
-> TriangularP pack lo Arbitrary up sh a
add = TriangularP pack lo Arbitrary up sh a
-> TriangularP pack lo Arbitrary up sh a
-> TriangularP pack lo Arbitrary up sh a
forall meas vert horiz property height width a pack lower upper.
(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
ArrMatrix.add
sub :: TriangularP pack lo Arbitrary up sh a
-> TriangularP pack lo Arbitrary up sh a
-> TriangularP pack lo Arbitrary up sh a
sub = TriangularP pack lo Arbitrary up sh a
-> TriangularP pack lo Arbitrary up sh a
-> TriangularP pack lo Arbitrary up sh a
forall meas vert horiz property height width a pack lower upper.
(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
ArrMatrix.sub


{-
identity ::
   (MatrixShape.PowerStrip lo, MatrixShape.PowerStrip up,
    Shape.C sh, Class.Floating a) =>
   Order -> sh -> Triangular lo Unit up sh a
identity order = ArrMatrix.lift0 . Basic.identity order
-}

diagonal ::
   (MatrixShape.UpLo lo up, Shape.C sh, Class.Floating a) =>
   Order -> Vector sh a -> Triangular lo Arbitrary up sh a
diagonal :: Order -> Vector sh a -> Triangular lo Arbitrary up sh a
diagonal Order
order Vector sh a
v =
   Diagonal_ sh a lo up -> Triangular lo Arbitrary up sh a
forall sh a lo up.
Diagonal_ sh a lo up -> Triangular lo Arbitrary up sh a
getDiagonal (Diagonal_ sh a lo up -> Triangular lo Arbitrary up sh a)
-> Diagonal_ sh a lo up -> Triangular lo Arbitrary up sh a
forall a b. (a -> b) -> a -> b
$
   Diagonal_ sh a Empty Filled
-> Diagonal_ sh a Filled Empty -> Diagonal_ sh a lo up
forall lo up (f :: * -> * -> *).
UpLoC lo up =>
f Empty Filled -> f Filled Empty -> f lo up
MatrixShape.switchUpLo
      (Triangular Empty Arbitrary Filled sh a
-> Diagonal_ sh a Empty Filled
forall sh a lo up.
Triangular lo Arbitrary up sh a -> Diagonal_ sh a lo up
Diagonal (Triangular Empty Arbitrary Filled sh a
 -> Diagonal_ sh a Empty Filled)
-> Triangular Empty Arbitrary Filled sh a
-> Diagonal_ sh a Empty Filled
forall a b. (a -> b) -> a -> b
$ PlainArray Packed Arbitrary Empty Filled Shape Small Small sh sh a
-> Triangular Empty Arbitrary Filled sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (PlainArray Packed Arbitrary Empty Filled Shape Small Small sh sh a
 -> Triangular Empty Arbitrary Filled sh a)
-> PlainArray
     Packed Arbitrary Empty Filled Shape Small Small sh sh a
-> Triangular Empty Arbitrary Filled sh a
forall a b. (a -> b) -> a -> b
$ Order -> Vector sh a -> Mosaic NoMirror Upper sh a
forall mirror uplo sh a.
(Mirror mirror, UpLo uplo, C sh, Floating a) =>
Order -> Vector sh a -> Mosaic mirror uplo sh a
Packed.diagonal Order
order Vector sh a
v)
      (Triangular Filled Arbitrary Empty sh a
-> Diagonal_ sh a Filled Empty
forall sh a lo up.
Triangular lo Arbitrary up sh a -> Diagonal_ sh a lo up
Diagonal (Triangular Filled Arbitrary Empty sh a
 -> Diagonal_ sh a Filled Empty)
-> Triangular Filled Arbitrary Empty sh a
-> Diagonal_ sh a Filled Empty
forall a b. (a -> b) -> a -> b
$ PlainArray Packed Arbitrary Filled Empty Shape Small Small sh sh a
-> Triangular Filled Arbitrary Empty sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0 (PlainArray Packed Arbitrary Filled Empty Shape Small Small sh sh a
 -> Triangular Filled Arbitrary Empty sh a)
-> PlainArray
     Packed Arbitrary Filled Empty Shape Small Small sh sh a
-> Triangular Filled Arbitrary Empty sh a
forall a b. (a -> b) -> a -> b
$ Order -> Vector sh a -> Mosaic NoMirror Lower sh a
forall mirror uplo sh a.
(Mirror mirror, UpLo uplo, C sh, Floating a) =>
Order -> Vector sh a -> Mosaic mirror uplo sh a
Packed.diagonal Order
order Vector sh a
v)

newtype Diagonal_ sh a lo up =
   Diagonal {
      Diagonal_ sh a lo up -> Triangular lo Arbitrary up sh a
getDiagonal :: Triangular lo Arbitrary up sh a
   }

takeDiagonal ::
   (MatrixShape.PowerStrip lo, MatrixShape.PowerStrip up,
    MatrixShape.TriDiag diag,
    Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a -> Vector sh a
takeDiagonal :: TriangularP pack lo diag up sh a -> Vector sh a
takeDiagonal = TriangularP pack lo diag up sh a -> Vector sh a
forall sh a pack property lower upper.
(C sh, Floating a) =>
Quadratic pack property lower upper sh a -> Vector sh a
OmniMatrix.takeDiagonal



relaxUnitDiagonal ::
   (MatrixShape.TriDiag diag) =>
   TriangularP pack lo Unit up sh a -> TriangularP pack lo diag up sh a
relaxUnitDiagonal :: TriangularP pack lo Unit up sh a
-> TriangularP pack lo diag up sh a
relaxUnitDiagonal a :: TriangularP pack lo Unit up sh a
a@(ArrMatrix.Array _arr) =
   case TriangularP pack lo Unit up sh a
-> Omni pack Unit lo up Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width a.
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> Omni pack property lower upper meas vert horiz height width
ArrMatrix.shape TriangularP pack lo Unit up sh a
a of
      Omni.Full Full Shape Small Small sh sh
_ -> (FullArray Shape Small Small sh sh a
 -> FullArray Shape Small Small sh sh a)
-> UnpackedMatrix Unit lo up Shape Small Small sh sh a
-> UnpackedMatrix diag lo up Shape Small Small sh sh a
forall propertyA lowerA upperA propertyB lowerB upperB measA vertA
       horizA heightA widthA a measB vertB horizB heightB widthB b.
(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
ArrMatrix.liftUnpacked1 FullArray Shape Small Small sh sh a
-> FullArray Shape Small Small sh sh a
forall a. a -> a
id TriangularP pack lo Unit up sh a
UnpackedMatrix Unit lo up Shape Small Small sh sh a
a
      Omni.LowerTriangular LowerTriangular sh
_ -> (PlainArray pack Unit lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo Unit up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray pack Unit lo up Shape Small Small sh sh a
-> PlainArray pack diag lo up Shape Small Small sh sh a
forall a. a -> a
id TriangularP pack lo Unit up sh a
a
      Omni.UpperTriangular UpperTriangular sh
_ -> (PlainArray pack Unit lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo Unit up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray pack Unit lo up Shape Small Small sh sh a
-> PlainArray pack diag lo up Shape Small Small sh sh a
forall a. a -> a
id TriangularP pack lo Unit up sh a
a
      Omni.UnitBandedTriangular BandedSquare sub super sh
_ ->
         let m :: TriangularP pack lo diag up sh a
m =
               case TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
m of
                  DiagSingleton diag
Omni.Unit -> TriangularP pack lo diag up sh a
TriangularP pack lo Unit up sh a
a
                  DiagSingleton diag
Omni.Arbitrary -> (PlainArray pack Unit lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo Unit up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray pack Unit lo up Shape Small Small sh sh a
-> PlainArray pack diag lo up Shape Small Small sh sh a
forall a. a -> a
id TriangularP pack lo Unit up sh a
a
         in TriangularP pack lo diag up sh a
m

strictArbitraryDiagonal ::
   (MatrixShape.TriDiag diag) =>
   TriangularP pack lo diag up sh a -> TriangularP pack lo Arbitrary up sh a
strictArbitraryDiagonal :: TriangularP pack lo diag up sh a
-> TriangularP pack lo Arbitrary up sh a
strictArbitraryDiagonal TriangularP pack lo diag up sh a
a =
   case TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a of
      DiagSingleton diag
Omni.Arbitrary -> TriangularP pack lo diag up sh a
TriangularP pack lo Arbitrary up sh a
a
      DiagSingleton diag
Omni.Unit ->
         case TriangularP pack lo diag up sh a
-> Omni pack diag lo up Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width a.
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> Omni pack property lower upper meas vert horiz height width
ArrMatrix.shape TriangularP pack lo diag up sh a
a of
            Omni.Full Full Shape Small Small sh sh
_ -> (FullArray Shape Small Small sh sh a
 -> FullArray Shape Small Small sh sh a)
-> UnpackedMatrix diag lo up Shape Small Small sh sh a
-> UnpackedMatrix Arbitrary lo up Shape Small Small sh sh a
forall propertyA lowerA upperA propertyB lowerB upperB measA vertA
       horizA heightA widthA a measB vertB horizB heightB widthB b.
(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
ArrMatrix.liftUnpacked1 FullArray Shape Small Small sh sh a
-> FullArray Shape Small Small sh sh a
forall a. a -> a
id TriangularP pack lo diag up sh a
UnpackedMatrix diag lo up Shape Small Small sh sh a
a
            Omni.LowerTriangular LowerTriangular sh
_ -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack Arbitrary lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo Arbitrary up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray pack diag lo up Shape Small Small sh sh a
-> PlainArray pack Arbitrary lo up Shape Small Small sh sh a
forall a. a -> a
id TriangularP pack lo diag up sh a
a
            Omni.UpperTriangular UpperTriangular sh
_ -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack Arbitrary lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo Arbitrary up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray pack diag lo up Shape Small Small sh sh a
-> PlainArray pack Arbitrary lo up Shape Small Small sh sh a
forall a. a -> a
id TriangularP pack lo diag up sh a
a
            Omni.UnitBandedTriangular BandedSquare sub super sh
_ -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack Arbitrary lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo Arbitrary up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray pack diag lo up Shape Small Small sh sh a
-> PlainArray pack Arbitrary lo up Shape Small Small sh sh a
forall a. a -> a
id TriangularP pack lo diag up sh a
a


infixr 2 %%%#
infixl 2 #%%%

stackLower ::
   (Layout.Packing pack, MatrixShape.TriDiag diag,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   FlexLowerP pack diag sh0 a ->
   General sh1 sh0 a ->
   FlexLowerP pack diag sh1 a ->
   FlexLowerP pack diag (sh0::+sh1) a
stackLower :: FlexLowerP pack diag sh0 a
-> General sh1 sh0 a
-> FlexLowerP pack diag sh1 a
-> FlexLowerP pack diag (sh0 ::+ sh1) a
stackLower FlexLowerP pack diag sh0 a
a0 =
   case FlexLowerP pack diag sh0 a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag FlexLowerP pack diag sh0 a
a0 of
      PackingSingleton pack
Layout.Packed -> (PlainArray pack diag Filled Empty Shape Small Small sh0 sh0 a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big sh1 sh0 a
 -> PlainArray pack diag Filled Empty Shape Small Small sh1 sh1 a
 -> PlainArray
      pack
      diag
      Filled
      Empty
      Shape
      Small
      Small
      (sh0 ::+ sh1)
      (sh0 ::+ sh1)
      a)
-> FlexLowerP pack diag sh0 a
-> General sh1 sh0 a
-> FlexLowerP pack diag sh1 a
-> FlexLowerP pack diag (sh0 ::+ sh1) a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC packD propD
       lowerD upperD measD vertD horizD heightD widthD a b c d.
(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
ArrMatrix.lift3 PlainArray pack diag Filled Empty Shape Small Small sh0 sh0 a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big sh1 sh0 a
-> PlainArray pack diag Filled Empty Shape Small Small sh1 sh1 a
-> PlainArray
     pack
     diag
     Filled
     Empty
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
forall height width a mirror.
(C height, Eq height, C width, Eq width, Floating a) =>
MosaicLower mirror width a
-> General height width a
-> MosaicLower mirror height a
-> MosaicLower mirror (width ::+ height) a
Packed.stackLower FlexLowerP pack diag sh0 a
a0
      PackingSingleton pack
Layout.Unpacked -> ((FlexLowerP pack diag sh0 a
 -> General sh1 sh0 a
 -> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
 -> UnpackedMatrix
      diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> FlexLowerP pack diag sh0 a
-> General sh1 sh0 a
-> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall a b. (a -> b) -> a -> b
$FlexLowerP pack diag sh0 a
a0) ((FlexLowerP pack diag sh0 a
  -> General sh1 sh0 a
  -> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
  -> UnpackedMatrix
       diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
 -> General sh1 sh0 a
 -> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
 -> UnpackedMatrix
      diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> (FlexLowerP pack diag sh0 a
    -> General sh1 sh0 a
    -> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
    -> UnpackedMatrix
         diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> General sh1 sh0 a
-> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall a b. (a -> b) -> a -> b
$
         (FullArray Shape Small Small sh0 sh0 a
 -> FullArray Size Big Big sh1 sh0 a
 -> FullArray Shape Small Small sh1 sh1 a
 -> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> UnpackedMatrix diag Filled Empty Shape Small Small sh0 sh0 a
-> General sh1 sh0 a
-> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall propertyA lowerA upperA propertyB lowerB upperB propertyC
       lowerC upperC propertyD lowerD upperD measA vertA horizA heightA
       widthA a measB vertB horizB heightB widthB b measC vertC horizC
       heightC widthC c measD vertD horizD heightD widthD d.
(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
ArrMatrix.liftUnpacked3 ((FullArray Shape Small Small sh0 sh0 a
  -> FullArray Size Big Big sh1 sh0 a
  -> FullArray Shape Small Small sh1 sh1 a
  -> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
 -> UnpackedMatrix diag Filled Empty Shape Small Small sh0 sh0 a
 -> General sh1 sh0 a
 -> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
 -> UnpackedMatrix
      diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> (FullArray Shape Small Small sh0 sh0 a
    -> FullArray Size Big Big sh1 sh0 a
    -> FullArray Shape Small Small sh1 sh1 a
    -> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> UnpackedMatrix diag Filled Empty Shape Small Small sh0 sh0 a
-> General sh1 sh0 a
-> UnpackedMatrix diag Filled Empty Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     diag Filled Empty Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall a b. (a -> b) -> a -> b
$ \FullArray Shape Small Small sh0 sh0 a
a FullArray Size Big Big sh1 sh0 a
b FullArray Shape Small Small sh1 sh1 a
c ->
            FullArray Shape Small Small sh0 sh0 a
-> General sh0 sh1 a
-> FullArray Size Big Big sh1 sh0 a
-> FullArray Shape Small Small sh1 sh1 a
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall shA shB a.
(C shA, Eq shA, C shB, Eq shB, Floating a) =>
Square shA a
-> General shA shB a
-> General shB shA a
-> Square shB a
-> Square (shA ::+ shB) a
FullBasic.stackMosaic
               FullArray Shape Small Small sh0 sh0 a
a (Full Size Big Big sh0 sh1 -> General sh0 sh1 a
forall sh a. (C sh, Floating a) => sh -> Vector sh a
Vector.zero (Full Size Big Big sh0 sh1 -> General sh0 sh1 a)
-> Full Size Big Big sh0 sh1 -> General sh0 sh1 a
forall a b. (a -> b) -> a -> b
$ Full Size Big Big sh1 sh0 -> Full Size Big Big sh0 sh1
forall meas vert horiz height width.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width
-> Full meas horiz vert width height
Layout.inverse (Full Size Big Big sh1 sh0 -> Full Size Big Big sh0 sh1)
-> Full Size Big Big sh1 sh0 -> Full Size Big Big sh0 sh1
forall a b. (a -> b) -> a -> b
$ FullArray Size Big Big sh1 sh0 a -> Full Size Big Big sh1 sh0
forall sh a. Array sh a -> sh
Array.shape FullArray Size Big Big sh1 sh0 a
b)
               FullArray Size Big Big sh1 sh0 a
b FullArray Shape Small Small sh1 sh1 a
c

(#%%%) ::
   (Layout.Packing pack, MatrixShape.TriDiag diag,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   FlexLowerP pack diag sh0 a ->
   (General sh1 sh0 a, FlexLowerP pack diag sh1 a) ->
   FlexLowerP pack diag (sh0::+sh1) a
#%%% :: FlexLowerP pack diag sh0 a
-> (General sh1 sh0 a, FlexLowerP pack diag sh1 a)
-> FlexLowerP pack diag (sh0 ::+ sh1) a
(#%%%) = (General sh1 sh0 a
 -> FlexLowerP pack diag sh1 a
 -> FlexLowerP pack diag (sh0 ::+ sh1) a)
-> (General sh1 sh0 a, FlexLowerP pack diag sh1 a)
-> FlexLowerP pack diag (sh0 ::+ sh1) a
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ((General sh1 sh0 a
  -> FlexLowerP pack diag sh1 a
  -> FlexLowerP pack diag (sh0 ::+ sh1) a)
 -> (General sh1 sh0 a, FlexLowerP pack diag sh1 a)
 -> FlexLowerP pack diag (sh0 ::+ sh1) a)
-> (FlexLowerP pack diag sh0 a
    -> General sh1 sh0 a
    -> FlexLowerP pack diag sh1 a
    -> FlexLowerP pack diag (sh0 ::+ sh1) a)
-> FlexLowerP pack diag sh0 a
-> (General sh1 sh0 a, FlexLowerP pack diag sh1 a)
-> FlexLowerP pack diag (sh0 ::+ sh1) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FlexLowerP pack diag sh0 a
-> General sh1 sh0 a
-> FlexLowerP pack diag sh1 a
-> FlexLowerP pack diag (sh0 ::+ sh1) a
forall 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
stackLower

stackUpper ::
   (Layout.Packing pack, MatrixShape.TriDiag diag,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   FlexUpperP pack diag sh0 a ->
   General sh0 sh1 a ->
   FlexUpperP pack diag sh1 a ->
   FlexUpperP pack diag (sh0::+sh1) a
stackUpper :: FlexUpperP pack diag sh0 a
-> General sh0 sh1 a
-> FlexUpperP pack diag sh1 a
-> FlexUpperP pack diag (sh0 ::+ sh1) a
stackUpper FlexUpperP pack diag sh0 a
a0 =
   case FlexUpperP pack diag sh0 a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag FlexUpperP pack diag sh0 a
a0 of
      PackingSingleton pack
Layout.Packed -> (PlainArray pack diag Empty Filled Shape Small Small sh0 sh0 a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big sh0 sh1 a
 -> PlainArray pack diag Empty Filled Shape Small Small sh1 sh1 a
 -> PlainArray
      pack
      diag
      Empty
      Filled
      Shape
      Small
      Small
      (sh0 ::+ sh1)
      (sh0 ::+ sh1)
      a)
-> FlexUpperP pack diag sh0 a
-> General sh0 sh1 a
-> FlexUpperP pack diag sh1 a
-> FlexUpperP pack diag (sh0 ::+ sh1) a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC packD propD
       lowerD upperD measD vertD horizD heightD widthD a b c d.
(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
ArrMatrix.lift3 PlainArray pack diag Empty Filled Shape Small Small sh0 sh0 a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big sh0 sh1 a
-> PlainArray pack diag Empty Filled Shape Small Small sh1 sh1 a
-> PlainArray
     pack
     diag
     Empty
     Filled
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
forall height width a mirror.
(C height, Eq height, C width, Eq width, Floating a) =>
MosaicUpper mirror height a
-> General height width a
-> MosaicUpper mirror width a
-> MosaicUpper mirror (height ::+ width) a
Packed.stackUpper FlexUpperP pack diag sh0 a
a0
      PackingSingleton pack
Layout.Unpacked -> ((FlexUpperP pack diag sh0 a
 -> General sh0 sh1 a
 -> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
 -> UnpackedMatrix
      diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> FlexUpperP pack diag sh0 a
-> General sh0 sh1 a
-> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall a b. (a -> b) -> a -> b
$FlexUpperP pack diag sh0 a
a0) ((FlexUpperP pack diag sh0 a
  -> General sh0 sh1 a
  -> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
  -> UnpackedMatrix
       diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
 -> General sh0 sh1 a
 -> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
 -> UnpackedMatrix
      diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> (FlexUpperP pack diag sh0 a
    -> General sh0 sh1 a
    -> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
    -> UnpackedMatrix
         diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> General sh0 sh1 a
-> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall a b. (a -> b) -> a -> b
$
         (FullArray Shape Small Small sh0 sh0 a
 -> FullArray Size Big Big sh0 sh1 a
 -> FullArray Shape Small Small sh1 sh1 a
 -> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> UnpackedMatrix diag Empty Filled Shape Small Small sh0 sh0 a
-> General sh0 sh1 a
-> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall propertyA lowerA upperA propertyB lowerB upperB propertyC
       lowerC upperC propertyD lowerD upperD measA vertA horizA heightA
       widthA a measB vertB horizB heightB widthB b measC vertC horizC
       heightC widthC c measD vertD horizD heightD widthD d.
(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
ArrMatrix.liftUnpacked3 ((FullArray Shape Small Small sh0 sh0 a
  -> FullArray Size Big Big sh0 sh1 a
  -> FullArray Shape Small Small sh1 sh1 a
  -> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
 -> UnpackedMatrix diag Empty Filled Shape Small Small sh0 sh0 a
 -> General sh0 sh1 a
 -> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
 -> UnpackedMatrix
      diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> (FullArray Shape Small Small sh0 sh0 a
    -> FullArray Size Big Big sh0 sh1 a
    -> FullArray Shape Small Small sh1 sh1 a
    -> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> UnpackedMatrix diag Empty Filled Shape Small Small sh0 sh0 a
-> General sh0 sh1 a
-> UnpackedMatrix diag Empty Filled Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     diag Empty Filled Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall a b. (a -> b) -> a -> b
$ \FullArray Shape Small Small sh0 sh0 a
a FullArray Size Big Big sh0 sh1 a
b FullArray Shape Small Small sh1 sh1 a
c ->
            FullArray Shape Small Small sh0 sh0 a
-> FullArray Size Big Big sh0 sh1 a
-> General sh1 sh0 a
-> FullArray Shape Small Small sh1 sh1 a
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall shA shB a.
(C shA, Eq shA, C shB, Eq shB, Floating a) =>
Square shA a
-> General shA shB a
-> General shB shA a
-> Square shB a
-> Square (shA ::+ shB) a
FullBasic.stackMosaic FullArray Shape Small Small sh0 sh0 a
a FullArray Size Big Big sh0 sh1 a
b
               (Full Size Big Big sh1 sh0 -> General sh1 sh0 a
forall sh a. (C sh, Floating a) => sh -> Vector sh a
Vector.zero (Full Size Big Big sh1 sh0 -> General sh1 sh0 a)
-> Full Size Big Big sh1 sh0 -> General sh1 sh0 a
forall a b. (a -> b) -> a -> b
$ Full Size Big Big sh0 sh1 -> Full Size Big Big sh1 sh0
forall meas vert horiz height width.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width
-> Full meas horiz vert width height
Layout.inverse (Full Size Big Big sh0 sh1 -> Full Size Big Big sh1 sh0)
-> Full Size Big Big sh0 sh1 -> Full Size Big Big sh1 sh0
forall a b. (a -> b) -> a -> b
$ FullArray Size Big Big sh0 sh1 a -> Full Size Big Big sh0 sh1
forall sh a. Array sh a -> sh
Array.shape FullArray Size Big Big sh0 sh1 a
b) FullArray Shape Small Small sh1 sh1 a
c

(%%%#) ::
   (Layout.Packing pack, MatrixShape.TriDiag diag,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   (FlexUpperP pack diag sh0 a, General sh0 sh1 a) ->
   FlexUpperP pack diag sh1 a ->
   FlexUpperP pack diag (sh0::+sh1) a
%%%# :: (FlexUpperP pack diag sh0 a, General sh0 sh1 a)
-> FlexUpperP pack diag sh1 a
-> FlexUpperP pack diag (sh0 ::+ sh1) a
(%%%#) = (FlexUpperP pack diag sh0 a
 -> General sh0 sh1 a
 -> FlexUpperP pack diag sh1 a
 -> FlexUpperP pack diag (sh0 ::+ sh1) a)
-> (FlexUpperP pack diag sh0 a, General sh0 sh1 a)
-> FlexUpperP pack diag sh1 a
-> FlexUpperP pack diag (sh0 ::+ sh1) a
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry FlexUpperP pack diag sh0 a
-> General sh0 sh1 a
-> FlexUpperP pack diag sh1 a
-> FlexUpperP pack diag (sh0 ::+ sh1) a
forall 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
stackUpper


splitLower ::
   (Layout.Packing pack, MatrixShape.TriDiag diag,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   FlexLowerP pack diag (sh0::+sh1) a ->
   (FlexLowerP pack diag sh0 a, General sh1 sh0 a, FlexLowerP pack diag sh1 a)
splitLower :: FlexLowerP pack diag (sh0 ::+ sh1) a
-> (FlexLowerP pack diag sh0 a, General sh1 sh0 a,
    FlexLowerP pack diag sh1 a)
splitLower FlexLowerP pack diag (sh0 ::+ sh1) a
a = (FlexLowerP pack diag (sh0 ::+ sh1) a -> FlexLowerP pack diag sh0 a
forall pack lo up diag sh0 sh1 a.
(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
takeTopLeft FlexLowerP pack diag (sh0 ::+ sh1) a
a, FlexLowerP pack diag (sh0 ::+ sh1) a -> General sh1 sh0 a
forall pack diag sh0 sh1 a.
(Packing pack, TriDiag diag, C sh0, C sh1, Floating a) =>
FlexLowerP pack diag (sh0 ::+ sh1) a -> General sh1 sh0 a
takeBottomLeft FlexLowerP pack diag (sh0 ::+ sh1) a
a, FlexLowerP pack diag (sh0 ::+ sh1) a -> FlexLowerP pack diag sh1 a
forall pack lo up diag sh0 sh1 a.
(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
takeBottomRight FlexLowerP pack diag (sh0 ::+ sh1) a
a)

splitUpper ::
   (Layout.Packing pack, MatrixShape.TriDiag diag,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   FlexUpperP pack diag (sh0::+sh1) a ->
   (FlexUpperP pack diag sh0 a, General sh0 sh1 a, FlexUpperP pack diag sh1 a)
splitUpper :: FlexUpperP pack diag (sh0 ::+ sh1) a
-> (FlexUpperP pack diag sh0 a, General sh0 sh1 a,
    FlexUpperP pack diag sh1 a)
splitUpper FlexUpperP pack diag (sh0 ::+ sh1) a
a = (FlexUpperP pack diag (sh0 ::+ sh1) a -> FlexUpperP pack diag sh0 a
forall pack lo up diag sh0 sh1 a.
(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
takeTopLeft FlexUpperP pack diag (sh0 ::+ sh1) a
a, FlexUpperP pack diag (sh0 ::+ sh1) a -> General sh0 sh1 a
forall pack diag sh0 sh1 a.
(Packing pack, TriDiag diag, C sh0, C sh1, Floating a) =>
FlexUpperP pack diag (sh0 ::+ sh1) a -> General sh0 sh1 a
takeTopRight FlexUpperP pack diag (sh0 ::+ sh1) a
a, FlexUpperP pack diag (sh0 ::+ sh1) a -> FlexUpperP pack diag sh1 a
forall pack lo up diag sh0 sh1 a.
(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
takeBottomRight FlexUpperP pack diag (sh0 ::+ sh1) a
a)


takeTopLeft ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   TriangularP pack lo diag up (sh0::+sh1) a ->
   TriangularP pack lo diag up sh0 a
takeTopLeft :: TriangularP pack lo diag up (sh0 ::+ sh1) a
-> TriangularP pack lo diag up sh0 a
takeTopLeft TriangularP pack lo diag up (sh0 ::+ sh1) a
a =
   case TriangularP pack lo diag up (sh0 ::+ sh1) a
-> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag TriangularP pack lo diag up (sh0 ::+ sh1) a
a of
      PackingSingleton pack
Layout.Unpacked -> Quadratic diag lo up (sh0 ::+ sh1) a -> Quadratic diag lo up sh0 a
forall property lower upper sh0 sh1 a.
(Property property, Strip lower, Strip upper, C sh0, C sh1,
 Floating a) =>
Quadratic property lower upper (sh0 ::+ sh1) a
-> Quadratic property lower upper sh0 a
ArrUnpacked.takeTopLeft TriangularP pack lo diag up (sh0 ::+ sh1) a
Quadratic diag lo up (sh0 ::+ sh1) a
a
      PackingSingleton pack
Layout.Packed ->
         case TriangularP pack lo diag up (sh0 ::+ sh1) a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up (sh0 ::+ sh1) a
a of
            UpLoSingleton lo up
MatrixShape.Lower -> (PlainArray
   pack diag lo up Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> PlainArray pack diag lo up Shape Small Small sh0 sh0 a)
-> TriangularP pack lo diag up (sh0 ::+ sh1) a
-> TriangularP pack lo diag up sh0 a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray
  pack diag lo up Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> PlainArray pack diag lo up Shape Small Small sh0 sh0 a
forall uplo height width a mirror.
(UpLo uplo, C height, C width, Floating a) =>
Mosaic mirror uplo (height ::+ width) a
-> Mosaic mirror uplo height a
Packed.takeTopLeft TriangularP pack lo diag up (sh0 ::+ sh1) a
a
            UpLoSingleton lo up
MatrixShape.Upper -> (PlainArray
   pack diag lo up Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> PlainArray pack diag lo up Shape Small Small sh0 sh0 a)
-> TriangularP pack lo diag up (sh0 ::+ sh1) a
-> TriangularP pack lo diag up sh0 a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray
  pack diag lo up Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> PlainArray pack diag lo up Shape Small Small sh0 sh0 a
forall uplo height width a mirror.
(UpLo uplo, C height, C width, Floating a) =>
Mosaic mirror uplo (height ::+ width) a
-> Mosaic mirror uplo height a
Packed.takeTopLeft TriangularP pack lo diag up (sh0 ::+ sh1) a
a

takeBottomLeft ::
   (Layout.Packing pack, MatrixShape.TriDiag diag,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   FlexLowerP pack diag (sh0::+sh1) a -> General sh1 sh0 a
takeBottomLeft :: FlexLowerP pack diag (sh0 ::+ sh1) a -> General sh1 sh0 a
takeBottomLeft FlexLowerP pack diag (sh0 ::+ sh1) a
a =
   case FlexLowerP pack diag (sh0 ::+ sh1) a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag FlexLowerP pack diag (sh0 ::+ sh1) a
a of
      PackingSingleton pack
Layout.Packed -> (PlainArray
   pack
   diag
   Filled
   Empty
   Shape
   Small
   Small
   (sh0 ::+ sh1)
   (sh0 ::+ sh1)
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big sh1 sh0 a)
-> FlexLowerP pack diag (sh0 ::+ sh1) a -> General sh1 sh0 a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray
  pack
  diag
  Filled
  Empty
  Shape
  Small
  Small
  (sh0 ::+ sh1)
  (sh0 ::+ sh1)
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big sh1 sh0 a
forall height width a mirror.
(C height, C width, Floating a) =>
MosaicLower mirror (width ::+ height) a -> General height width a
Packed.takeBottomLeft FlexLowerP pack diag (sh0 ::+ sh1) a
a
      PackingSingleton pack
Layout.Unpacked -> Quadratic diag Filled Empty (sh0 ::+ sh1) a -> General sh1 sh0 a
forall property lower upper sh0 sh1 a.
(Property property, Strip lower, Strip upper, C sh0, C sh1,
 Floating a) =>
Quadratic property lower upper (sh0 ::+ sh1) a -> General sh1 sh0 a
ArrUnpacked.takeBottomLeft FlexLowerP pack diag (sh0 ::+ sh1) a
Quadratic diag Filled Empty (sh0 ::+ sh1) a
a

takeTopRight ::
   (Layout.Packing pack, MatrixShape.TriDiag diag,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   FlexUpperP pack diag (sh0::+sh1) a -> General sh0 sh1 a
takeTopRight :: FlexUpperP pack diag (sh0 ::+ sh1) a -> General sh0 sh1 a
takeTopRight FlexUpperP pack diag (sh0 ::+ sh1) a
a =
   case FlexUpperP pack diag (sh0 ::+ sh1) a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag FlexUpperP pack diag (sh0 ::+ sh1) a
a of
      PackingSingleton pack
Layout.Packed -> (PlainArray
   pack
   diag
   Empty
   Filled
   Shape
   Small
   Small
   (sh0 ::+ sh1)
   (sh0 ::+ sh1)
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big sh0 sh1 a)
-> FlexUpperP pack diag (sh0 ::+ sh1) a -> General sh0 sh1 a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray
  pack
  diag
  Empty
  Filled
  Shape
  Small
  Small
  (sh0 ::+ sh1)
  (sh0 ::+ sh1)
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big sh0 sh1 a
forall height width a mirror.
(C height, C width, Floating a) =>
MosaicUpper mirror (height ::+ width) a -> General height width a
Packed.takeTopRight FlexUpperP pack diag (sh0 ::+ sh1) a
a
      PackingSingleton pack
Layout.Unpacked -> Quadratic diag Empty Filled (sh0 ::+ sh1) a -> General sh0 sh1 a
forall property lower upper sh0 sh1 a.
(Property property, Strip lower, Strip upper, C sh0, C sh1,
 Floating a) =>
Quadratic property lower upper (sh0 ::+ sh1) a -> General sh0 sh1 a
ArrUnpacked.takeTopRight FlexUpperP pack diag (sh0 ::+ sh1) a
Quadratic diag Empty Filled (sh0 ::+ sh1) a
a

takeBottomRight ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   TriangularP pack lo diag up (sh0::+sh1) a ->
   TriangularP pack lo diag up sh1 a
takeBottomRight :: TriangularP pack lo diag up (sh0 ::+ sh1) a
-> TriangularP pack lo diag up sh1 a
takeBottomRight TriangularP pack lo diag up (sh0 ::+ sh1) a
a =
   case TriangularP pack lo diag up (sh0 ::+ sh1) a
-> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag TriangularP pack lo diag up (sh0 ::+ sh1) a
a of
      PackingSingleton pack
Layout.Unpacked -> Quadratic diag lo up (sh0 ::+ sh1) a -> Quadratic diag lo up sh1 a
forall property lower upper sh0 sh1 a.
(Property property, Strip lower, Strip upper, C sh0, C sh1,
 Floating a) =>
Quadratic property lower upper (sh0 ::+ sh1) a
-> Quadratic property lower upper sh1 a
ArrUnpacked.takeBottomRight TriangularP pack lo diag up (sh0 ::+ sh1) a
Quadratic diag lo up (sh0 ::+ sh1) a
a
      PackingSingleton pack
Layout.Packed ->
         case TriangularP pack lo diag up (sh0 ::+ sh1) a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up (sh0 ::+ sh1) a
a of
            UpLoSingleton lo up
MatrixShape.Lower -> (PlainArray
   pack diag lo up Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> PlainArray pack diag lo up Shape Small Small sh1 sh1 a)
-> TriangularP pack lo diag up (sh0 ::+ sh1) a
-> TriangularP pack lo diag up sh1 a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray
  pack diag lo up Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> PlainArray pack diag lo up Shape Small Small sh1 sh1 a
forall uplo height width a mirror.
(UpLo uplo, C height, C width, Floating a) =>
Mosaic mirror uplo (height ::+ width) a
-> Mosaic mirror uplo width a
Packed.takeBottomRight TriangularP pack lo diag up (sh0 ::+ sh1) a
a
            UpLoSingleton lo up
MatrixShape.Upper -> (PlainArray
   pack diag lo up Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> PlainArray pack diag lo up Shape Small Small sh1 sh1 a)
-> TriangularP pack lo diag up (sh0 ::+ sh1) a
-> TriangularP pack lo diag up sh1 a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 PlainArray
  pack diag lo up Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> PlainArray pack diag lo up Shape Small Small sh1 sh1 a
forall uplo height width a mirror.
(UpLo uplo, C height, C width, Floating a) =>
Mosaic mirror uplo (height ::+ width) a
-> Mosaic mirror uplo width a
Packed.takeBottomRight TriangularP pack lo diag up (sh0 ::+ sh1) a
a


uploTag ::
   (MatrixShape.UpLo lo up) =>
   TriangularP pack lo diag up sh a -> MatrixShape.UpLoSingleton lo up
uploTag :: TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up sh a
_ = UpLoSingleton lo up
forall lo up. UpLo lo up => UpLoSingleton lo up
MatrixShape.autoUplo


multiplyVector ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Shape.C sh, Eq sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a -> Vector sh a -> Vector sh a
multiplyVector :: TriangularP pack lo diag up sh a -> Vector sh a -> Vector sh a
multiplyVector TriangularP pack lo diag up sh a
a =
   case TriangularP pack lo diag up sh a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up sh a
a of
      UpLoSingleton lo up
MatrixShape.Upper ->
         DiagSingleton diag
-> TriangularP pack Upper sh a -> Vector sh a -> Vector sh a
forall uplo diag sh a pack.
(UpLo uplo, TriDiag diag, C sh, Eq sh, Floating a) =>
DiagSingleton diag
-> TriangularP pack uplo sh a -> Vector sh a -> Vector sh a
Basic.multiplyVector (TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) (TriangularP pack Upper sh a -> Vector sh a -> Vector sh a)
-> TriangularP pack Upper sh a -> Vector sh a -> Vector sh a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a
-> PlainArray pack diag lo up Shape Small Small sh sh a
forall pack property lower upper meas vert horiz height width a.
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
ArrMatrix.toVector TriangularP pack lo diag up sh a
a
      UpLoSingleton lo up
MatrixShape.Lower ->
         DiagSingleton diag
-> TriangularP pack Lower sh a -> Vector sh a -> Vector sh a
forall uplo diag sh a pack.
(UpLo uplo, TriDiag diag, C sh, Eq sh, Floating a) =>
DiagSingleton diag
-> TriangularP pack uplo sh a -> Vector sh a -> Vector sh a
Basic.multiplyVector (TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) (TriangularP pack Lower sh a -> Vector sh a -> Vector sh a)
-> TriangularP pack Lower sh a -> Vector sh a -> Vector sh a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a
-> PlainArray pack diag lo up Shape Small Small sh sh a
forall pack property lower upper meas vert horiz height width a.
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
ArrMatrix.toVector TriangularP pack lo diag up sh a
a

square ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a ->
   TriangularP pack lo diag up sh a
square :: TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
square TriangularP pack lo diag up sh a
a =
   case TriangularP pack lo diag up sh a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up sh a
a of
      UpLoSingleton lo up
MatrixShape.Upper -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 (DiagSingleton diag
-> Mosaic pack NoMirror Upper sh a
-> Mosaic pack NoMirror Upper sh a
forall pack diag uplo sh a mirror.
(Packing pack, TriDiag diag, UpLo uplo, C sh, Floating a) =>
DiagSingleton diag
-> Mosaic pack mirror uplo sh a -> Mosaic pack mirror uplo sh a
Mosaic.square (DiagSingleton diag
 -> Mosaic pack NoMirror Upper sh a
 -> Mosaic pack NoMirror Upper sh a)
-> DiagSingleton diag
-> Mosaic pack NoMirror Upper sh a
-> Mosaic pack NoMirror Upper sh a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) TriangularP pack lo diag up sh a
a
      UpLoSingleton lo up
MatrixShape.Lower -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 (DiagSingleton diag
-> Mosaic pack NoMirror Lower sh a
-> Mosaic pack NoMirror Lower sh a
forall pack diag uplo sh a mirror.
(Packing pack, TriDiag diag, UpLo uplo, C sh, Floating a) =>
DiagSingleton diag
-> Mosaic pack mirror uplo sh a -> Mosaic pack mirror uplo sh a
Mosaic.square (DiagSingleton diag
 -> Mosaic pack NoMirror Lower sh a
 -> Mosaic pack NoMirror Lower sh a)
-> DiagSingleton diag
-> Mosaic pack NoMirror Lower sh a
-> Mosaic pack NoMirror Lower sh a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) TriangularP pack lo diag up sh a
a

multiply ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Shape.C sh, Eq sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a ->
   TriangularP pack lo diag up sh a ->
   TriangularP pack lo diag up sh a
multiply :: TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
multiply TriangularP pack lo diag up sh a
a =
   case TriangularP pack lo diag up sh a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up sh a
a of
      UpLoSingleton lo up
MatrixShape.Upper -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(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
ArrMatrix.lift2 (DiagSingleton diag
-> TriangularP pack Upper sh a
-> TriangularP pack Upper sh a
-> TriangularP pack Upper sh a
forall pack uplo diag sh a.
(Packing pack, UpLo uplo, TriDiag diag, C sh, Eq sh, Floating a) =>
DiagSingleton diag
-> TriangularP pack uplo sh a
-> TriangularP pack uplo sh a
-> TriangularP pack uplo sh a
Basic.multiply (DiagSingleton diag
 -> TriangularP pack Upper sh a
 -> TriangularP pack Upper sh a
 -> TriangularP pack Upper sh a)
-> DiagSingleton diag
-> TriangularP pack Upper sh a
-> TriangularP pack Upper sh a
-> TriangularP pack Upper sh a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) TriangularP pack lo diag up sh a
a
      UpLoSingleton lo up
MatrixShape.Lower -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(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
ArrMatrix.lift2 (DiagSingleton diag
-> TriangularP pack Lower sh a
-> TriangularP pack Lower sh a
-> TriangularP pack Lower sh a
forall pack uplo diag sh a.
(Packing pack, UpLo uplo, TriDiag diag, C sh, Eq sh, Floating a) =>
DiagSingleton diag
-> TriangularP pack uplo sh a
-> TriangularP pack uplo sh a
-> TriangularP pack uplo sh a
Basic.multiply (DiagSingleton diag
 -> TriangularP pack Lower sh a
 -> TriangularP pack Lower sh a
 -> TriangularP pack Lower sh a)
-> DiagSingleton diag
-> TriangularP pack Lower sh a
-> TriangularP pack Lower sh a
-> TriangularP pack Lower sh a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) TriangularP pack lo diag up sh a
a

multiplyFull ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   TriangularP pack lo diag up height a ->
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
multiplyFull :: TriangularP pack lo diag up height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
multiplyFull TriangularP pack lo diag up height a
a =
   case TriangularP pack lo diag up height a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up height a
a of
      UpLoSingleton lo up
MatrixShape.Upper -> (PlainArray pack diag lo up Shape Small Small height height a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a)
-> TriangularP pack lo diag up height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(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
ArrMatrix.lift2 (DiagSingleton diag
-> TriangularP pack Upper height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall uplo diag meas vert horiz height width a pack.
(UpLo uplo, TriDiag diag, Measure meas, C vert, C horiz, C height,
 Eq height, C width, Floating a) =>
DiagSingleton diag
-> TriangularP pack uplo height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Basic.multiplyFull (DiagSingleton diag
 -> TriangularP pack Upper height a
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> DiagSingleton diag
-> TriangularP pack Upper height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up height a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up height a
a) TriangularP pack lo diag up height a
a
      UpLoSingleton lo up
MatrixShape.Lower -> (PlainArray pack diag lo up Shape Small Small height height a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a)
-> TriangularP pack lo diag up height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(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
ArrMatrix.lift2 (DiagSingleton diag
-> TriangularP pack Lower height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall uplo diag meas vert horiz height width a pack.
(UpLo uplo, TriDiag diag, Measure meas, C vert, C horiz, C height,
 Eq height, C width, Floating a) =>
DiagSingleton diag
-> TriangularP pack uplo height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Basic.multiplyFull (DiagSingleton diag
 -> TriangularP pack Lower height a
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> DiagSingleton diag
-> TriangularP pack Lower height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up height a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up height a
a) TriangularP pack lo diag up height a
a



solve ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C sh, Eq sh, Shape.C nrhs, Class.Floating a) =>
   TriangularP pack lo diag up sh a ->
   Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a
solve :: TriangularP pack lo diag up sh a
-> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a
solve TriangularP pack lo diag up sh a
a =
   case TriangularP pack lo diag up sh a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up sh a
a of
      UpLoSingleton lo up
MatrixShape.Upper -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz sh nrhs a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz sh nrhs a)
-> TriangularP pack lo diag up sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(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
ArrMatrix.lift2 (DiagSingleton diag
-> Triangular pack Upper sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall uplo diag meas vert horiz height width a pack.
(UpLo uplo, TriDiag diag, Measure meas, C vert, C horiz, C height,
 Eq height, C width, Floating a) =>
DiagSingleton diag
-> TriangularP pack uplo height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Linear.solve (DiagSingleton diag
 -> Triangular pack Upper sh a
 -> Full meas vert horiz sh nrhs a
 -> Full meas vert horiz sh nrhs a)
-> DiagSingleton diag
-> Triangular pack Upper sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) TriangularP pack lo diag up sh a
a
      UpLoSingleton lo up
MatrixShape.Lower -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz sh nrhs a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz sh nrhs a)
-> TriangularP pack lo diag up sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(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
ArrMatrix.lift2 (DiagSingleton diag
-> Triangular pack Lower sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall uplo diag meas vert horiz height width a pack.
(UpLo uplo, TriDiag diag, Measure meas, C vert, C horiz, C height,
 Eq height, C width, Floating a) =>
DiagSingleton diag
-> TriangularP pack uplo height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Linear.solve (DiagSingleton diag
 -> Triangular pack Lower sh a
 -> Full meas vert horiz sh nrhs a
 -> Full meas vert horiz sh nrhs a)
-> DiagSingleton diag
-> Triangular pack Lower sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) TriangularP pack lo diag up sh a
a

inverse ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a ->
   TriangularP pack lo diag up sh a
inverse :: TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
inverse TriangularP pack lo diag up sh a
a =
   case TriangularP pack lo diag up sh a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up sh a
a of
      UpLoSingleton lo up
MatrixShape.Upper -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 (DiagSingleton diag
-> Triangular pack Upper sh a -> Triangular pack Upper sh a
forall uplo diag sh a pack.
(UpLo uplo, TriDiag diag, C sh, Floating a) =>
DiagSingleton diag
-> Triangular pack uplo sh a -> Triangular pack uplo sh a
Linear.inverse (DiagSingleton diag
 -> Triangular pack Upper sh a -> Triangular pack Upper sh a)
-> DiagSingleton diag
-> Triangular pack Upper sh a
-> Triangular pack Upper sh a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) TriangularP pack lo diag up sh a
a
      UpLoSingleton lo up
MatrixShape.Lower -> (PlainArray pack diag lo up Shape Small Small sh sh a
 -> PlainArray pack diag lo up Shape Small Small sh sh a)
-> TriangularP pack lo diag up sh a
-> TriangularP pack lo diag up sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(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
ArrMatrix.lift1 (DiagSingleton diag
-> Triangular pack Lower sh a -> Triangular pack Lower sh a
forall uplo diag sh a pack.
(UpLo uplo, TriDiag diag, C sh, Floating a) =>
DiagSingleton diag
-> Triangular pack uplo sh a -> Triangular pack uplo sh a
Linear.inverse (DiagSingleton diag
 -> Triangular pack Lower sh a -> Triangular pack Lower sh a)
-> DiagSingleton diag
-> Triangular pack Lower sh a
-> Triangular pack Lower sh a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a) TriangularP pack lo diag up sh a
a

determinant ::
   (Layout.Packing pack, MatrixShape.UpLo lo up, MatrixShape.TriDiag diag,
    Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a -> a
determinant :: TriangularP pack lo diag up sh a -> a
determinant TriangularP pack lo diag up sh a
a =
   case TriangularP pack lo diag up sh a -> DiagSingleton diag
forall diag pack lower upper meas vert horiz height width a.
TriDiag diag =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> DiagSingleton diag
diagTag TriangularP pack lo diag up sh a
a of
      DiagSingleton diag
MatrixShape.Unit -> a
forall a. Floating a => a
Scalar.one
      DiagSingleton diag
MatrixShape.Arbitrary ->
         case TriangularP pack lo diag up sh a -> UpLoSingleton lo up
forall lo up pack diag sh a.
UpLo lo up =>
TriangularP pack lo diag up sh a -> UpLoSingleton lo up
uploTag TriangularP pack lo diag up sh a
a of
            UpLoSingleton lo up
MatrixShape.Upper -> Triangular pack Upper sh a -> a
forall uplo sh a pack.
(UpLo uplo, C sh, Floating a) =>
Triangular pack uplo sh a -> a
Linear.determinant (Triangular pack Upper sh a -> a)
-> Triangular pack Upper sh a -> a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a
-> PlainArray pack diag lo up Shape Small Small sh sh a
forall pack property lower upper meas vert horiz height width a.
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
ArrMatrix.toVector TriangularP pack lo diag up sh a
a
            UpLoSingleton lo up
MatrixShape.Lower -> Triangular pack Lower sh a -> a
forall uplo sh a pack.
(UpLo uplo, C sh, Floating a) =>
Triangular pack uplo sh a -> a
Linear.determinant (Triangular pack Lower sh a -> a)
-> Triangular pack Lower sh a -> a
forall a b. (a -> b) -> a -> b
$ TriangularP pack lo diag up sh a
-> PlainArray pack diag lo up Shape Small Small sh sh a
forall pack property lower upper meas vert horiz height width a.
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
ArrMatrix.toVector TriangularP pack lo diag up sh a
a



eigenvalues ::
   (Layout.Packing pack, MatrixShape.DiagUpLo lo up,
    Shape.C sh, Class.Floating a) =>
   TriangularP pack lo diag up sh a -> Vector sh a
eigenvalues :: TriangularP pack lo diag up sh a -> Vector sh a
eigenvalues = TriangularP pack lo diag up sh a -> Vector sh a
forall sh a pack property lower upper.
(C sh, Floating a) =>
Quadratic pack property lower upper sh a -> Vector sh a
OmniMatrix.takeDiagonal

{- |
@(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 'Numeric.LAPACK.Vector.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 ::
   (Layout.Packing pack, MatrixShape.DiagUpLo lo up,
    Shape.C sh, Class.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)
eigensystem :: TriangularP pack lo Arbitrary up sh a
-> (TriangularP pack lo Arbitrary up sh a, Vector sh a,
    TriangularP pack lo Arbitrary up sh a)
eigensystem TriangularP pack lo Arbitrary up sh a
a =
   let (TriangularP pack lo Arbitrary up sh a
vr,TriangularP pack lo Arbitrary up sh a
vl) =
         Eigensystem pack sh a lo up
-> TriangularP pack lo Arbitrary up sh a
-> (TriangularP pack lo Arbitrary up sh a,
    TriangularP pack lo Arbitrary up sh a)
forall pack sh a lo up.
Eigensystem pack sh a lo up
-> TriangularP pack lo Arbitrary up sh a
-> (TriangularP pack lo Arbitrary up sh a,
    TriangularP pack lo Arbitrary up sh a)
getEigensystem
            (Eigensystem pack sh a Empty Empty
-> Eigensystem pack sh a Empty Filled
-> Eigensystem pack sh a Filled Empty
-> Eigensystem pack sh a lo up
forall lo up (f :: * -> * -> *).
DiagUpLoC lo up =>
f Empty Empty -> f Empty Filled -> f Filled Empty -> f lo up
MatrixShape.switchDiagUpLo
               ((TriangularP pack Empty Arbitrary Empty sh a
 -> (TriangularP pack Empty Arbitrary Empty sh a,
     TriangularP pack Empty Arbitrary Empty sh a))
-> Eigensystem pack sh a Empty Empty
forall pack sh a lo up.
(TriangularP pack lo Arbitrary up sh a
 -> (TriangularP pack lo Arbitrary up sh a,
     TriangularP pack lo Arbitrary up sh a))
-> Eigensystem pack sh a lo up
Eigensystem ((TriangularP pack Empty Arbitrary Empty sh a
  -> (TriangularP pack Empty Arbitrary Empty sh a,
      TriangularP pack Empty Arbitrary Empty sh a))
 -> Eigensystem pack sh a Empty Empty)
-> (TriangularP pack Empty Arbitrary Empty sh a
    -> (TriangularP pack Empty Arbitrary Empty sh a,
        TriangularP pack Empty Arbitrary Empty sh a))
-> Eigensystem pack sh a Empty Empty
forall a b. (a -> b) -> a -> b
$
                  (\TriangularP pack Empty Arbitrary Empty sh a
eye -> (TriangularP pack Empty Arbitrary Empty sh a
eye, TriangularP pack Empty Arbitrary Empty sh a
-> TriangularP pack Empty Arbitrary Empty sh a
forall typ meas vert horiz width height a xl xu lower upper.
(Transpose typ, Measure meas, C vert, C horiz, C width, C height,
 Floating a) =>
Matrix typ xl xu lower upper meas vert horiz height width a
-> Matrix typ xu xl upper lower meas horiz vert width height a
Matrix.transpose TriangularP pack Empty Arbitrary Empty sh a
eye)) (TriangularP pack Empty Arbitrary Empty sh a
 -> (TriangularP pack Empty Arbitrary Empty sh a,
     TriangularP pack Empty Arbitrary Empty sh a))
-> (TriangularP pack Empty Arbitrary Empty sh a
    -> TriangularP pack Empty Arbitrary Empty sh a)
-> TriangularP pack Empty Arbitrary Empty sh a
-> (TriangularP pack Empty Arbitrary Empty sh a,
    TriangularP pack Empty Arbitrary Empty sh a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                  Quadratic pack Arbitrary Empty Empty sh
-> TriangularP pack Empty Arbitrary Empty sh a
forall sh a pack property lower upper.
(C sh, Floating a) =>
Quadratic pack property lower upper sh
-> Quadratic pack property lower upper sh a
OmniMatrix.identityFromShape (Quadratic pack Arbitrary Empty Empty sh
 -> TriangularP pack Empty Arbitrary Empty sh a)
-> (TriangularP pack Empty Arbitrary Empty sh a
    -> Quadratic pack Arbitrary Empty Empty sh)
-> TriangularP pack Empty Arbitrary Empty sh a
-> TriangularP pack Empty Arbitrary Empty sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                  Order -> sh -> Quadratic pack Arbitrary Empty Empty sh
forall pack diag size.
(Packing pack, TriDiag diag) =>
Order
-> size -> Omni pack diag Empty Empty Shape Small Small size size
Omni.uncheckedDiagonal Order
Layout.ColumnMajor (sh -> Quadratic pack Arbitrary Empty Empty sh)
-> (TriangularP pack Empty Arbitrary Empty sh a -> sh)
-> TriangularP pack Empty Arbitrary Empty sh a
-> Quadratic pack Arbitrary Empty Empty sh
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                  Quadratic pack Arbitrary Empty Empty sh -> sh
forall pack property lower upper sh.
Omni pack property lower upper Shape Small Small sh sh -> sh
Omni.squareSize (Quadratic pack Arbitrary Empty Empty sh -> sh)
-> (TriangularP pack Empty Arbitrary Empty sh a
    -> Quadratic pack Arbitrary Empty Empty sh)
-> TriangularP pack Empty Arbitrary Empty sh a
-> sh
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TriangularP pack Empty Arbitrary Empty sh a
-> Quadratic pack Arbitrary Empty Empty sh
forall pack property lower upper meas vert horiz height width a.
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> Omni pack property lower upper meas vert horiz height width
ArrMatrix.shape)
               ((TriangularP pack Empty Arbitrary Filled sh a
 -> (TriangularP pack Empty Arbitrary Filled sh a,
     TriangularP pack Empty Arbitrary Filled sh a))
-> Eigensystem pack sh a Empty Filled
forall pack sh a lo up.
(TriangularP pack lo Arbitrary up sh a
 -> (TriangularP pack lo Arbitrary up sh a,
     TriangularP pack lo Arbitrary up sh a))
-> Eigensystem pack sh a lo up
Eigensystem ((TriangularP pack Empty Arbitrary Filled sh a
  -> (TriangularP pack Empty Arbitrary Filled sh a,
      TriangularP pack Empty Arbitrary Filled sh a))
 -> Eigensystem pack sh a Empty Filled)
-> (TriangularP pack Empty Arbitrary Filled sh a
    -> (TriangularP pack Empty Arbitrary Filled sh a,
        TriangularP pack Empty Arbitrary Filled sh a))
-> Eigensystem pack sh a Empty Filled
forall a b. (a -> b) -> a -> b
$
                  (TriangularP pack Upper sh a
 -> TriangularP pack Empty Arbitrary Filled sh a,
 TriangularP pack Upper sh a
 -> TriangularP pack Empty Arbitrary Filled sh a)
-> (TriangularP pack Upper sh a, TriangularP pack Upper sh a)
-> (TriangularP pack Empty Arbitrary Filled sh a,
    TriangularP pack Empty Arbitrary Filled sh a)
forall a c b d. (a -> c, b -> d) -> (a, b) -> (c, d)
mapPair (TriangularP pack Upper sh a
-> TriangularP pack Empty Arbitrary Filled sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0, TriangularP pack Upper sh a
-> TriangularP pack Empty Arbitrary Filled sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0) ((TriangularP pack Upper sh a, TriangularP pack Upper sh a)
 -> (TriangularP pack Empty Arbitrary Filled sh a,
     TriangularP pack Empty Arbitrary Filled sh a))
-> (TriangularP pack Empty Arbitrary Filled sh a
    -> (TriangularP pack Upper sh a, TriangularP pack Upper sh a))
-> TriangularP pack Empty Arbitrary Filled sh a
-> (TriangularP pack Empty Arbitrary Filled sh a,
    TriangularP pack Empty Arbitrary Filled sh a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                  TriangularP pack Upper sh a
-> (TriangularP pack Upper sh a, TriangularP pack Upper sh a)
forall uplo vpack sh a pack.
(UpLo uplo, Packing vpack, C sh, Floating a) =>
TriangularP pack uplo sh a
-> (TriangularP vpack uplo sh a, TriangularP vpack uplo sh a)
Eigen.decompose (TriangularP pack Upper sh a
 -> (TriangularP pack Upper sh a, TriangularP pack Upper sh a))
-> (TriangularP pack Empty Arbitrary Filled sh a
    -> TriangularP pack Upper sh a)
-> TriangularP pack Empty Arbitrary Filled sh a
-> (TriangularP pack Upper sh a, TriangularP pack Upper sh a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TriangularP pack Empty Arbitrary Filled sh a
-> TriangularP pack Upper sh a
forall pack property lower upper meas vert horiz height width a.
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
ArrMatrix.toVector)
               ((TriangularP pack Filled Arbitrary Empty sh a
 -> (TriangularP pack Filled Arbitrary Empty sh a,
     TriangularP pack Filled Arbitrary Empty sh a))
-> Eigensystem pack sh a Filled Empty
forall pack sh a lo up.
(TriangularP pack lo Arbitrary up sh a
 -> (TriangularP pack lo Arbitrary up sh a,
     TriangularP pack lo Arbitrary up sh a))
-> Eigensystem pack sh a lo up
Eigensystem ((TriangularP pack Filled Arbitrary Empty sh a
  -> (TriangularP pack Filled Arbitrary Empty sh a,
      TriangularP pack Filled Arbitrary Empty sh a))
 -> Eigensystem pack sh a Filled Empty)
-> (TriangularP pack Filled Arbitrary Empty sh a
    -> (TriangularP pack Filled Arbitrary Empty sh a,
        TriangularP pack Filled Arbitrary Empty sh a))
-> Eigensystem pack sh a Filled Empty
forall a b. (a -> b) -> a -> b
$
                  (TriangularP pack Lower sh a
 -> TriangularP pack Filled Arbitrary Empty sh a,
 TriangularP pack Lower sh a
 -> TriangularP pack Filled Arbitrary Empty sh a)
-> (TriangularP pack Lower sh a, TriangularP pack Lower sh a)
-> (TriangularP pack Filled Arbitrary Empty sh a,
    TriangularP pack Filled Arbitrary Empty sh a)
forall a c b d. (a -> c, b -> d) -> (a, b) -> (c, d)
mapPair (TriangularP pack Lower sh a
-> TriangularP pack Filled Arbitrary Empty sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0, TriangularP pack Lower sh a
-> TriangularP pack Filled Arbitrary Empty sh a
forall pack prop lower upper meas vert horiz height width a.
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
ArrMatrix.lift0) ((TriangularP pack Lower sh a, TriangularP pack Lower sh a)
 -> (TriangularP pack Filled Arbitrary Empty sh a,
     TriangularP pack Filled Arbitrary Empty sh a))
-> (TriangularP pack Filled Arbitrary Empty sh a
    -> (TriangularP pack Lower sh a, TriangularP pack Lower sh a))
-> TriangularP pack Filled Arbitrary Empty sh a
-> (TriangularP pack Filled Arbitrary Empty sh a,
    TriangularP pack Filled Arbitrary Empty sh a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                  TriangularP pack Lower sh a
-> (TriangularP pack Lower sh a, TriangularP pack Lower sh a)
forall uplo vpack sh a pack.
(UpLo uplo, Packing vpack, C sh, Floating a) =>
TriangularP pack uplo sh a
-> (TriangularP vpack uplo sh a, TriangularP vpack uplo sh a)
Eigen.decompose (TriangularP pack Lower sh a
 -> (TriangularP pack Lower sh a, TriangularP pack Lower sh a))
-> (TriangularP pack Filled Arbitrary Empty sh a
    -> TriangularP pack Lower sh a)
-> TriangularP pack Filled Arbitrary Empty sh a
-> (TriangularP pack Lower sh a, TriangularP pack Lower sh a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TriangularP pack Filled Arbitrary Empty sh a
-> TriangularP pack Lower sh a
forall pack property lower upper meas vert horiz height width a.
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
ArrMatrix.toVector))
            TriangularP pack lo Arbitrary up sh a
a
   in (TriangularP pack lo Arbitrary up sh a
vr, TriangularP pack lo Arbitrary up sh a -> Vector sh a
forall pack lo up sh a diag.
(Packing pack, DiagUpLo lo up, C sh, Floating a) =>
TriangularP pack lo diag up sh a -> Vector sh a
eigenvalues TriangularP pack lo Arbitrary up sh a
a, TriangularP pack lo Arbitrary up sh a
vl)

newtype Eigensystem pack sh a lo up =
   Eigensystem {
      Eigensystem pack sh a lo up
-> TriangularP pack lo Arbitrary up sh a
-> (TriangularP pack lo Arbitrary up sh a,
    TriangularP pack lo Arbitrary up sh a)
getEigensystem ::
         TriangularP pack lo Arbitrary up sh a ->
         (TriangularP pack lo Arbitrary up sh a,
          TriangularP pack lo Arbitrary up sh a)
   }