{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GADTs #-}
module Numeric.LAPACK.Matrix.Banded (
   Banded,
   FlexBanded,
   Banded.General,
   Banded.Square,
   Banded.Upper, Banded.UnitUpper,
   Banded.Lower, Banded.UnitLower,
   Diagonal,
   Banded.FlexDiagonal,
   Banded.RectangularDiagonal,
   Banded.Hermitian,
   Banded.HermitianPosSemidef,
   Banded.HermitianPosDef,
   Banded.FlexHermitian,
   height, width,
   fromList,
   squareFromList,
   lowerFromList,
   upperFromList,
   mapExtent,
   diagonal,
   takeDiagonal,
   forceOrder,
   noUnit,
   toFull,
   toLowerTriangular,
   toUpperTriangular,
   takeTopLeftSquare,
   takeBottomRightSquare,
   transpose,
   adjoint,
   multiplyVector,
   multiply,
   multiplyFull,

   solve,
   determinant,
   ) where

import qualified Numeric.LAPACK.Matrix.Banded.Linear as Linear
import qualified Numeric.LAPACK.Matrix.Banded.Basic as Basic

import qualified Numeric.LAPACK.Matrix.Array.Banded as Banded
import qualified Numeric.LAPACK.Matrix.Array.Mosaic as Triangular
import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix
import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape
import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni
import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout
import qualified Numeric.LAPACK.Matrix.Extent.Strict as ExtentStrict
import qualified Numeric.LAPACK.Matrix.Extent as Extent
import qualified Numeric.LAPACK.Scalar as Scalar
import Numeric.LAPACK.Matrix.Array.Banded (FlexBanded, Banded, Diagonal)
import Numeric.LAPACK.Matrix.Array.Private (Full, diagTag)
import Numeric.LAPACK.Matrix.Layout.Private (Order, UnaryProxy)
import Numeric.LAPACK.Vector (Vector)

import qualified Numeric.Netlib.Class as Class

import qualified Type.Data.Num.Unary.Proof as Proof
import qualified Type.Data.Num.Unary as Unary
import Type.Data.Num.Unary ((:+:))

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

import Foreign.Storable (Storable)


height ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Banded sub super meas vert horiz height width a -> height
height :: Banded sub super meas vert horiz height width a -> height
height = Omni
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
-> height
forall meas vert horiz pack property lower upper height width.
(Measure meas, C vert, C horiz) =>
Omni pack property lower upper meas vert horiz height width
-> height
Omni.height (Omni
   Packed
   Arbitrary
   (Bands sub)
   (Bands super)
   meas
   vert
   horiz
   height
   width
 -> height)
-> (Banded sub super meas vert horiz height width a
    -> Omni
         Packed
         Arbitrary
         (Bands sub)
         (Bands super)
         meas
         vert
         horiz
         height
         width)
-> Banded sub super meas vert horiz height width a
-> height
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Banded sub super meas vert horiz height width a
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
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

width ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Banded sub super meas vert horiz height width a -> width
width :: Banded sub super meas vert horiz height width a -> width
width = Omni
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
-> width
forall meas vert horiz pack property lower upper height width.
(Measure meas, C vert, C horiz) =>
Omni pack property lower upper meas vert horiz height width
-> width
Omni.width (Omni
   Packed
   Arbitrary
   (Bands sub)
   (Bands super)
   meas
   vert
   horiz
   height
   width
 -> width)
-> (Banded sub super meas vert horiz height width a
    -> Omni
         Packed
         Arbitrary
         (Bands sub)
         (Bands super)
         meas
         vert
         horiz
         height
         width)
-> Banded sub super meas vert horiz height width a
-> width
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Banded sub super meas vert horiz height width a
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
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



fromList ::
   (Unary.Natural sub, Unary.Natural super,
    Shape.C height, Shape.C width, Storable a) =>
   (UnaryProxy sub, UnaryProxy super) -> Order -> height -> width -> [a] ->
   Banded.General sub super height width a
fromList :: (UnaryProxy sub, UnaryProxy super)
-> Order
-> height
-> width
-> [a]
-> General sub super height width a
fromList (UnaryProxy sub, UnaryProxy super)
offDiag Order
order height
height_ width
width_ =
   Array (Banded sub super Size Big Big height width) a
-> General sub super height 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 (Banded sub super Size Big Big height width) a
 -> General sub super height width a)
-> ([a] -> Array (Banded sub super Size Big Big height width) a)
-> [a]
-> General sub super height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnaryProxy sub, UnaryProxy super)
-> Order
-> height
-> width
-> [a]
-> Array (Banded sub super Size Big Big height width) a
forall sub super height width a.
(Natural sub, Natural super, C height, C width, Storable a) =>
(UnaryProxy sub, UnaryProxy super)
-> Order
-> height
-> width
-> [a]
-> General sub super height width a
Basic.fromList (UnaryProxy sub, UnaryProxy super)
offDiag Order
order height
height_ width
width_

squareFromList ::
   (Unary.Natural sub, Unary.Natural super, Shape.C size, Storable a) =>
   (UnaryProxy sub, UnaryProxy super) -> Order -> size -> [a] ->
   Banded.Square sub super size a
squareFromList :: (UnaryProxy sub, UnaryProxy super)
-> Order -> size -> [a] -> Square sub super size a
squareFromList (UnaryProxy sub, UnaryProxy super)
offDiag Order
order size
size =
   Array (Banded sub super Shape Small Small size size) a
-> Square sub super size 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 (Banded sub super Shape Small Small size size) a
 -> Square sub super size a)
-> ([a] -> Array (Banded sub super Shape Small Small size size) a)
-> [a]
-> Square sub super size a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnaryProxy sub, UnaryProxy super)
-> Order
-> size
-> [a]
-> Array (Banded sub super Shape Small Small size size) a
forall sub super size a.
(Natural sub, Natural super, C size, Storable a) =>
(UnaryProxy sub, UnaryProxy super)
-> Order -> size -> [a] -> Square sub super size a
Basic.squareFromList (UnaryProxy sub, UnaryProxy super)
offDiag Order
order size
size

lowerFromList ::
   (Unary.Natural sub, Shape.C size, Storable a) =>
   UnaryProxy sub -> Order -> size -> [a] -> Banded.Lower sub size a
lowerFromList :: UnaryProxy sub -> Order -> size -> [a] -> Lower sub size a
lowerFromList UnaryProxy sub
numOff Order
order size
size =
   Array (Banded sub Zero Shape Small Small size size) a
-> Lower sub size 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 (Banded sub Zero Shape Small Small size size) a
 -> Lower sub size a)
-> ([a] -> Array (Banded sub Zero Shape Small Small size size) a)
-> [a]
-> Lower sub size a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnaryProxy sub
-> Order
-> size
-> [a]
-> Array (Banded sub Zero Shape Small Small size size) a
forall sub size a.
(Natural sub, C size, Storable a) =>
UnaryProxy sub -> Order -> size -> [a] -> Lower sub size a
Basic.lowerFromList UnaryProxy sub
numOff Order
order size
size

upperFromList ::
   (Unary.Natural super, Shape.C size, Storable a) =>
   UnaryProxy super -> Order -> size -> [a] -> Banded.Upper super size a
upperFromList :: UnaryProxy super -> Order -> size -> [a] -> Upper super size a
upperFromList UnaryProxy super
numOff Order
order size
size =
   Array (Banded Zero super Shape Small Small size size) a
-> Upper super size 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 (Banded Zero super Shape Small Small size size) a
 -> Upper super size a)
-> ([a] -> Array (Banded Zero super Shape Small Small size size) a)
-> [a]
-> Upper super size a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnaryProxy super
-> Order
-> size
-> [a]
-> Array (Banded Zero super Shape Small Small size size) a
forall super size a.
(Natural super, C size, Storable a) =>
UnaryProxy super -> Order -> size -> [a] -> Upper super size a
Basic.upperFromList UnaryProxy super
numOff Order
order size
size

mapExtent ::
   (Extent.C vertA, Extent.C horizA) =>
   (Extent.C vertB, Extent.C horizB) =>
   (Unary.Natural sub, Unary.Natural super) =>
   Extent.Map measA vertA horizA measB vertB horizB height width ->
   Banded sub super measA vertA horizA height width a ->
   Banded sub super measB vertB horizB height width a
mapExtent :: Map measA vertA horizA measB vertB horizB height width
-> Banded sub super measA vertA horizA height width a
-> Banded sub super measB vertB horizB height width a
mapExtent = (Array (Banded sub super measA vertA horizA height width) a
 -> Array (Banded sub super measB vertB horizB height width) a)
-> Banded sub super measA vertA horizA height width a
-> Banded sub super measB vertB horizB height width 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 ((Array (Banded sub super measA vertA horizA height width) a
  -> Array (Banded sub super measB vertB horizB height width) a)
 -> Banded sub super measA vertA horizA height width a
 -> Banded sub super measB vertB horizB height width a)
-> (Map measA vertA horizA measB vertB horizB height width
    -> Array (Banded sub super measA vertA horizA height width) a
    -> Array (Banded sub super measB vertB horizB height width) a)
-> Map measA vertA horizA measB vertB horizB height width
-> Banded sub super measA vertA horizA height width a
-> Banded sub super measB vertB horizB height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map measA vertA horizA measB vertB horizB height width
-> Array (Banded sub super measA vertA horizA height width) a
-> Array (Banded sub super measB vertB horizB height width) a
forall vertA horizA vertB horizB measA measB height width sub super
       a.
(C vertA, C horizA, C vertB, C horizB) =>
Map measA vertA horizA measB vertB horizB height width
-> Banded sub super measA vertA horizA height width a
-> Banded sub super measB vertB horizB height width a
Basic.mapExtent (Map measA vertA horizA measB vertB horizB height width
 -> Array (Banded sub super measA vertA horizA height width) a
 -> Array (Banded sub super measB vertB horizB height width) a)
-> (Map measA vertA horizA measB vertB horizB height width
    -> Map measA vertA horizA measB vertB horizB height width)
-> Map measA vertA horizA measB vertB horizB height width
-> Array (Banded sub super measA vertA horizA height width) a
-> Array (Banded sub super measB vertB horizB height width) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map measA vertA horizA measB vertB horizB height width
-> Map measA vertA horizA measB vertB horizB height width
forall measA vertA horizA measB vertB horizB height width.
Map measA vertA horizA measB vertB horizB height width
-> Map measA vertA horizA measB vertB horizB height width
ExtentStrict.apply

transpose ::
   (Omni.TriDiag diag, Unary.Natural sub, Unary.Natural super,
    Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   FlexBanded diag sub super meas vert horiz height width a ->
   FlexBanded diag super sub meas horiz vert width height a
transpose :: FlexBanded diag sub super meas vert horiz height width a
-> FlexBanded diag super sub meas horiz vert width height a
transpose FlexBanded diag sub super meas vert horiz height width a
a =
   case FlexBanded diag sub super meas vert horiz height width 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 FlexBanded diag sub super meas vert horiz height width a
a of
      DiagSingleton diag
Omni.Arbitrary -> (PlainArray
   Packed
   diag
   (Bands sub)
   (Bands super)
   meas
   vert
   horiz
   height
   width
   a
 -> PlainArray
      Packed
      diag
      (Bands super)
      (Bands sub)
      meas
      horiz
      vert
      width
      height
      a)
-> FlexBanded diag sub super meas vert horiz height width a
-> FlexBanded diag super sub meas horiz vert width height 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
  Packed
  diag
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
  a
-> PlainArray
     Packed
     diag
     (Bands super)
     (Bands sub)
     meas
     horiz
     vert
     width
     height
     a
forall meas vert horiz sub super height width a.
(Measure meas, C vert, C horiz) =>
Banded sub super meas vert horiz height width a
-> Banded super sub meas horiz vert width height a
Basic.transpose FlexBanded diag sub super meas vert horiz height width a
a
      DiagSingleton diag
Omni.Unit ->
         case FlexBanded diag sub super meas vert horiz height width a
-> Omni
     Packed diag (Bands sub) (Bands super) meas vert horiz height width
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 FlexBanded diag sub super meas vert horiz height width a
a of
            Omni.UnitBandedTriangular BandedSquare sub super height
_ -> (PlainArray
   Packed
   diag
   (Bands sub)
   (Bands super)
   meas
   vert
   horiz
   height
   width
   a
 -> PlainArray
      Packed
      diag
      (Bands super)
      (Bands sub)
      meas
      horiz
      vert
      width
      height
      a)
-> FlexBanded diag sub super meas vert horiz height width a
-> FlexBanded diag super sub meas horiz vert width height 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
  Packed
  diag
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
  a
-> PlainArray
     Packed
     diag
     (Bands super)
     (Bands sub)
     meas
     horiz
     vert
     width
     height
     a
forall meas vert horiz sub super height width a.
(Measure meas, C vert, C horiz) =>
Banded sub super meas vert horiz height width a
-> Banded super sub meas horiz vert width height a
Basic.transpose FlexBanded diag sub super meas vert horiz height width a
a

adjoint ::
   (Unary.Natural sub, Unary.Natural super,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   FlexBanded diag sub super meas vert horiz height width a ->
   FlexBanded diag super sub meas horiz vert width height a
adjoint :: FlexBanded diag sub super meas vert horiz height width a
-> FlexBanded diag super sub meas horiz vert width height a
adjoint FlexBanded diag sub super meas vert horiz height width a
a =
   case FlexBanded diag sub super meas vert horiz height width a
-> Omni
     Packed diag (Bands sub) (Bands super) meas vert horiz height width
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 FlexBanded diag sub super meas vert horiz height width a
a of
      Omni.Banded Banded sub super meas vert horiz height width
_ -> (PlainArray
   Packed
   diag
   (Bands sub)
   (Bands super)
   meas
   vert
   horiz
   height
   width
   a
 -> PlainArray
      Packed
      diag
      (Bands super)
      (Bands sub)
      meas
      horiz
      vert
      width
      height
      a)
-> FlexBanded diag sub super meas vert horiz height width a
-> FlexBanded diag super sub meas horiz vert width height 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
  Packed
  diag
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
  a
-> PlainArray
     Packed
     diag
     (Bands super)
     (Bands sub)
     meas
     horiz
     vert
     width
     height
     a
forall sub super meas vert horiz height width a.
(Natural sub, Natural super, Measure meas, C vert, C horiz,
 C height, C width, Floating a) =>
Banded sub super meas vert horiz height width a
-> Banded super sub meas horiz vert width height a
Basic.adjoint FlexBanded diag sub super meas vert horiz height width a
a
      Omni.UnitBandedTriangular BandedSquare sub super height
_ -> (PlainArray
   Packed
   diag
   (Bands sub)
   (Bands super)
   meas
   vert
   horiz
   height
   width
   a
 -> PlainArray
      Packed
      diag
      (Bands super)
      (Bands sub)
      meas
      horiz
      vert
      width
      height
      a)
-> FlexBanded diag sub super meas vert horiz height width a
-> FlexBanded diag super sub meas horiz vert width height 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
  Packed
  diag
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
  a
-> PlainArray
     Packed
     diag
     (Bands super)
     (Bands sub)
     meas
     horiz
     vert
     width
     height
     a
forall sub super meas vert horiz height width a.
(Natural sub, Natural super, Measure meas, C vert, C horiz,
 C height, C width, Floating a) =>
Banded sub super meas vert horiz height width a
-> Banded super sub meas horiz vert width height a
Basic.adjoint FlexBanded diag sub super meas vert horiz height width a
a
      Omni.BandedHermitian BandedHermitian offDiag height
_ -> FlexBanded diag sub super meas vert horiz height width a
FlexBanded diag super sub meas horiz vert width height a
a

diagonal ::
   (Shape.C sh, Class.Floating a) => Order -> Vector sh a -> Diagonal sh a
diagonal :: Order -> Vector sh a -> Diagonal sh a
diagonal Order
order = Array (Banded Zero Zero Shape Small Small sh sh) a -> Diagonal 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 (Banded Zero Zero Shape Small Small sh sh) a
 -> Diagonal sh a)
-> (Vector sh a
    -> Array (Banded Zero Zero Shape Small Small sh sh) a)
-> Vector sh a
-> Diagonal sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order
-> Vector sh a
-> Array (Banded Zero Zero Shape Small Small sh sh) a
forall sh a.
(C sh, Floating a) =>
Order -> Vector sh a -> Diagonal sh a
Basic.diagonal Order
order

takeDiagonal ::
   (Unary.Natural sub, Unary.Natural super, Shape.C sh, Class.Floating a) =>
   Banded.Square sub super sh a -> Vector sh a
takeDiagonal :: Square sub super sh a -> Vector sh a
takeDiagonal = Square sub super sh a -> Vector sh a
forall sub super sh a.
(Natural sub, Natural super, C sh, Floating a) =>
Square sub super sh a -> Vector sh a
Basic.takeDiagonal (Square sub super sh a -> Vector sh a)
-> (Square sub super sh a -> Square sub super sh a)
-> Square sub super sh a
-> Vector sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Square sub super sh a -> Square sub super 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

multiplyVector ::
   (Unary.Natural sub, Unary.Natural super,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width,
    Class.Floating a) =>
   Banded sub super meas vert horiz height width a ->
   Vector width a -> Vector height a
multiplyVector :: Banded sub super meas vert horiz height width a
-> Vector width a -> Vector height a
multiplyVector = Banded sub super meas vert horiz height width a
-> Vector width a -> Vector height a
forall sub super meas vert horiz height width a.
(Natural sub, Natural super, Measure meas, C vert, C horiz,
 C height, C width, Eq width, Floating a) =>
Banded sub super meas vert horiz height width a
-> Vector width a -> Vector height a
Basic.multiplyVector (Banded sub super meas vert horiz height width a
 -> Vector width a -> Vector height a)
-> (Banded sub super meas vert horiz height width a
    -> Banded sub super meas vert horiz height width a)
-> Banded sub super meas vert horiz height width a
-> Vector width a
-> Vector height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Banded sub super meas vert horiz height width a
-> Banded sub super meas vert horiz height width 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

multiply ::
   (Unary.Natural subA, Unary.Natural superA,
    Unary.Natural subB, Unary.Natural superB,
    (subA :+: subB) ~ subC,
    (superA :+: superB) ~ superC,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Shape.C fuse, Eq fuse,
    Class.Floating a) =>
   Banded subA superA meas vert horiz height fuse a ->
   Banded subB superB meas vert horiz fuse width a ->
   Banded subC superC meas vert horiz height width a
multiply :: Banded subA superA meas vert horiz height fuse a
-> Banded subB superB meas vert horiz fuse width a
-> Banded subC superC meas vert horiz height width a
multiply Banded subA superA meas vert horiz height fuse a
a Banded subB superB meas vert horiz fuse width a
b =
   case (UnaryProxy subA, UnaryProxy superA)
-> (UnaryProxy subB, UnaryProxy superB)
-> ((Nat subC, Nat superC), (UnaryProxy subC, UnaryProxy superC))
forall subA superA subB superB subC superC.
(Natural subA, Natural superA, Natural subB, Natural superB,
 (subA :+: subB) ~ subC, (superA :+: superB) ~ superC) =>
(UnaryProxy subA, UnaryProxy superA)
-> (UnaryProxy subB, UnaryProxy superB)
-> ((Nat subC, Nat superC), (UnaryProxy subC, UnaryProxy superC))
Layout.addOffDiagonals
         (Omni
  Packed
  Arbitrary
  (Bands subA)
  (Bands superA)
  meas
  vert
  horiz
  height
  fuse
-> (UnaryProxy subA, UnaryProxy superA)
forall property sub super meas vert horiz height width.
Omni
  Packed
  property
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
-> (UnaryProxy sub, UnaryProxy super)
MatrixShape.bandedOffDiagonals (Omni
   Packed
   Arbitrary
   (Bands subA)
   (Bands superA)
   meas
   vert
   horiz
   height
   fuse
 -> (UnaryProxy subA, UnaryProxy superA))
-> Omni
     Packed
     Arbitrary
     (Bands subA)
     (Bands superA)
     meas
     vert
     horiz
     height
     fuse
-> (UnaryProxy subA, UnaryProxy superA)
forall a b. (a -> b) -> a -> b
$ Banded subA superA meas vert horiz height fuse a
-> Omni
     Packed
     Arbitrary
     (Bands subA)
     (Bands superA)
     meas
     vert
     horiz
     height
     fuse
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 Banded subA superA meas vert horiz height fuse a
a)
         (Omni
  Packed
  Arbitrary
  (Bands subB)
  (Bands superB)
  meas
  vert
  horiz
  fuse
  width
-> (UnaryProxy subB, UnaryProxy superB)
forall property sub super meas vert horiz height width.
Omni
  Packed
  property
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
-> (UnaryProxy sub, UnaryProxy super)
MatrixShape.bandedOffDiagonals (Omni
   Packed
   Arbitrary
   (Bands subB)
   (Bands superB)
   meas
   vert
   horiz
   fuse
   width
 -> (UnaryProxy subB, UnaryProxy superB))
-> Omni
     Packed
     Arbitrary
     (Bands subB)
     (Bands superB)
     meas
     vert
     horiz
     fuse
     width
-> (UnaryProxy subB, UnaryProxy superB)
forall a b. (a -> b) -> a -> b
$ Banded subB superB meas vert horiz fuse width a
-> Omni
     Packed
     Arbitrary
     (Bands subB)
     (Bands superB)
     meas
     vert
     horiz
     fuse
     width
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 Banded subB superB meas vert horiz fuse width a
b) of
      ((Nat subC
Proof.Nat, Nat superC
Proof.Nat), (UnaryProxy subC, UnaryProxy superC)
_numOffC) -> (PlainArray
   Packed
   Arbitrary
   (Bands subA)
   (Bands superA)
   meas
   vert
   horiz
   height
   fuse
   a
 -> PlainArray
      Packed
      Arbitrary
      (Bands subB)
      (Bands superB)
      meas
      vert
      horiz
      fuse
      width
      a
 -> PlainArray
      Packed
      Arbitrary
      (Bands subC)
      (Bands superC)
      meas
      vert
      horiz
      height
      width
      a)
-> Banded subA superA meas vert horiz height fuse a
-> Banded subB superB meas vert horiz fuse width a
-> Banded subC superC meas vert horiz height width a
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 PlainArray
  Packed
  Arbitrary
  (Bands subA)
  (Bands superA)
  meas
  vert
  horiz
  height
  fuse
  a
-> PlainArray
     Packed
     Arbitrary
     (Bands subB)
     (Bands superB)
     meas
     vert
     horiz
     fuse
     width
     a
-> PlainArray
     Packed
     Arbitrary
     (Bands subC)
     (Bands superC)
     meas
     vert
     horiz
     height
     width
     a
forall subA superA subB superB subC superC meas vert horiz height
       width fuse a.
(Natural subA, Natural superA, Natural subB, Natural superB,
 (subA :+: subB) ~ subC, (superA :+: superB) ~ superC, Measure meas,
 C vert, C horiz, C height, C width, C fuse, Eq fuse, Floating a) =>
Banded subA superA meas vert horiz height fuse a
-> Banded subB superB meas vert horiz fuse width a
-> Banded subC superC meas vert horiz height width a
Basic.multiply Banded subA superA meas vert horiz height fuse a
a Banded subB superB meas vert horiz fuse width a
b

multiplyFull ::
   (Unary.Natural sub, Unary.Natural super,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Shape.C fuse, Eq fuse,
    Class.Floating a) =>
   Banded sub super meas vert horiz height fuse a ->
   Full meas vert horiz fuse width a -> Full meas vert horiz height width a
multiplyFull :: Banded sub super meas vert horiz height fuse a
-> Full meas vert horiz fuse width a
-> Full meas vert horiz height width a
multiplyFull = (PlainArray
   Packed
   Arbitrary
   (Bands sub)
   (Bands super)
   meas
   vert
   horiz
   height
   fuse
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz fuse width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a)
-> Banded sub super meas vert horiz height fuse a
-> Full meas vert horiz fuse 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 PlainArray
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  fuse
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz fuse width a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz height width a
forall sub super meas vert horiz height width fuse a.
(Natural sub, Natural super, Measure meas, C vert, C horiz,
 C height, C width, C fuse, Eq fuse, Floating a) =>
Banded sub super meas vert horiz height fuse a
-> Full meas vert horiz fuse width a
-> Full meas vert horiz height width a
Basic.multiplyFull


forceOrder ::
   (Unary.Natural sub, Unary.Natural super,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Order ->
   Banded sub super meas vert horiz height width a ->
   Banded sub super meas vert horiz height width a
forceOrder :: Order
-> Banded sub super meas vert horiz height width a
-> Banded sub super meas vert horiz height width a
forceOrder = (Array (Banded sub super meas vert horiz height width) a
 -> Array (Banded sub super meas vert horiz height width) a)
-> Banded sub super meas vert horiz height width a
-> Banded sub super 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 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 ((Array (Banded sub super meas vert horiz height width) a
  -> Array (Banded sub super meas vert horiz height width) a)
 -> Banded sub super meas vert horiz height width a
 -> Banded sub super meas vert horiz height width a)
-> (Order
    -> Array (Banded sub super meas vert horiz height width) a
    -> Array (Banded sub super meas vert horiz height width) a)
-> Order
-> Banded sub super meas vert horiz height width a
-> Banded sub super meas vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order
-> Array (Banded sub super meas vert horiz height width) a
-> Array (Banded sub super meas vert horiz height width) a
forall sub super meas vert horiz height width a.
(Natural sub, Natural super, Measure meas, C vert, C horiz,
 C height, C width, Floating a) =>
Order
-> Banded sub super meas vert horiz height width a
-> Banded sub super meas vert horiz height width a
Basic.forceOrder

toLowerTriangular ::
   (Unary.Natural sub, Shape.C sh, Class.Floating a) =>
   Banded.Lower sub sh a -> Triangular.Lower sh a
toLowerTriangular :: Lower sub sh a -> Lower sh a
toLowerTriangular = (PlainArray
   Packed Arbitrary (Bands sub) (Bands Zero) Shape Small Small sh sh a
 -> PlainArray
      Packed Arbitrary Filled (Bands Zero) Shape Small Small sh sh a)
-> Lower sub sh a -> Lower 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
  Packed Arbitrary (Bands sub) (Bands Zero) Shape Small Small sh sh a
-> PlainArray
     Packed Arbitrary Filled (Bands Zero) Shape Small Small sh sh a
forall sub sh a.
(Natural sub, C sh, Floating a) =>
Lower sub sh a -> Lower sh a
Basic.toLowerTriangular

toUpperTriangular ::
   (Unary.Natural super, Shape.C sh, Class.Floating a) =>
   Banded.Upper super sh a -> Triangular.Upper sh a
toUpperTriangular :: Upper super sh a -> Upper sh a
toUpperTriangular = (PlainArray
   Packed
   Arbitrary
   (Bands Zero)
   (Bands super)
   Shape
   Small
   Small
   sh
   sh
   a
 -> PlainArray
      Packed Arbitrary (Bands Zero) Filled Shape Small Small sh sh a)
-> Upper super sh a -> Upper 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
  Packed
  Arbitrary
  (Bands Zero)
  (Bands super)
  Shape
  Small
  Small
  sh
  sh
  a
-> PlainArray
     Packed Arbitrary (Bands Zero) Filled Shape Small Small sh sh a
forall super sh a.
(Natural super, C sh, Floating a) =>
Upper super sh a -> Upper sh a
Basic.toUpperTriangular

toFull ::
   (Unary.Natural sub, Unary.Natural super,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Banded sub super meas vert horiz height width a ->
   Full meas vert horiz height width a
toFull :: Banded sub super meas vert horiz height width a
-> Full meas vert horiz height width a
toFull = (PlainArray
   Packed
   Arbitrary
   (Bands sub)
   (Bands super)
   meas
   vert
   horiz
   height
   width
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a)
-> Banded sub super 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 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
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz height width a
forall sub super meas vert horiz height width a.
(Natural sub, Natural super, Measure meas, C vert, C horiz,
 C height, C width, Floating a) =>
Banded sub super meas vert horiz height width a
-> Full meas vert horiz height width a
Basic.toFull


takeTopLeftSquare ::
   (Unary.Natural sub, Unary.Natural super,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   Banded.Square sub super (sh0 ::+ sh1) a ->
   Banded.Square sub super sh0 a
takeTopLeftSquare :: Square sub super (sh0 ::+ sh1) a -> Square sub super sh0 a
takeTopLeftSquare = (PlainArray
   Packed
   Arbitrary
   (Bands sub)
   (Bands super)
   Shape
   Small
   Small
   (sh0 ::+ sh1)
   (sh0 ::+ sh1)
   a
 -> PlainArray
      Packed
      Arbitrary
      (Bands sub)
      (Bands super)
      Shape
      Small
      Small
      sh0
      sh0
      a)
-> Square sub super (sh0 ::+ sh1) a -> Square sub super 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
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  (sh0 ::+ sh1)
  (sh0 ::+ sh1)
  a
-> PlainArray
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     sh0
     sh0
     a
forall sub super sh0 sh1 a.
(Natural sub, Natural super, C sh0, C sh1, Floating a) =>
Square sub super (sh0 ::+ sh1) a -> Square sub super sh0 a
Basic.takeTopLeftSquare

takeBottomRightSquare ::
   (Unary.Natural sub, Unary.Natural super,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   Banded.Square sub super (sh0 ::+ sh1) a ->
   Banded.Square sub super sh1 a
takeBottomRightSquare :: Square sub super (sh0 ::+ sh1) a -> Square sub super sh1 a
takeBottomRightSquare = (PlainArray
   Packed
   Arbitrary
   (Bands sub)
   (Bands super)
   Shape
   Small
   Small
   (sh0 ::+ sh1)
   (sh0 ::+ sh1)
   a
 -> PlainArray
      Packed
      Arbitrary
      (Bands sub)
      (Bands super)
      Shape
      Small
      Small
      sh1
      sh1
      a)
-> Square sub super (sh0 ::+ sh1) a -> Square sub super 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
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  (sh0 ::+ sh1)
  (sh0 ::+ sh1)
  a
-> PlainArray
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     sh1
     sh1
     a
forall sub super sh0 sh1 a.
(Natural sub, Natural super, C sh0, C sh1, Floating a) =>
Square sub super (sh0 ::+ sh1) a -> Square sub super sh1 a
Basic.takeBottomRightSquare


noUnit :: Banded.UnitTriangular sub super sh a -> Banded.Square sub super sh a
noUnit :: UnitTriangular sub super sh a -> Square sub super sh a
noUnit UnitTriangular sub super sh a
a =
   case UnitTriangular sub super sh a
-> Omni
     Packed Unit (Bands sub) (Bands super) 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 UnitTriangular sub super sh a
a of
      Omni.UnitBandedTriangular BandedSquare sub super sh
sh ->
         OmniArray
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  sh
  sh
  a
-> Matrix
     (Array Packed Arbitrary)
     ()
     ()
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     sh
     sh
     a
forall pack prop lower upper meas vert horiz height width a.
OmniArray pack prop lower upper meas vert horiz height width a
-> Matrix
     (Array pack prop) () () lower upper meas vert horiz height width a
ArrMatrix.Array (OmniArray
   Packed
   Arbitrary
   (Bands sub)
   (Bands super)
   Shape
   Small
   Small
   sh
   sh
   a
 -> Matrix
      (Array Packed Arbitrary)
      ()
      ()
      (Bands sub)
      (Bands super)
      Shape
      Small
      Small
      sh
      sh
      a)
-> OmniArray
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     sh
     sh
     a
-> Matrix
     (Array Packed Arbitrary)
     ()
     ()
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     sh
     sh
     a
forall a b. (a -> b) -> a -> b
$ Omni
  Packed Arbitrary (Bands sub) (Bands super) Shape Small Small sh sh
-> Array
     (Omni
        Packed Unit (Bands sub) (Bands super) Shape Small Small sh sh)
     a
-> OmniArray
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     sh
     sh
     a
forall sh1 sh0 a. sh1 -> Array sh0 a -> Array sh1 a
Array.reshape (BandedSquare sub super sh
-> Omni
     Packed Arbitrary (Bands sub) (Bands super) Shape Small Small sh sh
forall sub super meas vert horiz height width.
(Natural sub, Natural super) =>
Banded sub super meas vert horiz height width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
Omni.Banded BandedSquare sub super sh
sh) (UnitTriangular sub super sh a
-> Array
     (Omni
        Packed Unit (Bands sub) (Bands super) Shape Small Small sh sh)
     a
forall pack property lower upper meas vert horiz height width a.
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> OmniArray
     pack property lower upper meas vert horiz height width a
ArrMatrix.unwrap UnitTriangular sub super sh a
a)


offDiagonals ::
   (Unary.Natural sub, Unary.Natural super) =>
   Banded.Quadratic diag sub super sh a ->
   (Unary.HeadSingleton sub, Unary.HeadSingleton super)
offDiagonals :: Quadratic diag sub super sh a
-> (HeadSingleton sub, HeadSingleton super)
offDiagonals Quadratic diag sub super sh a
_ = (HeadSingleton sub
forall n. Natural n => HeadSingleton n
Unary.headSingleton, HeadSingleton super
forall n. Natural n => HeadSingleton n
Unary.headSingleton)

solve ::
   (Omni.TriDiag diag, Unary.Natural sub, Unary.Natural super,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C sh, Eq sh, Shape.C nrhs, Class.Floating a) =>
   Banded.Quadratic diag sub super sh a ->
   Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a
solve :: Quadratic diag sub super sh a
-> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a
solve Quadratic diag sub super sh a
a =
   case Quadratic diag sub super 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 Quadratic diag sub super sh a
a of
      diag :: DiagSingleton diag
diag@DiagSingleton diag
Omni.Unit ->
         case Quadratic diag sub super sh a
-> Omni
     Packed diag (Bands sub) (Bands super) 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 Quadratic diag sub super sh a
a of
            Omni.UnitBandedTriangular BandedSquare sub super sh
_ ->
               (PlainArray
   Packed diag (Bands sub) (Bands super) 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)
-> Quadratic diag sub super 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
-> Square sub super sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall sub super diag meas vert horiz sh nrhs a.
(BandedTriangular sub super, TriDiag diag, Measure meas, C vert,
 C horiz, C sh, Eq sh, C nrhs, Floating a) =>
DiagSingleton diag
-> Square sub super sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
Linear.solveTriangular DiagSingleton diag
diag) Quadratic diag sub super sh a
a
      diag :: DiagSingleton diag
diag@DiagSingleton diag
Omni.Arbitrary ->
         case Quadratic diag sub super sh a
-> (HeadSingleton sub, HeadSingleton super)
forall sub super diag sh a.
(Natural sub, Natural super) =>
Quadratic diag sub super sh a
-> (HeadSingleton sub, HeadSingleton super)
offDiagonals Quadratic diag sub super sh a
a of
            (HeadSingleton sub
Unary.Zero, HeadSingleton super
Unary.Zero) ->
               (PlainArray
   Packed diag (Bands sub) (Bands super) 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)
-> Quadratic diag sub super 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
-> Square Zero Zero sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall sub super diag meas vert horiz sh nrhs a.
(BandedTriangular sub super, TriDiag diag, Measure meas, C vert,
 C horiz, C sh, Eq sh, C nrhs, Floating a) =>
DiagSingleton diag
-> Square sub super sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
Linear.solveTriangular DiagSingleton diag
diag) Quadratic diag sub super sh a
a
            (HeadSingleton sub
Unary.Zero, HeadSingleton super
Unary.Succ) ->
               (PlainArray
   Packed diag (Bands sub) (Bands super) 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)
-> Quadratic diag sub super 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
-> Square Zero (Succ n1) sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall sub super diag meas vert horiz sh nrhs a.
(BandedTriangular sub super, TriDiag diag, Measure meas, C vert,
 C horiz, C sh, Eq sh, C nrhs, Floating a) =>
DiagSingleton diag
-> Square sub super sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
Linear.solveTriangular DiagSingleton diag
diag) Quadratic diag sub super sh a
a
            (HeadSingleton sub
Unary.Succ, HeadSingleton super
Unary.Zero) ->
               (PlainArray
   Packed diag (Bands sub) (Bands super) 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)
-> Quadratic diag sub super 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
-> Square (Succ n1) Zero sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall sub super diag meas vert horiz sh nrhs a.
(BandedTriangular sub super, TriDiag diag, Measure meas, C vert,
 C horiz, C sh, Eq sh, C nrhs, Floating a) =>
DiagSingleton diag
-> Square sub super sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
Linear.solveTriangular DiagSingleton diag
diag) Quadratic diag sub super sh a
a
            (HeadSingleton sub
Unary.Succ, HeadSingleton super
Unary.Succ) ->
               (PlainArray
   Packed diag (Bands sub) (Bands super) 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)
-> Quadratic diag sub super 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 PlainArray
  Packed diag (Bands sub) (Bands super) 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
forall sub super meas vert horiz sh nrhs a.
(Natural sub, Natural super, Measure meas, C vert, C horiz, C sh,
 Eq sh, C nrhs, Floating a) =>
Square sub super sh a
-> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a
Linear.solve Quadratic diag sub super sh a
a

determinant ::
   (Omni.TriDiag diag, Unary.Natural sub, Unary.Natural super,
    Shape.C sh, Class.Floating a) =>
   Banded.Quadratic diag sub super sh a -> a
determinant :: Quadratic diag sub super sh a -> a
determinant Quadratic diag sub super sh a
a =
   case Quadratic diag sub super 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
ArrMatrix.diagTag Quadratic diag sub super sh a
a of
      DiagSingleton diag
MatrixShape.Unit -> a
forall a. Floating a => a
Scalar.one
      DiagSingleton diag
MatrixShape.Arbitrary -> Square sub super sh a -> a
forall sub super sh a.
(Natural sub, Natural super, C sh, Floating a) =>
Square sub super sh a -> a
Linear.determinant (Square sub super sh a -> a) -> Square sub super sh a -> a
forall a b. (a -> b) -> a -> b
$ Quadratic diag sub super sh a
-> PlainArray
     Packed diag (Bands sub) (Bands super) 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 Quadratic diag sub super sh a
a