{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Rank2Types #-}
module Numeric.LAPACK.Matrix.Shape.Omni (
   Omni(..),
   Unit,
   Arbitrary,
   Symmetric,
   Hermitian,
   HermitianUnknownDefiniteness,
   HermitianPositiveDefinite,
   HermitianPositiveSemidefinite,
   HermitianNegativeDefinite,
   HermitianNegativeSemidefinite,
   hermitianSet,
   TriDiag(switchTriDiag),
   DiagSingleton(..),
   autoDiag,
   charFromTriDiag,
   packTag,
   Property,
   property,
   PropertySingleton(..),
   propertySingleton,
   Strip(..),
   strips,
   StripSingleton(..),
   stripSingleton,
   PowerStrip(..),
   PowerStripSingleton(..),
   powerStripSingleton,
   powerStrips,
   BandedTriangular,
   BandedTriangularSingleton(BandedLower, BandedUpper, BandedDiagonal),
   bandedTriangularSingleton,
   extent,
   height, width, squareSize,
   mapHeight, mapWidth, mapSquareSize,
   order,
   transpose,
   Plain,
   ToPlain, toPlain,
   FromPlain, fromPlain,
   toFull, fromFull,
   toBanded, toBandedHermitian,
   MultipliedBands,
   MultipliedStrip,
   MultipliedProperty,
   UnitIfTriangular,
   MergeUnit,
   Quadratic,
   quadratic,
   uncheckedDiagonal,
   Power(..),
   powerSingleton,
   ) where

import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout
import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent
import qualified Numeric.LAPACK.Matrix.Extent.Strict as ExtentS
import Numeric.LAPACK.Matrix.Extent.Private (Extent, Small, Shape, Size)
import Numeric.LAPACK.Matrix.Layout.Private
         (Bands, Empty, Filled, Packed, Unpacked)

import qualified Data.Array.Comfort.Shape as Shape

import qualified Type.Data.Num.Unary as Unary
import qualified Type.Data.Bool as TBool
import Type.Data.Num.Unary.Literal (U0)
import Type.Data.Bool (False, True)
import Type.Base.Proxy (Proxy(Proxy))

import qualified Control.DeepSeq as DeepSeq



data Unit
data Arbitrary

class (Property diag) => TriDiag diag where
   switchTriDiag :: f Unit -> f Arbitrary -> f diag
instance TriDiag Unit where switchTriDiag :: f Unit -> f Arbitrary -> f Unit
switchTriDiag f Unit
f f Arbitrary
_ = f Unit
f
instance TriDiag Arbitrary where switchTriDiag :: f Unit -> f Arbitrary -> f Arbitrary
switchTriDiag f Unit
_ f Arbitrary
f = f Arbitrary
f

autoDiag :: TriDiag diag => DiagSingleton diag
autoDiag :: DiagSingleton diag
autoDiag = DiagSingleton Unit -> DiagSingleton Arbitrary -> DiagSingleton diag
forall diag (f :: * -> *).
TriDiag diag =>
f Unit -> f Arbitrary -> f diag
switchTriDiag DiagSingleton Unit
Unit DiagSingleton Arbitrary
Arbitrary

charFromTriDiag :: TriDiag diag => DiagSingleton diag -> Char
charFromTriDiag :: DiagSingleton diag -> Char
charFromTriDiag DiagSingleton diag
diag = case DiagSingleton diag
diag of DiagSingleton diag
Unit -> Char
'U'; DiagSingleton diag
Arbitrary -> Char
'N'


data DiagSingleton diag where
   Unit :: DiagSingleton Unit
   Arbitrary :: DiagSingleton Arbitrary

instance Eq (DiagSingleton diag) where
   DiagSingleton diag
Unit == :: DiagSingleton diag -> DiagSingleton diag -> Bool
== DiagSingleton diag
Unit  =  Bool
True
   DiagSingleton diag
Arbitrary == DiagSingleton diag
Arbitrary  =  Bool
True

instance Show (DiagSingleton diag) where
   show :: DiagSingleton diag -> String
show DiagSingleton diag
Unit = String
"Unit"
   show DiagSingleton diag
Arbitrary = String
"Arbitrary"

instance DeepSeq.NFData (DiagSingleton diag) where
   rnf :: DiagSingleton diag -> ()
rnf DiagSingleton diag
Unit = ()
   rnf DiagSingleton diag
Arbitrary = ()


data Symmetric

data Hermitian neg zero pos
type HermitianUnknownDefiniteness  = Hermitian True  True  True
type HermitianPositiveDefinite     = Hermitian False False True
type HermitianPositiveSemidefinite = Hermitian False True  True
type HermitianNegativeDefinite     = Hermitian True  False False
type HermitianNegativeSemidefinite = Hermitian True  True  False

{- |
Impossible:

> instance Definiteness False False False where
> instance Definiteness True  False True  where

The last one is impossible for this reason:

Given @x@ and @y@ with @x^T*A*x < 0@ and @y^T*A*y > 0@.
Because of the intermediate value theorem
there must be a @k@ from @[0,1]@ with
@z = k*x + (1-k)*y@ and @z^T*A*z = 0@.
-}
class Definiteness neg zero pos where
instance Definiteness True  True  True  where
instance Definiteness True  True  False where
instance Definiteness False True  True  where
instance Definiteness True  False False where
instance Definiteness False True  False where
instance Definiteness False False True  where

hermitianSet ::
   (TBool.C neg, TBool.C zero, TBool.C pos) =>
   Omni pack (Hermitian neg zero pos)
      lower upper meas vert horiz height width ->
   (TBool.Singleton neg, TBool.Singleton zero, TBool.Singleton pos)
hermitianSet :: Omni
  pack
  (Hermitian neg zero pos)
  lower
  upper
  meas
  vert
  horiz
  height
  width
-> (Singleton neg, Singleton zero, Singleton pos)
hermitianSet Omni
  pack
  (Hermitian neg zero pos)
  lower
  upper
  meas
  vert
  horiz
  height
  width
_ = (Singleton neg
forall bool. C bool => Singleton bool
TBool.singleton, Singleton zero
forall bool. C bool => Singleton bool
TBool.singleton, Singleton pos
forall bool. C bool => Singleton bool
TBool.singleton)



class Property property where
   switchProperty ::
      f Arbitrary ->
      f Unit ->
      f Symmetric ->
      (forall neg zero pos.
         (TBool.C neg, TBool.C zero, TBool.C pos) =>
         f (Hermitian neg zero pos)) ->
      f property

instance Property Arbitrary where switchProperty :: f Arbitrary
-> f Unit
-> f Symmetric
-> (forall neg zero pos.
    (C neg, C zero, C pos) =>
    f (Hermitian neg zero pos))
-> f Arbitrary
switchProperty f Arbitrary
f f Unit
_ f Symmetric
_ forall neg zero pos.
(C neg, C zero, C pos) =>
f (Hermitian neg zero pos)
_ = f Arbitrary
f
instance Property Unit where switchProperty :: f Arbitrary
-> f Unit
-> f Symmetric
-> (forall neg zero pos.
    (C neg, C zero, C pos) =>
    f (Hermitian neg zero pos))
-> f Unit
switchProperty f Arbitrary
_ f Unit
f f Symmetric
_ forall neg zero pos.
(C neg, C zero, C pos) =>
f (Hermitian neg zero pos)
_ = f Unit
f
instance Property Symmetric where switchProperty :: f Arbitrary
-> f Unit
-> f Symmetric
-> (forall neg zero pos.
    (C neg, C zero, C pos) =>
    f (Hermitian neg zero pos))
-> f Symmetric
switchProperty f Arbitrary
_ f Unit
_ f Symmetric
f forall neg zero pos.
(C neg, C zero, C pos) =>
f (Hermitian neg zero pos)
_ = f Symmetric
f
instance
   (TBool.C neg, TBool.C zero, TBool.C pos) =>
      Property (Hermitian neg zero pos) where
   switchProperty :: f Arbitrary
-> f Unit
-> f Symmetric
-> (forall neg zero pos.
    (C neg, C zero, C pos) =>
    f (Hermitian neg zero pos))
-> f (Hermitian neg zero pos)
switchProperty f Arbitrary
_ f Unit
_ f Symmetric
_ forall neg zero pos.
(C neg, C zero, C pos) =>
f (Hermitian neg zero pos)
f = f (Hermitian neg zero pos)
forall neg zero pos.
(C neg, C zero, C pos) =>
f (Hermitian neg zero pos)
f

data PropertySingleton property where
   PropArbitrary :: PropertySingleton Arbitrary
   PropUnit      :: PropertySingleton Unit
   PropSymmetric :: PropertySingleton Symmetric
   PropHermitian ::
      (TBool.C neg, TBool.C zero, TBool.C pos) =>
      PropertySingleton (Hermitian neg zero pos)

propertySingleton ::
   (Property property) => PropertySingleton property
propertySingleton :: PropertySingleton property
propertySingleton =
   PropertySingleton Arbitrary
-> PropertySingleton Unit
-> PropertySingleton Symmetric
-> (forall neg zero pos.
    (C neg, C zero, C pos) =>
    PropertySingleton (Hermitian neg zero pos))
-> PropertySingleton property
forall property (f :: * -> *).
Property property =>
f Arbitrary
-> f Unit
-> f Symmetric
-> (forall neg zero pos.
    (C neg, C zero, C pos) =>
    f (Hermitian neg zero pos))
-> f property
switchProperty PropertySingleton Arbitrary
PropArbitrary PropertySingleton Unit
PropUnit PropertySingleton Symmetric
PropSymmetric forall neg zero pos.
(C neg, C zero, C pos) =>
PropertySingleton (Hermitian neg zero pos)
PropHermitian

property ::
   (Property property) =>
   Omni pack property lower upper meas vert horiz height width ->
   PropertySingleton property
property :: Omni pack property lower upper meas vert horiz height width
-> PropertySingleton property
property Omni pack property lower upper meas vert horiz height width
_ = PropertySingleton property
forall property. Property property => PropertySingleton property
propertySingleton


class
   (MultipliedBands c Filled ~ Filled, MultipliedBands c Empty ~ c) =>
      Strip c where
   switchStrip ::
      (forall offDiag. Unary.Natural offDiag => f (Bands offDiag)) ->
      f Filled ->
      f c
instance (Unary.Natural offDiag) => Strip (Bands offDiag) where
   switchStrip :: (forall offDiag. Natural offDiag => f (Bands offDiag))
-> f Filled -> f (Bands offDiag)
switchStrip forall offDiag. Natural offDiag => f (Bands offDiag)
f f Filled
_ = f (Bands offDiag)
forall offDiag. Natural offDiag => f (Bands offDiag)
f
instance Strip Filled where
   switchStrip :: (forall offDiag. Natural offDiag => f (Bands offDiag))
-> f Filled -> f Filled
switchStrip forall offDiag. Natural offDiag => f (Bands offDiag)
_ f Filled
f = f Filled
f


data StripSingleton c where
   StripBands ::
      (Unary.Natural offDiag) =>
      Unary.HeadSingleton offDiag -> StripSingleton (Bands offDiag)
   StripFilled :: StripSingleton Filled

stripSingleton :: (Strip c) => StripSingleton c
stripSingleton :: StripSingleton c
stripSingleton = (forall offDiag. Natural offDiag => StripSingleton (Bands offDiag))
-> StripSingleton Filled -> StripSingleton c
forall c (f :: * -> *).
Strip c =>
(forall offDiag. Natural offDiag => f (Bands offDiag))
-> f Filled -> f c
switchStrip (HeadSingleton offDiag -> StripSingleton (Bands offDiag)
forall offDiag.
Natural offDiag =>
HeadSingleton offDiag -> StripSingleton (Bands offDiag)
StripBands HeadSingleton offDiag
forall n. Natural n => HeadSingleton n
Unary.headSingleton) StripSingleton Filled
StripFilled

strips ::
   (Strip lower, Strip upper) =>
   Omni pack property lower upper meas vert horiz height width ->
   (StripSingleton lower, StripSingleton upper)
strips :: Omni pack property lower upper meas vert horiz height width
-> (StripSingleton lower, StripSingleton upper)
strips Omni pack property lower upper meas vert horiz height width
_ = (StripSingleton lower
forall c. Strip c => StripSingleton c
stripSingleton, StripSingleton upper
forall c. Strip c => StripSingleton c
stripSingleton)



{- |
'PowerStrip' is either 'Empty' or 'Filled'.
These are the 'Strip's that are preserved in matrix powers.

Pun intended.
-}
class (Strip c) => PowerStrip c where
   switchPowerStrip :: f Empty -> f Filled -> f c
instance (offDiag ~ U0) => PowerStrip (Bands offDiag) where
   switchPowerStrip :: f Empty -> f Filled -> f (Bands offDiag)
switchPowerStrip f Empty
f f Filled
_ = f (Bands offDiag)
f Empty
f
instance PowerStrip Filled where
   switchPowerStrip :: f Empty -> f Filled -> f Filled
switchPowerStrip f Empty
_ f Filled
f = f Filled
f

data PowerStripSingleton c where
   Empty :: PowerStripSingleton Empty
   Filled :: PowerStripSingleton Filled

powerStripSingleton :: (PowerStrip c) => PowerStripSingleton c
powerStripSingleton :: PowerStripSingleton c
powerStripSingleton = PowerStripSingleton Empty
-> PowerStripSingleton Filled -> PowerStripSingleton c
forall c (f :: * -> *). PowerStrip c => f Empty -> f Filled -> f c
switchPowerStrip PowerStripSingleton Empty
Empty PowerStripSingleton Filled
Filled

powerStrips ::
   (PowerStrip lower, PowerStrip upper) =>
   Omni pack property lower upper meas vert horiz height width ->
   (PowerStripSingleton lower, PowerStripSingleton upper)
powerStrips :: Omni pack property lower upper meas vert horiz height width
-> (PowerStripSingleton lower, PowerStripSingleton upper)
powerStrips Omni pack property lower upper meas vert horiz height width
_ = (PowerStripSingleton lower
forall c. PowerStrip c => PowerStripSingleton c
powerStripSingleton, PowerStripSingleton upper
forall c. PowerStrip c => PowerStripSingleton c
powerStripSingleton)


packTag ::
   (Layout.Packing pack) =>
   Omni pack propery lower upper meas vert horiz height width ->
   Layout.PackingSingleton pack
packTag :: Omni pack propery lower upper meas vert horiz height width
-> PackingSingleton pack
packTag Omni pack propery lower upper meas vert horiz height width
_ = PackingSingleton pack
forall pack. Packing pack => PackingSingleton pack
Layout.autoPacking


type PowerQuadratic pack property lower upper sh =
      Power pack property lower upper Shape Small Small sh sh

data Power pack property lower upper meas vert horiz height width where
   PowerIdentity ::
      (Layout.Packing pack) =>
      PowerQuadratic pack Unit Empty Empty sh
   PowerDiagonal ::
      (Layout.Packing pack) =>
      Power pack property Empty Empty meas vert horiz height width
   PowerUpperTriangular ::
      (Layout.Packing pack, TriDiag diag) =>
      PowerQuadratic pack diag Empty Filled sh
   PowerLowerTriangular ::
      (Layout.Packing pack, TriDiag diag) =>
      PowerQuadratic pack diag Filled Empty sh
   PowerSymmetric ::
      (Layout.Packing pack) =>
      PowerQuadratic pack Symmetric Filled Filled sh
   PowerHermitian ::
      (Layout.Packing pack, TBool.C neg, TBool.C zero, TBool.C pos) =>
      PowerQuadratic pack (Hermitian neg zero pos) Filled Filled sh
   PowerFull ::
      Power Unpacked property lower upper meas vert horiz height width

powerSingleton ::
   (Layout.Packing pack, Property property,
    PowerStrip lower, PowerStrip upper,
    Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Omni pack property lower upper meas vert horiz height width ->
   Power pack property lower upper meas vert horiz height width
powerSingleton :: Omni pack property lower upper meas vert horiz height width
-> Power pack property lower upper meas vert horiz height width
powerSingleton Omni pack property lower upper meas vert horiz height width
shape =
   case Omni pack property lower upper meas vert horiz height width
-> PackingSingleton pack
forall pack propery lower upper meas vert horiz height width.
Packing pack =>
Omni pack propery lower upper meas vert horiz height width
-> PackingSingleton pack
packTag Omni pack property lower upper meas vert horiz height width
shape of
      PackingSingleton pack
Layout.Packed ->
         case (Omni pack property lower upper meas vert horiz height width
shape, Omni pack property lower upper meas vert horiz height width
-> (PowerStripSingleton lower, PowerStripSingleton upper)
forall lower upper pack property meas vert horiz height width.
(PowerStrip lower, PowerStrip upper) =>
Omni pack property lower upper meas vert horiz height width
-> (PowerStripSingleton lower, PowerStripSingleton upper)
powerStrips Omni pack property lower upper meas vert horiz height width
shape) of
            (UpperTriangular UpperTriangular height
_, (PowerStripSingleton lower, PowerStripSingleton upper)
_) -> Power pack property lower upper meas vert horiz height width
forall pack diag sh.
(Packing pack, TriDiag diag) =>
PowerQuadratic pack diag Empty Filled sh
PowerUpperTriangular
            (LowerTriangular LowerTriangular height
_, (PowerStripSingleton lower, PowerStripSingleton upper)
_) -> Power pack property lower upper meas vert horiz height width
forall pack diag sh.
(Packing pack, TriDiag diag) =>
PowerQuadratic pack diag Filled Empty sh
PowerLowerTriangular
            (Symmetric Symmetric height
_, (PowerStripSingleton lower, PowerStripSingleton upper)
_) -> Power pack property lower upper meas vert horiz height width
forall pack sh.
Packing pack =>
PowerQuadratic pack Symmetric Filled Filled sh
PowerSymmetric
            (Hermitian Hermitian height
_, (PowerStripSingleton lower, PowerStripSingleton upper)
_) -> Power pack property lower upper meas vert horiz height width
forall pack neg zero pos sh.
(Packing pack, C neg, C zero, C pos) =>
PowerQuadratic pack (Hermitian neg zero pos) Filled Filled sh
PowerHermitian
            (Banded Banded sub super meas vert horiz height width
_, (PowerStripSingleton lower
Empty, PowerStripSingleton upper
Empty)) -> Power pack property lower upper meas vert horiz height width
forall pack property meas vert horiz height width.
Packing pack =>
Power pack property Empty Empty meas vert horiz height width
PowerDiagonal
            (BandedHermitian BandedHermitian offDiag height
_, (PowerStripSingleton lower
Empty, PowerStripSingleton upper
Empty)) -> Power pack property lower upper meas vert horiz height width
forall pack property meas vert horiz height width.
Packing pack =>
Power pack property Empty Empty meas vert horiz height width
PowerDiagonal
            (UnitBandedTriangular BandedSquare sub super height
_, (PowerStripSingleton lower
Empty, PowerStripSingleton upper
Empty)) -> Power pack property lower upper meas vert horiz height width
forall pack sh.
Packing pack =>
PowerQuadratic pack Unit Empty Empty sh
PowerIdentity
      PackingSingleton pack
Layout.Unpacked ->
         case (Omni pack property lower upper meas vert horiz height width
-> Extent meas vert horiz height 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
-> Extent meas vert horiz height width
extent Omni pack property lower upper meas vert horiz height width
shape, Omni pack property lower upper meas vert horiz height width
-> PropertySingleton property
forall property pack lower upper meas vert horiz height width.
Property property =>
Omni pack property lower upper meas vert horiz height width
-> PropertySingleton property
property Omni pack property lower upper meas vert horiz height width
shape, Omni pack property lower upper meas vert horiz height width
-> (PowerStripSingleton lower, PowerStripSingleton upper)
forall lower upper pack property meas vert horiz height width.
(PowerStrip lower, PowerStrip upper) =>
Omni pack property lower upper meas vert horiz height width
-> (PowerStripSingleton lower, PowerStripSingleton upper)
powerStrips Omni pack property lower upper meas vert horiz height width
shape) of
            (Extent.Square height
_, PropertySingleton property
PropUnit, (PowerStripSingleton lower
Empty, PowerStripSingleton upper
Empty)) ->
               Power pack property lower upper meas vert horiz height width
forall pack sh.
Packing pack =>
PowerQuadratic pack Unit Empty Empty sh
PowerIdentity
            (Extent.Square height
_, PropertySingleton property
_, (PowerStripSingleton lower
Empty, PowerStripSingleton upper
Empty)) ->
               Power pack property lower upper meas vert horiz height width
forall pack property meas vert horiz height width.
Packing pack =>
Power pack property Empty Empty meas vert horiz height width
PowerDiagonal
            (Extent.Square height
_, PropertySingleton property
PropArbitrary, (PowerStripSingleton lower
Empty, PowerStripSingleton upper
Filled)) ->
               Power pack property lower upper meas vert horiz height width
forall pack diag sh.
(Packing pack, TriDiag diag) =>
PowerQuadratic pack diag Empty Filled sh
PowerUpperTriangular
            (Extent.Square height
_, PropertySingleton property
PropArbitrary, (PowerStripSingleton lower
Filled, PowerStripSingleton upper
Empty)) ->
               Power pack property lower upper meas vert horiz height width
forall pack diag sh.
(Packing pack, TriDiag diag) =>
PowerQuadratic pack diag Filled Empty sh
PowerLowerTriangular
            (Extent.Square height
_, PropertySingleton property
PropUnit, (PowerStripSingleton lower
Empty, PowerStripSingleton upper
Filled)) ->
               Power pack property lower upper meas vert horiz height width
forall pack diag sh.
(Packing pack, TriDiag diag) =>
PowerQuadratic pack diag Empty Filled sh
PowerUpperTriangular
            (Extent.Square height
_, PropertySingleton property
PropUnit, (PowerStripSingleton lower
Filled, PowerStripSingleton upper
Empty)) ->
               Power pack property lower upper meas vert horiz height width
forall pack diag sh.
(Packing pack, TriDiag diag) =>
PowerQuadratic pack diag Filled Empty sh
PowerLowerTriangular
            (Extent.Square height
_, PropertySingleton property
PropSymmetric, (PowerStripSingleton lower
Filled, PowerStripSingleton upper
Filled)) ->
               Power pack property lower upper meas vert horiz height width
forall pack sh.
Packing pack =>
PowerQuadratic pack Symmetric Filled Filled sh
PowerSymmetric
            (Extent.Square height
_, PropertySingleton property
PropHermitian, (PowerStripSingleton lower
Filled, PowerStripSingleton upper
Filled)) ->
               Power pack property lower upper meas vert horiz height width
forall pack neg zero pos sh.
(Packing pack, C neg, C zero, C pos) =>
PowerQuadratic pack (Hermitian neg zero pos) Filled Filled sh
PowerHermitian
            (Extent meas vert horiz height width, PropertySingleton property,
 (PowerStripSingleton lower, PowerStripSingleton upper))
_ -> Power pack property lower upper meas vert horiz height width
forall property lower upper meas vert horiz height width.
Power Unpacked property lower upper meas vert horiz height width
PowerFull


class
   (Unary.Natural sub, Unary.Natural super) =>
      BandedTriangular sub super where
   switchBandedTriangular ::
      f Unary.Zero Unary.Zero ->
      (forall offDiag. Unary.Natural offDiag =>
         f Unary.Zero (Unary.Succ offDiag)) ->
      (forall offDiag. Unary.Natural offDiag =>
         f (Unary.Succ offDiag) Unary.Zero) ->
      f sub super
instance BandedTriangular Unary.Zero Unary.Zero where
   switchBandedTriangular :: f U0 U0
-> (forall offDiag. Natural offDiag => f U0 (Succ offDiag))
-> (forall offDiag. Natural offDiag => f (Succ offDiag) U0)
-> f U0 U0
switchBandedTriangular f U0 U0
f forall offDiag. Natural offDiag => f U0 (Succ offDiag)
_ forall offDiag. Natural offDiag => f (Succ offDiag) U0
_ = f U0 U0
f
instance (Unary.Natural super) =>
      BandedTriangular Unary.Zero (Unary.Succ super) where
   switchBandedTriangular :: f U0 U0
-> (forall offDiag. Natural offDiag => f U0 (Succ offDiag))
-> (forall offDiag. Natural offDiag => f (Succ offDiag) U0)
-> f U0 (Succ super)
switchBandedTriangular f U0 U0
_ forall offDiag. Natural offDiag => f U0 (Succ offDiag)
f forall offDiag. Natural offDiag => f (Succ offDiag) U0
_ = f U0 (Succ super)
forall offDiag. Natural offDiag => f U0 (Succ offDiag)
f
instance (Unary.Natural sub) =>
      BandedTriangular (Unary.Succ sub) Unary.Zero where
   switchBandedTriangular :: f U0 U0
-> (forall offDiag. Natural offDiag => f U0 (Succ offDiag))
-> (forall offDiag. Natural offDiag => f (Succ offDiag) U0)
-> f (Succ sub) U0
switchBandedTriangular f U0 U0
_ forall offDiag. Natural offDiag => f U0 (Succ offDiag)
_ forall offDiag. Natural offDiag => f (Succ offDiag) U0
f = f (Succ sub) U0
forall offDiag. Natural offDiag => f (Succ offDiag) U0
f

data BandedTriangularSingleton sub super where
   BandedDiagonal :: BandedTriangularSingleton Unary.Zero Unary.Zero
   BandedUpper ::
      Unary.Natural offDiag =>
         BandedTriangularSingleton Unary.Zero (Unary.Succ offDiag)
   BandedLower ::
      Unary.Natural offDiag =>
         BandedTriangularSingleton (Unary.Succ offDiag) Unary.Zero

bandedTriangularSingleton ::
   (BandedTriangular sub super) =>
   Layout.Banded sub super meas vert horiz height width ->
   BandedTriangularSingleton sub super
bandedTriangularSingleton :: Banded sub super meas vert horiz height width
-> BandedTriangularSingleton sub super
bandedTriangularSingleton Banded sub super meas vert horiz height width
_ =
   BandedTriangularSingleton U0 U0
-> (forall offDiag.
    Natural offDiag =>
    BandedTriangularSingleton U0 (Succ offDiag))
-> (forall offDiag.
    Natural offDiag =>
    BandedTriangularSingleton (Succ offDiag) U0)
-> BandedTriangularSingleton sub super
forall sub super (f :: * -> * -> *).
BandedTriangular sub super =>
f U0 U0
-> (forall offDiag. Natural offDiag => f U0 (Succ offDiag))
-> (forall offDiag. Natural offDiag => f (Succ offDiag) U0)
-> f sub super
switchBandedTriangular BandedTriangularSingleton U0 U0
BandedDiagonal forall offDiag.
Natural offDiag =>
BandedTriangularSingleton U0 (Succ offDiag)
BandedUpper forall offDiag.
Natural offDiag =>
BandedTriangularSingleton (Succ offDiag) U0
BandedLower


data Omni pack property lower upper meas vert horiz height width where
   Full ::
      (Property property, Strip lower, Strip upper) =>
      Layout.Full meas vert horiz height width ->
      Omni Unpacked property lower upper meas vert horiz height width

   UpperTriangular ::
      (TriDiag diag) =>
      Layout.UpperTriangular size ->
      Omni Packed diag Empty Filled Shape Small Small size size
   LowerTriangular ::
      (TriDiag diag) =>
      Layout.LowerTriangular size ->
      Omni Packed diag Filled Empty Shape Small Small size size

   Symmetric ::
      Layout.Symmetric size ->
      Omni Packed Symmetric Filled Filled Shape Small Small size size
   Hermitian ::
      (TBool.C neg, TBool.C zero, TBool.C pos) =>
      Layout.Hermitian size ->
      Omni Packed (Hermitian neg zero pos)
         Filled Filled Shape Small Small size size

   Banded ::
      (Unary.Natural sub, Unary.Natural super) =>
      Layout.Banded sub super meas vert horiz height width ->
      Omni Packed Arbitrary
         (Bands sub) (Bands super) meas vert horiz height width

   UnitBandedTriangular ::
      (BandedTriangular sub super, BandedTriangular super sub) =>
      Layout.BandedSquare sub super size ->
      Omni Packed Unit (Bands sub) (Bands super) Shape Small Small size size

   BandedHermitian ::
      (TBool.C neg, TBool.C zero, TBool.C pos, Unary.Natural offDiag) =>
      Layout.BandedHermitian offDiag size ->
      Omni Packed (Hermitian neg zero pos)
         (Bands offDiag) (Bands offDiag) Shape Small Small size size

deriving instance
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Eq height, Eq width) =>
   Eq (Omni pack property lower upper meas vert horiz height width)

deriving instance
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Show height, Show width) =>
   Show (Omni pack property lower upper meas vert horiz height width)

instance
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    DeepSeq.NFData height, DeepSeq.NFData width) =>
   DeepSeq.NFData
         (Omni pack property lower upper meas vert horiz height width) where
      rnf :: Omni pack property lower upper meas vert horiz height width -> ()
rnf Omni pack property lower upper meas vert horiz height width
omni =
         case Omni pack property lower upper meas vert horiz height width
omni of
            Full Full meas vert horiz height width
shape -> Full meas vert horiz height width -> ()
forall a. NFData a => a -> ()
DeepSeq.rnf Full meas vert horiz height width
shape
            UpperTriangular UpperTriangular height
shape -> UpperTriangular height -> ()
forall a. NFData a => a -> ()
DeepSeq.rnf UpperTriangular height
shape
            LowerTriangular LowerTriangular height
shape -> LowerTriangular height -> ()
forall a. NFData a => a -> ()
DeepSeq.rnf LowerTriangular height
shape
            Symmetric Symmetric height
shape -> Symmetric height -> ()
forall a. NFData a => a -> ()
DeepSeq.rnf Symmetric height
shape
            Hermitian Hermitian height
shape -> Hermitian height -> ()
forall a. NFData a => a -> ()
DeepSeq.rnf Hermitian height
shape
            Banded Banded sub super meas vert horiz height width
shape -> Banded sub super meas vert horiz height width -> ()
forall a. NFData a => a -> ()
DeepSeq.rnf Banded sub super meas vert horiz height width
shape
            UnitBandedTriangular BandedSquare sub super height
shape -> BandedSquare sub super height -> ()
forall a. NFData a => a -> ()
DeepSeq.rnf BandedSquare sub super height
shape
            BandedHermitian BandedHermitian offDiag height
shape -> BandedHermitian offDiag height -> ()
forall a. NFData a => a -> ()
DeepSeq.rnf BandedHermitian offDiag height
shape


{- |
Construct a shape from order, dimensions and type information.
-}
class
   (Property property, Strip lower, Strip upper,
    ExtentS.Measured meas vert, ExtentS.Measured meas horiz) =>
      Cons pack property lower upper meas vert horiz where
   cons ::
      (Shape.C height, Shape.C width) =>
      (ExtentS.MeasureTarget meas height ~ ExtentS.MeasureTarget meas width) =>
      Layout.Order -> ExtentS.Dimension meas height width ->
      Omni pack property lower upper meas vert horiz height width

instance
   (Strip lower, Strip upper,
    ExtentS.Measured meas vert, ExtentS.Measured meas horiz) =>
      Cons Unpacked Arbitrary lower upper meas vert horiz where
   cons :: Order
-> Dimension meas height width
-> Omni Unpacked Arbitrary lower upper meas vert horiz height width
cons Order
order_ = Full meas vert horiz height width
-> Omni Unpacked Arbitrary lower upper meas vert horiz height width
forall property lower upper meas vert horiz height width.
(Property property, Strip lower, Strip upper) =>
Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
Full (Full meas vert horiz height width
 -> Omni
      Unpacked Arbitrary lower upper meas vert horiz height width)
-> (Dimension meas height width
    -> Full meas vert horiz height width)
-> Dimension meas height width
-> Omni Unpacked Arbitrary lower upper meas vert horiz height width
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order
-> Extent meas vert horiz height width
-> Full meas vert horiz height width
forall meas vert horiz height width.
Order
-> Extent meas vert horiz height width
-> Full meas vert horiz height width
Layout.Full Order
order_ (Extent meas vert horiz height width
 -> Full meas vert horiz height width)
-> (Dimension meas height width
    -> Extent meas vert horiz height width)
-> Dimension meas height width
-> Full meas vert horiz height width
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Dimension meas height width -> Extent meas vert horiz height width
forall meas vert horiz height width.
(Measured meas vert, Measured meas horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Dimension meas height width -> Extent meas vert horiz height width
ExtentS.consChecked

instance
   (TriDiag diag, Shape ~ meas, Small ~ vert, Small ~ horiz) =>
      Cons Packed diag Empty Filled meas vert horiz where
   cons :: Order
-> Dimension meas height width
-> Omni Packed diag Empty Filled meas vert horiz height width
cons Order
order_ = UpperTriangular height
-> Omni Packed diag Empty Filled Shape Small Small height height
forall diag size.
TriDiag diag =>
UpperTriangular size
-> Omni Packed diag Empty Filled Shape Small Small size size
UpperTriangular (UpperTriangular height
 -> Omni Packed diag Empty Filled Shape Small Small height height)
-> (height -> UpperTriangular height)
-> height
-> Omni Packed diag Empty Filled Shape Small Small height height
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> height -> UpperTriangular height
forall size. Order -> size -> UpperTriangular size
Layout.upperTriangular  Order
order_

instance
   (TriDiag diag, Shape ~ meas, Small ~ vert, Small ~ horiz) =>
      Cons Packed diag Filled Empty meas vert horiz where
   cons :: Order
-> Dimension meas height width
-> Omni Packed diag Filled Empty meas vert horiz height width
cons Order
order_ = LowerTriangular height
-> Omni Packed diag Filled Empty Shape Small Small height height
forall diag size.
TriDiag diag =>
LowerTriangular size
-> Omni Packed diag Filled Empty Shape Small Small size size
LowerTriangular (LowerTriangular height
 -> Omni Packed diag Filled Empty Shape Small Small height height)
-> (height -> LowerTriangular height)
-> height
-> Omni Packed diag Filled Empty Shape Small Small height height
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> height -> LowerTriangular height
forall size. Order -> size -> LowerTriangular size
Layout.lowerTriangular Order
order_

instance
   (Shape ~ meas, Small ~ vert, Small ~ horiz) =>
      Cons Packed Symmetric Filled Filled meas vert horiz where
   cons :: Order
-> Dimension meas height width
-> Omni Packed Symmetric Filled Filled meas vert horiz height width
cons Order
order_ = Symmetric height
-> Omni
     Packed Symmetric Filled Filled Shape Small Small height height
forall size.
Symmetric size
-> Omni Packed Symmetric Filled Filled Shape Small Small size size
Symmetric (Symmetric height
 -> Omni
      Packed Symmetric Filled Filled Shape Small Small height height)
-> (height -> Symmetric height)
-> height
-> Omni
     Packed Symmetric Filled Filled Shape Small Small height height
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> height -> Symmetric height
forall size. Order -> size -> Symmetric size
Layout.symmetric Order
order_

instance
   (TBool.C neg, TBool.C zero, TBool.C pos,
    Shape ~ meas, Small ~ vert, Small ~ horiz) =>
      Cons Packed (Hermitian neg zero pos) Filled Filled meas vert horiz where
   cons :: Order
-> Dimension meas height width
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     meas
     vert
     horiz
     height
     width
cons Order
order_ = Hermitian height
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     height
     height
forall neg zero sub size.
(C neg, C zero, C sub) =>
Hermitian size
-> Omni
     Packed
     (Hermitian neg zero sub)
     Filled
     Filled
     Shape
     Small
     Small
     size
     size
Hermitian (Hermitian height
 -> Omni
      Packed
      (Hermitian neg zero pos)
      Filled
      Filled
      Shape
      Small
      Small
      height
      height)
-> (height -> Hermitian height)
-> height
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     height
     height
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> height -> Hermitian height
forall size. Order -> size -> Hermitian size
Layout.hermitian Order
order_

instance
   (ExtentS.Measured meas vert, ExtentS.Measured meas horiz,
    Unary.Natural sub, Unary.Natural super) =>
      Cons Packed Arbitrary (Bands sub) (Bands super) meas vert horiz where
   cons :: Order
-> Dimension meas height width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
cons Order
order_ =
      Banded sub super meas vert horiz height width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
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
Banded (Banded sub super meas vert horiz height width
 -> Omni
      Packed
      Arbitrary
      (Bands sub)
      (Bands super)
      meas
      vert
      horiz
      height
      width)
-> (Dimension meas height width
    -> Banded sub super meas vert horiz height width)
-> Dimension meas height width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnaryProxy sub, UnaryProxy super)
-> Order
-> Extent meas vert horiz height width
-> Banded sub super meas vert horiz height width
forall sub super meas vert horiz height width.
(UnaryProxy sub, UnaryProxy super)
-> Order
-> Extent meas vert horiz height width
-> Banded sub super meas vert horiz height width
Layout.Banded (UnaryProxy sub
forall a. Proxy a
Proxy,UnaryProxy super
forall a. Proxy a
Proxy) Order
order_ (Extent meas vert horiz height width
 -> Banded sub super meas vert horiz height width)
-> (Dimension meas height width
    -> Extent meas vert horiz height width)
-> Dimension meas height width
-> Banded sub super meas vert horiz height width
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Dimension meas height width -> Extent meas vert horiz height width
forall meas vert horiz height width.
(Measured meas vert, Measured meas horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Dimension meas height width -> Extent meas vert horiz height width
ExtentS.consChecked

instance
   (BandedTriangular sub super, BandedTriangular super sub,
    Shape ~ meas, Small ~ vert, Small ~ horiz) =>
      Cons Packed Unit (Bands sub) (Bands super) meas vert horiz where
   cons :: Order
-> Dimension meas height width
-> Omni
     Packed Unit (Bands sub) (Bands super) meas vert horiz height width
cons Order
order_ =
      BandedSquare sub super height
-> Omni
     Packed
     Unit
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     height
forall sub super size.
(BandedTriangular sub super, BandedTriangular super sub) =>
BandedSquare sub super size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
UnitBandedTriangular (BandedSquare sub super height
 -> Omni
      Packed
      Unit
      (Bands sub)
      (Bands super)
      Shape
      Small
      Small
      height
      height)
-> (height -> BandedSquare sub super height)
-> height
-> Omni
     Packed
     Unit
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     height
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnaryProxy sub, UnaryProxy super)
-> Order
-> Extent Shape Small Small height height
-> BandedSquare sub super height
forall sub super meas vert horiz height width.
(UnaryProxy sub, UnaryProxy super)
-> Order
-> Extent meas vert horiz height width
-> Banded sub super meas vert horiz height width
Layout.Banded (UnaryProxy sub
forall a. Proxy a
Proxy,UnaryProxy super
forall a. Proxy a
Proxy) Order
order_ (Extent Shape Small Small height height
 -> BandedSquare sub super height)
-> (height -> Extent Shape Small Small height height)
-> height
-> BandedSquare sub super height
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
      height -> Extent Shape Small Small height height
forall sh. sh -> Square sh
Extent.square

instance
   (TBool.C neg, TBool.C zero, TBool.C pos, Unary.Natural sub, sub ~ super,
    Shape ~ meas, Small ~ vert, Small ~ horiz) =>
      Cons
         Packed (Hermitian neg zero pos) (Bands sub) (Bands super)
         meas vert horiz where
   cons :: Order
-> Dimension meas height width
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
cons Order
order_ = BandedHermitian sub height
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands sub)
     (Bands sub)
     Shape
     Small
     Small
     height
     height
forall neg zero pos offDiag size.
(C neg, C zero, C pos, Natural offDiag) =>
BandedHermitian offDiag size
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     size
     size
BandedHermitian (BandedHermitian sub height
 -> Omni
      Packed
      (Hermitian neg zero pos)
      (Bands sub)
      (Bands sub)
      Shape
      Small
      Small
      height
      height)
-> (height -> BandedHermitian sub height)
-> height
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands sub)
     (Bands sub)
     Shape
     Small
     Small
     height
     height
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnaryProxy sub -> Order -> height -> BandedHermitian sub height
forall off size.
UnaryProxy off -> Order -> size -> BandedHermitian off size
Layout.BandedHermitian UnaryProxy sub
forall a. Proxy a
Proxy Order
order_



class Quadratic pack property lower upper where
   quadratic ::
      (Shape.C sh) =>
      Layout.Order -> sh ->
      Omni pack property lower upper Shape Small Small sh sh

instance
   (Strip lower, Strip upper) =>
      Quadratic Unpacked Arbitrary lower upper where
   quadratic :: Order
-> sh
-> Omni Unpacked Arbitrary lower upper Shape Small Small sh sh
quadratic = Order
-> sh
-> Omni Unpacked Arbitrary lower upper Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width.
(Cons pack property lower upper meas vert horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Order
-> Dimension meas height width
-> Omni pack property lower upper meas vert horiz height width
cons

instance (TriDiag diag) => Quadratic Packed diag Empty Filled where
   quadratic :: Order
-> sh -> Omni Packed diag Empty Filled Shape Small Small sh sh
quadratic = Order
-> sh -> Omni Packed diag Empty Filled Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width.
(Cons pack property lower upper meas vert horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Order
-> Dimension meas height width
-> Omni pack property lower upper meas vert horiz height width
cons

instance (TriDiag diag) => Quadratic Packed diag Filled Empty where
   quadratic :: Order
-> sh -> Omni Packed diag Filled Empty Shape Small Small sh sh
quadratic = Order
-> sh -> Omni Packed diag Filled Empty Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width.
(Cons pack property lower upper meas vert horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Order
-> Dimension meas height width
-> Omni pack property lower upper meas vert horiz height width
cons

instance Quadratic Packed Symmetric Filled Filled where
   quadratic :: Order
-> sh
-> Omni Packed Symmetric Filled Filled Shape Small Small sh sh
quadratic = Order
-> sh
-> Omni Packed Symmetric Filled Filled Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width.
(Cons pack property lower upper meas vert horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Order
-> Dimension meas height width
-> Omni pack property lower upper meas vert horiz height width
cons

instance
   (TBool.C neg, TBool.C zero, TBool.C pos) =>
      Quadratic Packed (Hermitian neg zero pos) Filled Filled where
   quadratic :: Order
-> sh
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     sh
     sh
quadratic = Order
-> sh
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     sh
     sh
forall pack property lower upper meas vert horiz height width.
(Cons pack property lower upper meas vert horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Order
-> Dimension meas height width
-> Omni pack property lower upper meas vert horiz height width
cons

instance
   (Unary.Natural sub, Unary.Natural super) =>
      Quadratic Packed Arbitrary (Bands sub) (Bands super) where
   quadratic :: Order
-> sh
-> Omni
     Packed Arbitrary (Bands sub) (Bands super) Shape Small Small sh sh
quadratic = Order
-> sh
-> Omni
     Packed Arbitrary (Bands sub) (Bands super) Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width.
(Cons pack property lower upper meas vert horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Order
-> Dimension meas height width
-> Omni pack property lower upper meas vert horiz height width
cons

instance
   (BandedTriangular sub super, BandedTriangular super sub) =>
      Quadratic Packed Unit (Bands sub) (Bands super) where
   quadratic :: Order
-> sh
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small sh sh
quadratic = Order
-> sh
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width.
(Cons pack property lower upper meas vert horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Order
-> Dimension meas height width
-> Omni pack property lower upper meas vert horiz height width
cons

instance
   (TBool.C neg, TBool.C zero, TBool.C pos, sub ~ super, Unary.Natural super) =>
      Quadratic Packed (Hermitian neg zero pos) (Bands sub) (Bands super) where
   quadratic :: Order
-> sh
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     sh
     sh
quadratic = Order
-> sh
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     sh
     sh
forall pack property lower upper meas vert horiz height width.
(Cons pack property lower upper meas vert horiz, C height, C width,
 MeasureTarget meas height ~ MeasureTarget meas width) =>
Order
-> Dimension meas height width
-> Omni pack property lower upper meas vert horiz height width
cons



class FromPlain pack property lower upper meas vert horiz height width where
   type Plain pack property lower upper meas vert horiz height width
   fromPlain ::
      Plain pack property lower upper meas vert horiz height width ->
      Omni pack property lower upper meas vert horiz height width

class
   FromPlain pack property lower upper meas vert horiz height width =>
      ToPlain pack property lower upper meas vert horiz height width where
   toPlain ::
      Omni pack property lower upper meas vert horiz height width ->
      Plain pack property lower upper meas vert horiz height width


instance
   FromPlain Unpacked Arbitrary Filled Filled meas vert horiz height width
      where
   type Plain Unpacked Arbitrary Filled Filled meas vert horiz height width =
            Layout.Full meas vert horiz height width
   fromPlain :: Plain Unpacked Arbitrary Filled Filled meas vert horiz height width
-> Omni
     Unpacked Arbitrary Filled Filled meas vert horiz height width
fromPlain = Plain Unpacked Arbitrary Filled Filled meas vert horiz height width
-> Omni
     Unpacked Arbitrary Filled Filled meas vert horiz height width
forall property lower upper meas vert horiz height width.
(Property property, Strip lower, Strip upper) =>
Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
Full

instance
   ToPlain Unpacked Arbitrary Filled Filled meas vert horiz height width
      where
   toPlain :: Omni Unpacked Arbitrary Filled Filled meas vert horiz height width
-> Plain
     Unpacked Arbitrary Filled Filled meas vert horiz height width
toPlain (Full Full meas vert horiz height width
shape) = Full meas vert horiz height width
Plain Unpacked Arbitrary Filled Filled meas vert horiz height width
shape


instance
   (Layout.Packing pack, TriDiag diag, height ~ width) =>
      FromPlain pack diag Empty Filled Shape Small Small height width where
   type Plain pack diag Empty Filled Shape Small Small height width =
            Layout.UpperTriangularP pack height
   fromPlain :: Plain pack diag Empty Filled Shape Small Small height width
-> Omni pack diag Empty Filled Shape Small Small height width
fromPlain = (Mosaic Packed NoMirror Upper height
 -> Omni Packed diag Empty Filled Shape Small Small height height)
-> Mosaic pack NoMirror Upper height
-> Omni pack diag Empty Filled Shape Small Small height height
forall pack property lower upper mirror uplo sh.
(Packing pack, Property property, Strip lower, Strip upper) =>
(Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed NoMirror Upper height
-> Omni Packed diag Empty Filled Shape Small Small height height
forall diag size.
TriDiag diag =>
UpperTriangular size
-> Omni Packed diag Empty Filled Shape Small Small size size
UpperTriangular

instance
   (Layout.Packing pack, TriDiag diag, height ~ width) =>
      ToPlain pack diag Empty Filled Shape Small Small height width where
   toPlain :: Omni pack diag Empty Filled Shape Small Small height width
-> Plain pack diag Empty Filled Shape Small Small height width
toPlain (UpperTriangular UpperTriangular height
shape) = UpperTriangular height
Plain pack diag Empty Filled Shape Small Small height width
shape
   toPlain (Full Full Shape Small Small height width
shape) = Square height -> Mosaic Unpacked NoMirror Upper height
forall mirror uplo size.
(Mirror mirror, UpLo uplo) =>
Square size -> Mosaic Unpacked mirror uplo size
Layout.mosaicFromSquare Square height
Full Shape Small Small height width
shape


instance
   (Layout.Packing pack, TriDiag diag, height ~ width) =>
      FromPlain pack diag Filled Empty Shape Small Small height width where
   type Plain pack diag Filled Empty Shape Small Small height width =
            Layout.LowerTriangularP pack height
   fromPlain :: Plain pack diag Filled Empty Shape Small Small height width
-> Omni pack diag Filled Empty Shape Small Small height width
fromPlain = (Mosaic Packed NoMirror Lower height
 -> Omni Packed diag Filled Empty Shape Small Small height height)
-> Mosaic pack NoMirror Lower height
-> Omni pack diag Filled Empty Shape Small Small height height
forall pack property lower upper mirror uplo sh.
(Packing pack, Property property, Strip lower, Strip upper) =>
(Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed NoMirror Lower height
-> Omni Packed diag Filled Empty Shape Small Small height height
forall diag size.
TriDiag diag =>
LowerTriangular size
-> Omni Packed diag Filled Empty Shape Small Small size size
LowerTriangular

instance
   (Layout.Packing pack, TriDiag diag, height ~ width) =>
      ToPlain pack diag Filled Empty Shape Small Small height width where
   toPlain :: Omni pack diag Filled Empty Shape Small Small height width
-> Plain pack diag Filled Empty Shape Small Small height width
toPlain (LowerTriangular LowerTriangular height
shape) = LowerTriangular height
Plain pack diag Filled Empty Shape Small Small height width
shape
   toPlain (Full Full Shape Small Small height width
shape) = Square height -> Mosaic Unpacked NoMirror Lower height
forall mirror uplo size.
(Mirror mirror, UpLo uplo) =>
Square size -> Mosaic Unpacked mirror uplo size
Layout.mosaicFromSquare Square height
Full Shape Small Small height width
shape


instance
   (Layout.Packing pack, height ~ width) =>
      FromPlain pack Symmetric Filled Filled Shape Small Small height width
         where
   type Plain pack Symmetric Filled Filled Shape Small Small height width =
            Layout.SymmetricP pack height
   fromPlain :: Plain pack Symmetric Filled Filled Shape Small Small height width
-> Omni pack Symmetric Filled Filled Shape Small Small height width
fromPlain = (Mosaic Packed SimpleMirror Upper height
 -> Omni
      Packed Symmetric Filled Filled Shape Small Small height height)
-> Mosaic pack SimpleMirror Upper height
-> Omni
     pack Symmetric Filled Filled Shape Small Small height height
forall pack property lower upper mirror uplo sh.
(Packing pack, Property property, Strip lower, Strip upper) =>
(Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed SimpleMirror Upper height
-> Omni
     Packed Symmetric Filled Filled Shape Small Small height height
forall size.
Symmetric size
-> Omni Packed Symmetric Filled Filled Shape Small Small size size
Symmetric

instance
   (Layout.Packing pack, height ~ width) =>
      ToPlain pack Symmetric Filled Filled Shape Small Small height width where
   toPlain :: Omni pack Symmetric Filled Filled Shape Small Small height width
-> Plain
     pack Symmetric Filled Filled Shape Small Small height width
toPlain (Symmetric Symmetric height
shape) = Symmetric height
Plain pack Symmetric Filled Filled Shape Small Small height width
shape
   toPlain (Full Full Shape Small Small height width
shape) = Square height -> Mosaic Unpacked SimpleMirror Upper height
forall mirror uplo size.
(Mirror mirror, UpLo uplo) =>
Square size -> Mosaic Unpacked mirror uplo size
Layout.mosaicFromSquare Square height
Full Shape Small Small height width
shape


instance
   (Layout.Packing pack,
    TBool.C neg, TBool.C zero, TBool.C pos, height ~ width) =>
      FromPlain pack (Hermitian neg zero pos) Filled Filled
            Shape Small Small height width
         where
   type Plain pack (Hermitian neg zero pos) Filled Filled
            Shape Small Small height width =
         Layout.HermitianP pack height
   fromPlain :: Plain
  pack
  (Hermitian neg zero pos)
  Filled
  Filled
  Shape
  Small
  Small
  height
  width
-> Omni
     pack
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     height
     width
fromPlain = (Mosaic Packed ConjugateMirror Upper height
 -> Omni
      Packed
      (Hermitian neg zero pos)
      Filled
      Filled
      Shape
      Small
      Small
      height
      height)
-> Mosaic pack ConjugateMirror Upper height
-> Omni
     pack
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     height
     height
forall pack property lower upper mirror uplo sh.
(Packing pack, Property property, Strip lower, Strip upper) =>
(Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed ConjugateMirror Upper height
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     height
     height
forall neg zero sub size.
(C neg, C zero, C sub) =>
Hermitian size
-> Omni
     Packed
     (Hermitian neg zero sub)
     Filled
     Filled
     Shape
     Small
     Small
     size
     size
Hermitian

instance
   (Layout.Packing pack,
    TBool.C neg, TBool.C zero, TBool.C pos, height ~ width) =>
      ToPlain pack (Hermitian neg zero pos) Filled Filled
            Shape Small Small height width
         where
   toPlain :: Omni
  pack
  (Hermitian neg zero pos)
  Filled
  Filled
  Shape
  Small
  Small
  height
  width
-> Plain
     pack
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     height
     width
toPlain (Hermitian Hermitian height
shape) = Hermitian height
Plain
  pack
  (Hermitian neg zero pos)
  Filled
  Filled
  Shape
  Small
  Small
  height
  width
shape
   toPlain (Full Full Shape Small Small height width
shape) = Square height -> Mosaic Unpacked ConjugateMirror Upper height
forall mirror uplo size.
(Mirror mirror, UpLo uplo) =>
Square size -> Mosaic Unpacked mirror uplo size
Layout.mosaicFromSquare Square height
Full Shape Small Small height width
shape

fromMosaic ::
   (Layout.Packing pack, Property property, Strip lower, Strip upper) =>
   (Layout.Mosaic Packed mirror uplo sh ->
    Omni Packed property lower upper Shape Small Small sh sh) ->
   Layout.Mosaic pack mirror uplo sh ->
   Omni pack property lower upper Shape Small Small sh sh
fromMosaic :: (Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed mirror uplo sh
-> Omni Packed property lower upper Shape Small Small sh sh
packedShape Mosaic pack mirror uplo sh
shape = (PackingSingleton pack
 -> Omni pack property lower upper Shape Small Small sh sh)
-> Omni pack property lower upper Shape Small Small sh sh
forall pack property lower upper meas vert horiz height width.
(Packing pack, Property property, Strip lower, Strip upper) =>
(PackingSingleton pack
 -> Omni pack property lower upper meas vert horiz height width)
-> Omni pack property lower upper meas vert horiz height width
withPacking ((PackingSingleton pack
  -> Omni pack property lower upper Shape Small Small sh sh)
 -> Omni pack property lower upper Shape Small Small sh sh)
-> (PackingSingleton pack
    -> Omni pack property lower upper Shape Small Small sh sh)
-> Omni pack property lower upper Shape Small Small sh sh
forall a b. (a -> b) -> a -> b
$ \PackingSingleton pack
pack ->
   case PackingSingleton pack
pack of
      PackingSingleton pack
Layout.Packed -> Mosaic Packed mirror uplo sh
-> Omni Packed property lower upper Shape Small Small sh sh
packedShape Mosaic pack mirror uplo sh
Mosaic Packed mirror uplo sh
shape
      PackingSingleton pack
Layout.Unpacked -> Full Shape Small Small sh sh
-> Omni Unpacked property lower upper Shape Small Small sh sh
forall property lower upper meas vert horiz height width.
(Property property, Strip lower, Strip upper) =>
Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
Full (Full Shape Small Small sh sh
 -> Omni Unpacked property lower upper Shape Small Small sh sh)
-> Full Shape Small Small sh sh
-> Omni Unpacked property lower upper Shape Small Small sh sh
forall a b. (a -> b) -> a -> b
$ Mosaic Unpacked mirror uplo sh -> Full Shape Small Small sh sh
forall mirror uplo size.
Mosaic Unpacked mirror uplo size -> Square size
Layout.squareFromMosaic Mosaic pack mirror uplo sh
Mosaic Unpacked mirror uplo sh
shape

withPacking ::
   (Layout.Packing pack, Property property, Strip lower, Strip upper) =>
   (Layout.PackingSingleton pack ->
    Omni pack property lower upper meas vert horiz height width) ->
   Omni pack property lower upper meas vert horiz height width
withPacking :: (PackingSingleton pack
 -> Omni pack property lower upper meas vert horiz height width)
-> Omni pack property lower upper meas vert horiz height width
withPacking PackingSingleton pack
-> Omni pack property lower upper meas vert horiz height width
f = PackingSingleton pack
-> Omni pack property lower upper meas vert horiz height width
f PackingSingleton pack
forall pack. Packing pack => PackingSingleton pack
Layout.autoPacking


instance
   (Unary.Natural sub, Unary.Natural super) =>
   FromPlain Packed Arbitrary
      (Bands sub) (Bands super) meas vert horiz height width
         where
   type Plain Packed Arbitrary
            (Bands sub) (Bands super) meas vert horiz height width =
         Layout.Banded sub super meas vert horiz height width
   fromPlain :: Plain
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
fromPlain = Plain
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
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
Banded

instance
   (Unary.Natural sub, Unary.Natural super) =>
   ToPlain Packed Arbitrary
      (Bands sub) (Bands super) meas vert horiz height width
         where
   toPlain :: Omni
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
-> Plain
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
toPlain (Banded Banded sub super meas vert horiz height width
shape) = Banded sub super meas vert horiz height width
Plain
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
shape


instance
   (BandedTriangular sub super, BandedTriangular super sub, height ~ width) =>
   FromPlain Packed Unit
      (Bands sub) (Bands super) Shape Small Small height width
         where
   type Plain Packed Unit
            (Bands sub) (Bands super) Shape Small Small height width =
            Layout.BandedSquare sub super height
   fromPlain :: Plain
  Packed
  Unit
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  height
  width
-> Omni
     Packed
     Unit
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     width
fromPlain = Plain
  Packed
  Unit
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  height
  width
-> Omni
     Packed
     Unit
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     width
forall sub super size.
(BandedTriangular sub super, BandedTriangular super sub) =>
BandedSquare sub super size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
UnitBandedTriangular

instance
   (BandedTriangular sub super, BandedTriangular super sub, height ~ width) =>
   ToPlain Packed Unit (Bands sub) (Bands super) Shape Small Small height width
      where
   toPlain :: Omni
  Packed
  Unit
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  height
  width
-> Plain
     Packed
     Unit
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     width
toPlain (UnitBandedTriangular BandedSquare sub super height
shape) = BandedSquare sub super height
Plain
  Packed
  Unit
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  height
  width
shape


instance
   (Unary.Natural sub, sub ~ super, height ~ width,
    TBool.C neg, TBool.C zero, TBool.C pos) =>
      FromPlain Packed (Hermitian neg zero pos) (Bands sub) (Bands super)
         Shape Small Small height width where
   type
      Plain
         Packed (Hermitian neg zero pos) (Bands sub) (Bands super)
         Shape Small Small height width =
      Layout.BandedHermitian sub height
   fromPlain :: Plain
  Packed
  (Hermitian neg zero pos)
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  height
  width
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     width
fromPlain = Plain
  Packed
  (Hermitian neg zero pos)
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  height
  width
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     width
forall neg zero pos offDiag size.
(C neg, C zero, C pos, Natural offDiag) =>
BandedHermitian offDiag size
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     size
     size
BandedHermitian

instance
   (Unary.Natural sub, sub ~ super, height ~ width,
    TBool.C neg, TBool.C zero, TBool.C pos) =>
      ToPlain Packed (Hermitian neg zero pos) (Bands sub) (Bands super)
         Shape Small Small height width where
   toPlain :: Omni
  Packed
  (Hermitian neg zero pos)
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  height
  width
-> Plain
     Packed
     (Hermitian neg zero pos)
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     width
toPlain (BandedHermitian BandedHermitian offDiag height
shape) = BandedHermitian offDiag height
Plain
  Packed
  (Hermitian neg zero pos)
  (Bands sub)
  (Bands super)
  Shape
  Small
  Small
  height
  width
shape


fromFull ::
   (Property property, Strip lower, Strip upper) =>
   Layout.Full meas vert horiz height width ->
   Omni Unpacked property lower upper meas vert horiz height width
fromFull :: Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
fromFull = Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
forall property lower upper meas vert horiz height width.
(Property property, Strip lower, Strip upper) =>
Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
Full

toFull ::
   (Property property, Strip lower, Strip upper) =>
   Omni Unpacked property lower upper meas vert horiz height width ->
   Layout.Full meas vert horiz height width
toFull :: Omni Unpacked property lower upper meas vert horiz height width
-> Full meas vert horiz height width
toFull (Full Full meas vert horiz height width
shape) = Full meas vert horiz height width
shape


newtype FromDiagonal size diag =
   FromDiagonal {
      FromDiagonal size diag
-> BandedSquare U0 U0 size
-> Omni Packed diag Empty Empty Shape Small Small size size
getFromDiagonal ::
         Layout.BandedSquare U0 U0 size ->
         Omni Packed diag Empty Empty Shape Small Small size size
   }

uncheckedDiagonal ::
   (Layout.Packing pack, TriDiag diag) =>
   Layout.Order -> size ->
   Omni pack diag Empty Empty Shape Small Small size size
uncheckedDiagonal :: Order
-> size -> Omni pack diag Empty Empty Shape Small Small size size
uncheckedDiagonal Order
order_ size
size = (PackingSingleton pack
 -> Omni pack diag Empty Empty Shape Small Small size size)
-> Omni pack diag Empty Empty Shape Small Small size size
forall pack property lower upper meas vert horiz height width.
(Packing pack, Property property, Strip lower, Strip upper) =>
(PackingSingleton pack
 -> Omni pack property lower upper meas vert horiz height width)
-> Omni pack property lower upper meas vert horiz height width
withPacking ((PackingSingleton pack
  -> Omni pack diag Empty Empty Shape Small Small size size)
 -> Omni pack diag Empty Empty Shape Small Small size size)
-> (PackingSingleton pack
    -> Omni pack diag Empty Empty Shape Small Small size size)
-> Omni pack diag Empty Empty Shape Small Small size size
forall a b. (a -> b) -> a -> b
$ \PackingSingleton pack
pack ->
   case PackingSingleton pack
pack of
      PackingSingleton pack
Layout.Packed ->
         FromDiagonal size diag
-> BandedSquare U0 U0 size
-> Omni Packed diag Empty Empty Shape Small Small size size
forall size diag.
FromDiagonal size diag
-> BandedSquare U0 U0 size
-> Omni Packed diag Empty Empty Shape Small Small size size
getFromDiagonal
            (FromDiagonal size Unit
-> FromDiagonal size Arbitrary -> FromDiagonal size diag
forall diag (f :: * -> *).
TriDiag diag =>
f Unit -> f Arbitrary -> f diag
switchTriDiag
               ((BandedSquare U0 U0 size
 -> Omni Packed Unit Empty Empty Shape Small Small size size)
-> FromDiagonal size Unit
forall size diag.
(BandedSquare U0 U0 size
 -> Omni Packed diag Empty Empty Shape Small Small size size)
-> FromDiagonal size diag
FromDiagonal BandedSquare U0 U0 size
-> Omni Packed Unit Empty Empty Shape Small Small size size
forall sub super size.
(BandedTriangular sub super, BandedTriangular super sub) =>
BandedSquare sub super size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
UnitBandedTriangular)
               ((BandedSquare U0 U0 size
 -> Omni Packed Arbitrary Empty Empty Shape Small Small size size)
-> FromDiagonal size Arbitrary
forall size diag.
(BandedSquare U0 U0 size
 -> Omni Packed diag Empty Empty Shape Small Small size size)
-> FromDiagonal size diag
FromDiagonal BandedSquare U0 U0 size
-> Omni Packed Arbitrary Empty Empty Shape Small Small size size
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
Banded))
            ((UnaryProxy U0, UnaryProxy U0)
-> Order
-> Extent Shape Small Small size size
-> BandedSquare U0 U0 size
forall sub super meas vert horiz height width.
(UnaryProxy sub, UnaryProxy super)
-> Order
-> Extent meas vert horiz height width
-> Banded sub super meas vert horiz height width
Layout.Banded (UnaryProxy U0
forall a. Proxy a
Proxy,UnaryProxy U0
forall a. Proxy a
Proxy) Order
order_ (size -> Extent Shape Small Small size size
forall sh. sh -> Square sh
Extent.square size
size))
      PackingSingleton pack
Layout.Unpacked ->
         Full Shape Small Small size size
-> Omni Unpacked diag Empty Empty Shape Small Small size size
forall property lower upper meas vert horiz height width.
(Property property, Strip lower, Strip upper) =>
Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
Full (Order
-> Extent Shape Small Small size size
-> Full Shape Small Small size size
forall meas vert horiz height width.
Order
-> Extent meas vert horiz height width
-> Full meas vert horiz height width
Layout.Full Order
order_ (size -> Extent Shape Small Small size size
forall sh. sh -> Square sh
Extent.square size
size))

_fromDiagonal ::
   (TriDiag diag) =>
   Layout.Diagonal size ->
   Omni Packed diag Empty Empty Shape Small Small size size
_fromDiagonal :: Diagonal size
-> Omni Packed diag Empty Empty Shape Small Small size size
_fromDiagonal (Layout.Banded (UnaryProxy U0, UnaryProxy U0)
_offDiag Order
order_ Extent Shape Small Small size size
size) =
   Order
-> size -> Omni Packed diag Empty Empty Shape Small Small size size
forall pack diag size.
(Packing pack, TriDiag diag) =>
Order
-> size -> Omni pack diag Empty Empty Shape Small Small size size
uncheckedDiagonal Order
order_ (Extent Shape Small Small size size -> size
forall shape. Square shape -> shape
Extent.squareSize Extent Shape Small Small size size
size)

_toDiagonal ::
   (TriDiag diag) =>
   Omni Packed diag Empty Empty Shape Small Small size size ->
   Layout.Diagonal size
_toDiagonal :: Omni Packed diag Empty Empty Shape Small Small size size
-> Diagonal size
_toDiagonal Omni Packed diag Empty Empty Shape Small Small size size
omni =
   case Omni Packed diag Empty Empty Shape Small Small size size
omni of
      Banded Banded sub super Shape Small Small size size
sh -> Banded sub super Shape Small Small size size
Diagonal size
sh
      UnitBandedTriangular BandedSquare sub super size
sh -> BandedSquare sub super size
Diagonal size
sh
      BandedHermitian (Layout.BandedHermitian UnaryProxy offDiag
k Order
order_ size
size) ->
         (UnaryProxy offDiag, UnaryProxy offDiag)
-> Order
-> Extent Shape Small Small size size
-> Banded offDiag offDiag Shape Small Small size size
forall sub super meas vert horiz height width.
(UnaryProxy sub, UnaryProxy super)
-> Order
-> Extent meas vert horiz height width
-> Banded sub super meas vert horiz height width
Layout.Banded (UnaryProxy offDiag
k,UnaryProxy offDiag
k) Order
order_ (size -> Extent Shape Small Small size size
forall sh. sh -> Square sh
Extent.square size
size)


_fromUpperTriangular ::
   (Layout.Packing pack) =>
   (TriDiag diag) =>
   Layout.UpperTriangularP pack size ->
   Omni pack diag Empty Filled Shape Small Small size size
_fromUpperTriangular :: UpperTriangularP pack size
-> Omni pack diag Empty Filled Shape Small Small size size
_fromUpperTriangular = (Mosaic Packed NoMirror Upper size
 -> Omni Packed diag Empty Filled Shape Small Small size size)
-> UpperTriangularP pack size
-> Omni pack diag Empty Filled Shape Small Small size size
forall pack property lower upper mirror uplo sh.
(Packing pack, Property property, Strip lower, Strip upper) =>
(Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed NoMirror Upper size
-> Omni Packed diag Empty Filled Shape Small Small size size
forall diag size.
TriDiag diag =>
UpperTriangular size
-> Omni Packed diag Empty Filled Shape Small Small size size
UpperTriangular

_toUpperTriangular ::
   (TriDiag diag) =>
   Omni pack diag Empty Filled Shape Small Small size size ->
   Layout.UpperTriangularP pack size
_toUpperTriangular :: Omni pack diag Empty Filled Shape Small Small size size
-> UpperTriangularP pack size
_toUpperTriangular (UpperTriangular UpperTriangular size
shape) = UpperTriangularP pack size
UpperTriangular size
shape
_toUpperTriangular (Full Full Shape Small Small size size
shape) = Full Shape Small Small size size
-> Mosaic Unpacked NoMirror Upper size
forall mirror uplo size.
(Mirror mirror, UpLo uplo) =>
Square size -> Mosaic Unpacked mirror uplo size
Layout.mosaicFromSquare Full Shape Small Small size size
shape


_fromLowerTriangular ::
   (Layout.Packing pack) =>
   (TriDiag diag) =>
   Layout.LowerTriangularP pack size ->
   Omni pack diag Filled Empty Shape Small Small size size
_fromLowerTriangular :: LowerTriangularP pack size
-> Omni pack diag Filled Empty Shape Small Small size size
_fromLowerTriangular = (Mosaic Packed NoMirror Lower size
 -> Omni Packed diag Filled Empty Shape Small Small size size)
-> LowerTriangularP pack size
-> Omni pack diag Filled Empty Shape Small Small size size
forall pack property lower upper mirror uplo sh.
(Packing pack, Property property, Strip lower, Strip upper) =>
(Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed NoMirror Lower size
-> Omni Packed diag Filled Empty Shape Small Small size size
forall diag size.
TriDiag diag =>
LowerTriangular size
-> Omni Packed diag Filled Empty Shape Small Small size size
LowerTriangular

_toLowerTriangular ::
   (TriDiag diag) =>
   Omni pack diag Filled Empty Shape Small Small size size ->
   Layout.LowerTriangularP pack size
_toLowerTriangular :: Omni pack diag Filled Empty Shape Small Small size size
-> LowerTriangularP pack size
_toLowerTriangular (LowerTriangular LowerTriangular size
shape) = LowerTriangularP pack size
LowerTriangular size
shape
_toLowerTriangular (Full Full Shape Small Small size size
shape) = Full Shape Small Small size size
-> Mosaic Unpacked NoMirror Lower size
forall mirror uplo size.
(Mirror mirror, UpLo uplo) =>
Square size -> Mosaic Unpacked mirror uplo size
Layout.mosaicFromSquare Full Shape Small Small size size
shape


_fromSymmetric ::
   (Layout.Packing pack) =>
   Layout.SymmetricP pack size ->
   Omni pack Symmetric Filled Filled Shape Small Small size size
_fromSymmetric :: SymmetricP pack size
-> Omni pack Symmetric Filled Filled Shape Small Small size size
_fromSymmetric = (Mosaic Packed SimpleMirror Upper size
 -> Omni Packed Symmetric Filled Filled Shape Small Small size size)
-> SymmetricP pack size
-> Omni pack Symmetric Filled Filled Shape Small Small size size
forall pack property lower upper mirror uplo sh.
(Packing pack, Property property, Strip lower, Strip upper) =>
(Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed SimpleMirror Upper size
-> Omni Packed Symmetric Filled Filled Shape Small Small size size
forall size.
Symmetric size
-> Omni Packed Symmetric Filled Filled Shape Small Small size size
Symmetric

_toSymmetric ::
   Omni pack Symmetric Filled Filled Shape Small Small size size ->
   Layout.SymmetricP pack size
_toSymmetric :: Omni pack Symmetric Filled Filled Shape Small Small size size
-> SymmetricP pack size
_toSymmetric (Symmetric Symmetric size
shape) = SymmetricP pack size
Symmetric size
shape
_toSymmetric (Full Full Shape Small Small size size
shape) = Full Shape Small Small size size
-> Mosaic Unpacked SimpleMirror Upper size
forall mirror uplo size.
(Mirror mirror, UpLo uplo) =>
Square size -> Mosaic Unpacked mirror uplo size
Layout.mosaicFromSquare Full Shape Small Small size size
shape


_fromHermitian ::
   (Layout.Packing pack) =>
   (TBool.C neg, TBool.C zero, TBool.C pos) =>
   Layout.HermitianP pack size ->
   Omni pack (Hermitian neg zero pos) Filled Filled Shape Small Small size size
_fromHermitian :: HermitianP pack size
-> Omni
     pack
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     size
     size
_fromHermitian = (Mosaic Packed ConjugateMirror Upper size
 -> Omni
      Packed
      (Hermitian neg zero pos)
      Filled
      Filled
      Shape
      Small
      Small
      size
      size)
-> HermitianP pack size
-> Omni
     pack
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     size
     size
forall pack property lower upper mirror uplo sh.
(Packing pack, Property property, Strip lower, Strip upper) =>
(Mosaic Packed mirror uplo sh
 -> Omni Packed property lower upper Shape Small Small sh sh)
-> Mosaic pack mirror uplo sh
-> Omni pack property lower upper Shape Small Small sh sh
fromMosaic Mosaic Packed ConjugateMirror Upper size
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     size
     size
forall neg zero sub size.
(C neg, C zero, C sub) =>
Hermitian size
-> Omni
     Packed
     (Hermitian neg zero sub)
     Filled
     Filled
     Shape
     Small
     Small
     size
     size
Hermitian

_toHermitian ::
   (TBool.C neg, TBool.C zero, TBool.C pos) =>
   Omni pack (Hermitian neg zero pos)
      Filled Filled Shape Small Small size size ->
   Layout.HermitianP pack size
_toHermitian :: Omni
  pack
  (Hermitian neg zero pos)
  Filled
  Filled
  Shape
  Small
  Small
  size
  size
-> HermitianP pack size
_toHermitian (Hermitian Hermitian size
shape) = HermitianP pack size
Hermitian size
shape
_toHermitian (Full Full Shape Small Small size size
shape) = Full Shape Small Small size size
-> Mosaic Unpacked ConjugateMirror Upper size
forall mirror uplo size.
(Mirror mirror, UpLo uplo) =>
Square size -> Mosaic Unpacked mirror uplo size
Layout.mosaicFromSquare Full Shape Small Small size size
shape


_fromBanded ::
   (Unary.Natural sub, Unary.Natural super) =>
   Layout.Banded sub super meas vert horiz height width ->
   Omni Packed Arbitrary (Bands sub) (Bands super) meas vert horiz height width
_fromBanded :: Banded sub super meas vert horiz height width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
_fromBanded = Banded sub super meas vert horiz height width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
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
Banded

toBanded ::
   (Unary.Natural sub, Unary.Natural super) =>
   Omni Packed Arbitrary
      (Bands sub) (Bands super) meas vert horiz height width ->
   Layout.Banded sub super meas vert horiz height width
toBanded :: Omni
  Packed
  Arbitrary
  (Bands sub)
  (Bands super)
  meas
  vert
  horiz
  height
  width
-> Banded sub super meas vert horiz height width
toBanded (Banded Banded sub super meas vert horiz height width
shape) = Banded sub super meas vert horiz height width
Banded sub super meas vert horiz height width
shape


_fromUnitBandedTriangular ::
   (BandedTriangular sub super, BandedTriangular super sub) =>
   Layout.Banded sub super Shape Small Small size size ->
   Omni Packed Unit (Bands sub) (Bands super) Shape Small Small size size
_fromUnitBandedTriangular :: Banded sub super Shape Small Small size size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
_fromUnitBandedTriangular = Banded sub super Shape Small Small size size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
forall sub super size.
(BandedTriangular sub super, BandedTriangular super sub) =>
BandedSquare sub super size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
UnitBandedTriangular

_toUnitBandedTriangular ::
   (BandedTriangular sub super, BandedTriangular super sub) =>
   Omni Packed Unit (Bands sub) (Bands super) Shape Small Small size size ->
   Layout.Banded sub super Shape Small Small size size
_toUnitBandedTriangular :: Omni
  Packed Unit (Bands sub) (Bands super) Shape Small Small size size
-> Banded sub super Shape Small Small size size
_toUnitBandedTriangular (UnitBandedTriangular BandedSquare sub super size
shape) = Banded sub super Shape Small Small size size
BandedSquare sub super size
shape


_fromBandedHermitian ::
   (TBool.C neg, TBool.C zero, TBool.C pos, Unary.Natural offDiag) =>
   Layout.BandedHermitian offDiag size ->
   Omni Packed (Hermitian neg zero pos)
      (Bands offDiag) (Bands offDiag) Shape Small Small size size
_fromBandedHermitian :: BandedHermitian offDiag size
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     size
     size
_fromBandedHermitian = BandedHermitian offDiag size
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     size
     size
forall neg zero pos offDiag size.
(C neg, C zero, C pos, Natural offDiag) =>
BandedHermitian offDiag size
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     size
     size
BandedHermitian

toBandedHermitian ::
   (TBool.C neg, TBool.C zero, TBool.C pos, Unary.Natural offDiag) =>
   Omni Packed (Hermitian neg zero pos)
      (Bands offDiag) (Bands offDiag) Shape Small Small size size ->
   Layout.BandedHermitian offDiag size
toBandedHermitian :: Omni
  Packed
  (Hermitian neg zero pos)
  (Bands offDiag)
  (Bands offDiag)
  Shape
  Small
  Small
  size
  size
-> BandedHermitian offDiag size
toBandedHermitian (BandedHermitian BandedHermitian offDiag size
shape) = BandedHermitian offDiag size
BandedHermitian offDiag size
shape



height ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Omni pack property lower upper meas vert horiz height width -> height
height :: Omni pack property lower upper meas vert horiz height width
-> height
height Omni pack property lower upper meas vert horiz height width
omni =
   case Omni pack property lower upper meas vert horiz height width
omni of
      Full Full meas vert horiz height width
shape -> Full meas vert horiz height width -> height
forall meas vert horiz height width.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width -> height
Layout.fullHeight Full meas vert horiz height width
shape
      UpperTriangular UpperTriangular height
shape -> UpperTriangular height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize UpperTriangular height
shape
      LowerTriangular LowerTriangular height
shape -> LowerTriangular height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize LowerTriangular height
shape
      Symmetric Symmetric height
shape -> Symmetric height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize Symmetric height
shape
      Hermitian Hermitian height
shape -> Hermitian height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize Hermitian height
shape
      Banded Banded sub super meas vert horiz height width
shape -> Banded sub super meas vert horiz height width -> height
forall meas vert horiz sub super height width.
(Measure meas, C vert, C horiz) =>
Banded sub super meas vert horiz height width -> height
Layout.bandedHeight Banded sub super meas vert horiz height width
shape
      UnitBandedTriangular BandedSquare sub super height
shape -> BandedSquare sub super height -> height
forall meas vert horiz sub super height width.
(Measure meas, C vert, C horiz) =>
Banded sub super meas vert horiz height width -> height
Layout.bandedHeight BandedSquare sub super height
shape
      BandedHermitian BandedHermitian offDiag height
shape -> BandedHermitian offDiag height -> height
forall off size. BandedHermitian off size -> size
Layout.bandedHermitianSize BandedHermitian offDiag height
shape

width ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Omni pack property lower upper meas vert horiz height width -> width
width :: Omni pack property lower upper meas vert horiz height width
-> width
width Omni pack property lower upper meas vert horiz height width
omni =
   case Omni pack property lower upper meas vert horiz height width
omni of
      Full Full meas vert horiz height width
shape -> Full meas vert horiz height width -> width
forall meas vert horiz height width.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width -> width
Layout.fullWidth Full meas vert horiz height width
shape
      UpperTriangular UpperTriangular height
shape -> UpperTriangular height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize UpperTriangular height
shape
      LowerTriangular LowerTriangular height
shape -> LowerTriangular height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize LowerTriangular height
shape
      Symmetric Symmetric height
shape -> Symmetric height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize Symmetric height
shape
      Hermitian Hermitian height
shape -> Hermitian height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize Hermitian height
shape
      Banded Banded sub super meas vert horiz height width
shape -> Banded sub super meas vert horiz height width -> width
forall meas vert horiz sub super height width.
(Measure meas, C vert, C horiz) =>
Banded sub super meas vert horiz height width -> width
Layout.bandedWidth Banded sub super meas vert horiz height width
shape
      UnitBandedTriangular BandedSquare sub super height
shape -> BandedSquare sub super height -> height
forall meas vert horiz sub super height width.
(Measure meas, C vert, C horiz) =>
Banded sub super meas vert horiz height width -> width
Layout.bandedWidth BandedSquare sub super height
shape
      BandedHermitian BandedHermitian offDiag height
shape -> BandedHermitian offDiag height -> height
forall off size. BandedHermitian off size -> size
Layout.bandedHermitianSize BandedHermitian offDiag height
shape

squareSize :: Omni pack property lower upper Shape Small Small sh sh -> sh
squareSize :: Omni pack property lower upper Shape Small Small sh sh -> sh
squareSize = Omni pack property lower upper Shape Small Small sh sh -> sh
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
height

extent ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Omni pack property lower upper meas vert horiz height width ->
   Extent meas vert horiz height width
extent :: Omni pack property lower upper meas vert horiz height width
-> Extent meas vert horiz height width
extent Omni pack property lower upper meas vert horiz height width
omni =
   case Omni pack property lower upper meas vert horiz height width
omni of
      Full Full meas vert horiz height width
shape -> Full meas vert horiz height width
-> Extent meas vert horiz height width
forall meas vert horiz height width.
Full meas vert horiz height width
-> Extent meas vert horiz height width
Layout.fullExtent Full meas vert horiz height width
shape
      UpperTriangular UpperTriangular height
shape -> height -> Square height
forall sh. sh -> Square sh
Extent.square (height -> Square height) -> height -> Square height
forall a b. (a -> b) -> a -> b
$ UpperTriangular height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize UpperTriangular height
shape
      LowerTriangular LowerTriangular height
shape -> height -> Square height
forall sh. sh -> Square sh
Extent.square (height -> Square height) -> height -> Square height
forall a b. (a -> b) -> a -> b
$ LowerTriangular height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize LowerTriangular height
shape
      Symmetric Symmetric height
shape -> height -> Square height
forall sh. sh -> Square sh
Extent.square (height -> Square height) -> height -> Square height
forall a b. (a -> b) -> a -> b
$ Symmetric height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize Symmetric height
shape
      Hermitian Hermitian height
shape -> height -> Square height
forall sh. sh -> Square sh
Extent.square (height -> Square height) -> height -> Square height
forall a b. (a -> b) -> a -> b
$ Hermitian height -> height
forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize Hermitian height
shape
      Banded Banded sub super meas vert horiz height width
shape -> Banded sub super meas vert horiz height width
-> Extent meas vert horiz height width
forall sub super meas vert horiz height width.
Banded sub super meas vert horiz height width
-> Extent meas vert horiz height width
Layout.bandedExtent Banded sub super meas vert horiz height width
shape
      UnitBandedTriangular BandedSquare sub super height
shape -> BandedSquare sub super height -> Square height
forall sub super meas vert horiz height width.
Banded sub super meas vert horiz height width
-> Extent meas vert horiz height width
Layout.bandedExtent BandedSquare sub super height
shape
      BandedHermitian BandedHermitian offDiag height
shape ->
         height -> Square height
forall sh. sh -> Square sh
Extent.square (height -> Square height) -> height -> Square height
forall a b. (a -> b) -> a -> b
$ BandedHermitian offDiag height -> height
forall off size. BandedHermitian off size -> size
Layout.bandedHermitianSize BandedHermitian offDiag height
shape


mapExtentUnchecked ::
   (Extent Size vertA horizA heightA widthA ->
    Extent Size vertB horizB heightB widthB) ->
   Omni pack property lower upper Size vertA horizA heightA widthA ->
   Omni pack property lower upper Size vertB horizB heightB widthB
mapExtentUnchecked :: (Extent Size vertA horizA heightA widthA
 -> Extent Size vertB horizB heightB widthB)
-> Omni pack property lower upper Size vertA horizA heightA widthA
-> Omni pack property lower upper Size vertB horizB heightB widthB
mapExtentUnchecked Extent Size vertA horizA heightA widthA
-> Extent Size vertB horizB heightB widthB
f Omni pack property lower upper Size vertA horizA heightA widthA
omni =
   case Omni pack property lower upper Size vertA horizA heightA widthA
omni of
      Full shape :: Full Size vertA horizA heightA widthA
shape@Layout.Full{fullExtent :: forall meas vert horiz height width.
Full meas vert horiz height width
-> Extent meas vert horiz height width
Layout.fullExtent = Extent Size vertA horizA heightA widthA
ext} ->
         Full Size vertB horizB heightB widthB
-> Omni
     Unpacked property lower upper Size vertB horizB heightB widthB
forall property lower upper meas vert horiz height width.
(Property property, Strip lower, Strip upper) =>
Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
Full Full Size vertA horizA heightA widthA
shape{fullExtent :: Extent Size vertB horizB heightB widthB
Layout.fullExtent = Extent Size vertA horizA heightA widthA
-> Extent Size vertB horizB heightB widthB
f Extent Size vertA horizA heightA widthA
ext}
      Banded shape :: Banded sub super Size vertA horizA heightA widthA
shape@Layout.Banded{bandedExtent :: forall sub super meas vert horiz height width.
Banded sub super meas vert horiz height width
-> Extent meas vert horiz height width
Layout.bandedExtent = Extent Size vertA horizA heightA widthA
ext} ->
         Banded sub super Size vertB horizB heightB widthB
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     Size
     vertB
     horizB
     heightB
     widthB
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
Banded Banded sub super Size vertA horizA heightA widthA
shape{bandedExtent :: Extent Size vertB horizB heightB widthB
Layout.bandedExtent = Extent Size vertA horizA heightA widthA
-> Extent Size vertB horizB heightB widthB
f Extent Size vertA horizA heightA widthA
ext}

mapHeight ::
   (Shape.C heightA, Shape.C heightB, Extent.C vert, Extent.C horiz) =>
   (heightA -> heightB) ->
   Omni pack property lower upper Size vert horiz heightA width ->
   Omni pack property lower upper Size vert horiz heightB width
mapHeight :: (heightA -> heightB)
-> Omni pack property lower upper Size vert horiz heightA width
-> Omni pack property lower upper Size vert horiz heightB width
mapHeight heightA -> heightB
f =
   (Extent Size vert horiz heightA width
 -> Extent Size vert horiz heightB width)
-> Omni pack property lower upper Size vert horiz heightA width
-> Omni pack property lower upper Size vert horiz heightB width
forall vertA horizA heightA widthA vertB horizB heightB widthB pack
       property lower upper.
(Extent Size vertA horizA heightA widthA
 -> Extent Size vertB horizB heightB widthB)
-> Omni pack property lower upper Size vertA horizA heightA widthA
-> Omni pack property lower upper Size vertB horizB heightB widthB
mapExtentUnchecked ((Extent Size vert horiz heightA width
  -> Extent Size vert horiz heightB width)
 -> Omni pack property lower upper Size vert horiz heightA width
 -> Omni pack property lower upper Size vert horiz heightB width)
-> (Extent Size vert horiz heightA width
    -> Extent Size vert horiz heightB width)
-> Omni pack property lower upper Size vert horiz heightA width
-> Omni pack property lower upper Size vert horiz heightB width
forall a b. (a -> b) -> a -> b
$ (heightA -> heightB)
-> Extent Size vert horiz heightA width
-> Extent Size vert horiz heightB width
forall vert horiz heightA heightB width.
(C vert, C horiz) =>
(heightA -> heightB)
-> Extent Size vert horiz heightA width
-> Extent Size vert horiz heightB width
Extent.mapHeight ((heightA -> heightB)
 -> Extent Size vert horiz heightA width
 -> Extent Size vert horiz heightB width)
-> (heightA -> heightB)
-> Extent Size vert horiz heightA width
-> Extent Size vert horiz heightB width
forall a b. (a -> b) -> a -> b
$ String -> (heightA -> heightB) -> heightA -> heightB
forall sha shb.
(C sha, C shb) =>
String -> (sha -> shb) -> sha -> shb
Layout.mapChecked String
"mapHeight" heightA -> heightB
f

mapWidth ::
   (Shape.C widthA, Shape.C widthB, Extent.C vert, Extent.C horiz) =>
   (widthA -> widthB) ->
   Omni pack property lower upper Size vert horiz height widthA ->
   Omni pack property lower upper Size vert horiz height widthB
mapWidth :: (widthA -> widthB)
-> Omni pack property lower upper Size vert horiz height widthA
-> Omni pack property lower upper Size vert horiz height widthB
mapWidth widthA -> widthB
f =
   (Extent Size vert horiz height widthA
 -> Extent Size vert horiz height widthB)
-> Omni pack property lower upper Size vert horiz height widthA
-> Omni pack property lower upper Size vert horiz height widthB
forall vertA horizA heightA widthA vertB horizB heightB widthB pack
       property lower upper.
(Extent Size vertA horizA heightA widthA
 -> Extent Size vertB horizB heightB widthB)
-> Omni pack property lower upper Size vertA horizA heightA widthA
-> Omni pack property lower upper Size vertB horizB heightB widthB
mapExtentUnchecked ((Extent Size vert horiz height widthA
  -> Extent Size vert horiz height widthB)
 -> Omni pack property lower upper Size vert horiz height widthA
 -> Omni pack property lower upper Size vert horiz height widthB)
-> (Extent Size vert horiz height widthA
    -> Extent Size vert horiz height widthB)
-> Omni pack property lower upper Size vert horiz height widthA
-> Omni pack property lower upper Size vert horiz height widthB
forall a b. (a -> b) -> a -> b
$ (widthA -> widthB)
-> Extent Size vert horiz height widthA
-> Extent Size vert horiz height widthB
forall vert horiz widthA widthB height.
(C vert, C horiz) =>
(widthA -> widthB)
-> Extent Size vert horiz height widthA
-> Extent Size vert horiz height widthB
Extent.mapWidth ((widthA -> widthB)
 -> Extent Size vert horiz height widthA
 -> Extent Size vert horiz height widthB)
-> (widthA -> widthB)
-> Extent Size vert horiz height widthA
-> Extent Size vert horiz height widthB
forall a b. (a -> b) -> a -> b
$ String -> (widthA -> widthB) -> widthA -> widthB
forall sha shb.
(C sha, C shb) =>
String -> (sha -> shb) -> sha -> shb
Layout.mapChecked String
"mapWidth" widthA -> widthB
f

mapSquareSize ::
   (Shape.C shA, Shape.C shB) =>
   (shA -> shB) ->
   Omni pack property lower upper Shape Small Small shA shA ->
   Omni pack property lower upper Shape Small Small shB shB
mapSquareSize :: (shA -> shB)
-> Omni pack property lower upper Shape Small Small shA shA
-> Omni pack property lower upper Shape Small Small shB shB
mapSquareSize shA -> shB
f Omni pack property lower upper Shape Small Small shA shA
omni =
   let cf :: shA -> shB
cf = String -> (shA -> shB) -> shA -> shB
forall sha shb.
(C sha, C shb) =>
String -> (sha -> shb) -> sha -> shb
Layout.mapChecked String
"mapSquareSize" shA -> shB
f in
   case Omni pack property lower upper Shape Small Small shA shA
omni of
      Full shape :: Full Shape Small Small shA shA
shape@Layout.Full{fullExtent :: forall meas vert horiz height width.
Full meas vert horiz height width
-> Extent meas vert horiz height width
Layout.fullExtent = Extent Shape Small Small shA shA
ext} ->
         Full Shape Small Small shB shB
-> Omni Unpacked property lower upper Shape Small Small shB shB
forall property lower upper meas vert horiz height width.
(Property property, Strip lower, Strip upper) =>
Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
Full Full Shape Small Small shA shA
shape{fullExtent :: Extent Shape Small Small shB shB
Layout.fullExtent = (shA -> shB)
-> Extent Shape Small Small shA shA
-> Extent Shape Small Small shB shB
forall shA shB. (shA -> shB) -> Square shA -> Square shB
Extent.mapSquareSize shA -> shB
cf Extent Shape Small Small shA shA
ext}
      UpperTriangular shape :: UpperTriangular shA
shape@Layout.Mosaic{mosaicSize :: forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize = shA
size} ->
         UpperTriangular shB
-> Omni Packed property Empty Filled Shape Small Small shB shB
forall diag size.
TriDiag diag =>
UpperTriangular size
-> Omni Packed diag Empty Filled Shape Small Small size size
UpperTriangular UpperTriangular shA
shape{mosaicSize :: shB
Layout.mosaicSize = shA -> shB
cf shA
size}
      LowerTriangular shape :: LowerTriangular shA
shape@Layout.Mosaic{mosaicSize :: forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize = shA
size} ->
         LowerTriangular shB
-> Omni Packed property Filled Empty Shape Small Small shB shB
forall diag size.
TriDiag diag =>
LowerTriangular size
-> Omni Packed diag Filled Empty Shape Small Small size size
LowerTriangular LowerTriangular shA
shape{mosaicSize :: shB
Layout.mosaicSize = shA -> shB
cf shA
size}
      Symmetric shape :: Symmetric shA
shape@Layout.Mosaic{mosaicSize :: forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize = shA
size} ->
         Symmetric shB
-> Omni Packed Symmetric Filled Filled Shape Small Small shB shB
forall size.
Symmetric size
-> Omni Packed Symmetric Filled Filled Shape Small Small size size
Symmetric Symmetric shA
shape{mosaicSize :: shB
Layout.mosaicSize = shA -> shB
cf shA
size}
      Hermitian shape :: Hermitian shA
shape@Layout.Mosaic{mosaicSize :: forall pack mirror uplo size. Mosaic pack mirror uplo size -> size
Layout.mosaicSize = shA
size} ->
         Hermitian shB
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     shB
     shB
forall neg zero sub size.
(C neg, C zero, C sub) =>
Hermitian size
-> Omni
     Packed
     (Hermitian neg zero sub)
     Filled
     Filled
     Shape
     Small
     Small
     size
     size
Hermitian Hermitian shA
shape{mosaicSize :: shB
Layout.mosaicSize = shA -> shB
cf shA
size}
      Banded shape :: Banded sub super Shape Small Small shA shA
shape@Layout.Banded{bandedExtent :: forall sub super meas vert horiz height width.
Banded sub super meas vert horiz height width
-> Extent meas vert horiz height width
Layout.bandedExtent = Extent Shape Small Small shA shA
ext} ->
         Banded sub super Shape Small Small shB shB
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     shB
     shB
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
Banded Banded sub super Shape Small Small shA shA
shape{bandedExtent :: Extent Shape Small Small shB shB
Layout.bandedExtent = (shA -> shB)
-> Extent Shape Small Small shA shA
-> Extent Shape Small Small shB shB
forall shA shB. (shA -> shB) -> Square shA -> Square shB
Extent.mapSquareSize shA -> shB
cf Extent Shape Small Small shA shA
ext}
      UnitBandedTriangular shape :: BandedSquare sub super shA
shape@Layout.Banded{bandedExtent :: forall sub super meas vert horiz height width.
Banded sub super meas vert horiz height width
-> Extent meas vert horiz height width
Layout.bandedExtent = Extent Shape Small Small shA shA
ext} ->
         BandedSquare sub super shB
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small shB shB
forall sub super size.
(BandedTriangular sub super, BandedTriangular super sub) =>
BandedSquare sub super size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
UnitBandedTriangular
            BandedSquare sub super shA
shape{bandedExtent :: Extent Shape Small Small shB shB
Layout.bandedExtent = (shA -> shB)
-> Extent Shape Small Small shA shA
-> Extent Shape Small Small shB shB
forall shA shB. (shA -> shB) -> Square shA -> Square shB
Extent.mapSquareSize shA -> shB
cf Extent Shape Small Small shA shA
ext}
      BandedHermitian
            shape :: BandedHermitian offDiag shA
shape@Layout.BandedHermitian{bandedHermitianSize :: forall off size. BandedHermitian off size -> size
Layout.bandedHermitianSize = shA
size} ->
         BandedHermitian offDiag shB
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     shB
     shB
forall neg zero pos offDiag size.
(C neg, C zero, C pos, Natural offDiag) =>
BandedHermitian offDiag size
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     size
     size
BandedHermitian BandedHermitian offDiag shA
shape{bandedHermitianSize :: shB
Layout.bandedHermitianSize = shA -> shB
cf shA
size}


order ::
   Omni pack property lower upper meas vert horiz height width ->
   Layout.Order
order :: Omni pack property lower upper meas vert horiz height width
-> Order
order Omni pack property lower upper meas vert horiz height width
omni =
   case Omni pack property lower upper meas vert horiz height width
omni of
      Full Full meas vert horiz height width
shape -> Full meas vert horiz height width -> Order
forall meas vert horiz height width.
Full meas vert horiz height width -> Order
Layout.fullOrder Full meas vert horiz height width
shape
      UpperTriangular UpperTriangular height
shape -> UpperTriangular height -> Order
forall pack mirror uplo size. Mosaic pack mirror uplo size -> Order
Layout.mosaicOrder UpperTriangular height
shape
      LowerTriangular LowerTriangular height
shape -> LowerTriangular height -> Order
forall pack mirror uplo size. Mosaic pack mirror uplo size -> Order
Layout.mosaicOrder LowerTriangular height
shape
      Symmetric Symmetric height
shape -> Symmetric height -> Order
forall pack mirror uplo size. Mosaic pack mirror uplo size -> Order
Layout.mosaicOrder Symmetric height
shape
      Hermitian Hermitian height
shape -> Hermitian height -> Order
forall pack mirror uplo size. Mosaic pack mirror uplo size -> Order
Layout.mosaicOrder Hermitian height
shape
      Banded Banded sub super meas vert horiz height width
shape -> Banded sub super meas vert horiz height width -> Order
forall sub super meas vert horiz height width.
Banded sub super meas vert horiz height width -> Order
Layout.bandedOrder Banded sub super meas vert horiz height width
shape
      UnitBandedTriangular BandedSquare sub super height
shape -> BandedSquare sub super height -> Order
forall sub super meas vert horiz height width.
Banded sub super meas vert horiz height width -> Order
Layout.bandedOrder BandedSquare sub super height
shape
      BandedHermitian BandedHermitian offDiag height
shape -> BandedHermitian offDiag height -> Order
forall off size. BandedHermitian off size -> Order
Layout.bandedHermitianOrder BandedHermitian offDiag height
shape

_forceOrderDiagonal ::
   Layout.Order ->
   Omni Packed property Empty Empty meas vert horiz height width ->
   Omni Packed property Empty Empty meas vert horiz height width
_forceOrderDiagonal :: Order
-> Omni Packed property Empty Empty meas vert horiz height width
-> Omni Packed property Empty Empty meas vert horiz height width
_forceOrderDiagonal Order
newOrder Omni Packed property Empty Empty meas vert horiz height width
omni =
   case Omni Packed property Empty Empty meas vert horiz height width
omni of
      Banded Banded sub super meas vert horiz height width
sh ->
         Banded sub super meas vert horiz height width
-> Omni
     Packed
     Arbitrary
     (Bands sub)
     (Bands super)
     meas
     vert
     horiz
     height
     width
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
Banded Banded sub super meas vert horiz height width
sh{bandedOrder :: Order
Layout.bandedOrder = Order
newOrder}
      BandedHermitian BandedHermitian offDiag height
sh ->
         BandedHermitian offDiag height
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     height
     height
forall neg zero pos offDiag size.
(C neg, C zero, C pos, Natural offDiag) =>
BandedHermitian offDiag size
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     size
     size
BandedHermitian BandedHermitian offDiag height
sh{bandedHermitianOrder :: Order
Layout.bandedHermitianOrder = Order
newOrder}
      UnitBandedTriangular BandedSquare sub super height
sh ->
         BandedSquare sub super height
-> Omni
     Packed
     Unit
     (Bands sub)
     (Bands super)
     Shape
     Small
     Small
     height
     height
forall sub super size.
(BandedTriangular sub super, BandedTriangular super sub) =>
BandedSquare sub super size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
UnitBandedTriangular BandedSquare sub super height
sh{bandedOrder :: Order
Layout.bandedOrder = Order
newOrder}


transpose ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Omni pack property lower upper meas vert horiz height width ->
   Omni pack property upper lower meas horiz vert width height
transpose :: Omni pack property lower upper meas vert horiz height width
-> Omni pack property upper lower meas horiz vert width height
transpose (Full Full meas vert horiz height width
shape) =
   Full meas horiz vert width height
-> Omni Unpacked property upper lower meas horiz vert width height
forall property lower upper meas vert horiz height width.
(Property property, Strip lower, Strip upper) =>
Full meas vert horiz height width
-> Omni Unpacked property lower upper meas vert horiz height width
Full (Full meas vert horiz height width
-> Full meas horiz vert width height
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.transpose Full meas vert horiz height width
shape)
transpose (UpperTriangular UpperTriangular height
shape) =
   LowerTriangular height
-> Omni
     Packed property Filled Empty Shape Small Small height height
forall diag size.
TriDiag diag =>
LowerTriangular size
-> Omni Packed diag Filled Empty Shape Small Small size size
LowerTriangular (UpperTriangular height
-> Mosaic Packed NoMirror (TriTransposed Upper) height
forall uplo pack mirror sh.
UpLo uplo =>
Mosaic pack mirror uplo sh
-> Mosaic pack mirror (TriTransposed uplo) sh
Layout.triangularTranspose UpperTriangular height
shape)
transpose (LowerTriangular LowerTriangular height
shape) =
   UpperTriangular height
-> Omni
     Packed property Empty Filled Shape Small Small height height
forall diag size.
TriDiag diag =>
UpperTriangular size
-> Omni Packed diag Empty Filled Shape Small Small size size
UpperTriangular (LowerTriangular height
-> Mosaic Packed NoMirror (TriTransposed Lower) height
forall uplo pack mirror sh.
UpLo uplo =>
Mosaic pack mirror uplo sh
-> Mosaic pack mirror (TriTransposed uplo) sh
Layout.triangularTranspose LowerTriangular height
shape)
transpose (Symmetric Symmetric height
shape) = Symmetric height
-> Omni
     Packed Symmetric Filled Filled Shape Small Small height height
forall size.
Symmetric size
-> Omni Packed Symmetric Filled Filled Shape Small Small size size
Symmetric Symmetric height
shape
transpose (Hermitian Hermitian height
shape) = Hermitian height
-> Omni
     Packed
     (Hermitian neg zero pos)
     Filled
     Filled
     Shape
     Small
     Small
     height
     height
forall neg zero sub size.
(C neg, C zero, C sub) =>
Hermitian size
-> Omni
     Packed
     (Hermitian neg zero sub)
     Filled
     Filled
     Shape
     Small
     Small
     size
     size
Hermitian Hermitian height
shape
transpose (Banded Banded sub super meas vert horiz height width
shape) =
   Banded super sub meas horiz vert width height
-> Omni
     Packed
     Arbitrary
     (Bands super)
     (Bands sub)
     meas
     horiz
     vert
     width
     height
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
Banded (Banded sub super meas vert horiz height width
-> Banded super sub meas horiz vert width height
forall meas vert horiz sub super height width.
(Measure meas, C vert, C horiz) =>
Banded sub super meas vert horiz height width
-> Banded super sub meas horiz vert width height
Layout.bandedTranspose Banded sub super meas vert horiz height width
shape)
transpose (UnitBandedTriangular BandedSquare sub super height
shape) =
   BandedSquare super sub height
-> Omni
     Packed
     Unit
     (Bands super)
     (Bands sub)
     Shape
     Small
     Small
     height
     height
forall sub super size.
(BandedTriangular sub super, BandedTriangular super sub) =>
BandedSquare sub super size
-> Omni
     Packed Unit (Bands sub) (Bands super) Shape Small Small size size
UnitBandedTriangular (BandedSquare sub super height -> BandedSquare super sub height
forall meas vert horiz sub super height width.
(Measure meas, C vert, C horiz) =>
Banded sub super meas vert horiz height width
-> Banded super sub meas horiz vert width height
Layout.bandedTranspose BandedSquare sub super height
shape)
transpose (BandedHermitian BandedHermitian offDiag height
shape) =
   BandedHermitian offDiag height
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     height
     height
forall neg zero pos offDiag size.
(C neg, C zero, C pos, Natural offDiag) =>
BandedHermitian offDiag size
-> Omni
     Packed
     (Hermitian neg zero pos)
     (Bands offDiag)
     (Bands offDiag)
     Shape
     Small
     Small
     size
     size
BandedHermitian BandedHermitian offDiag height
shape


instance
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width) =>
      Shape.C
         (Omni pack property lower upper meas vert horiz height width) where

   size :: Omni pack property lower upper meas vert horiz height width -> Int
size Omni pack property lower upper meas vert horiz height width
omni =
      case Omni pack property lower upper meas vert horiz height width
omni of
         Full Full meas vert horiz height width
shape -> Full meas vert horiz height width -> Int
forall sh. C sh => sh -> Int
Shape.size Full meas vert horiz height width
shape
         UpperTriangular UpperTriangular height
shape -> UpperTriangular height -> Int
forall sh. C sh => sh -> Int
Shape.size UpperTriangular height
shape
         LowerTriangular LowerTriangular height
shape -> LowerTriangular height -> Int
forall sh. C sh => sh -> Int
Shape.size LowerTriangular height
shape
         Symmetric Symmetric height
shape -> Symmetric height -> Int
forall sh. C sh => sh -> Int
Shape.size Symmetric height
shape
         Hermitian Hermitian height
shape -> Hermitian height -> Int
forall sh. C sh => sh -> Int
Shape.size Hermitian height
shape
         Banded Banded sub super meas vert horiz height width
shape -> Banded sub super meas vert horiz height width -> Int
forall sh. C sh => sh -> Int
Shape.size Banded sub super meas vert horiz height width
shape
         UnitBandedTriangular BandedSquare sub super height
shape -> BandedSquare sub super height -> Int
forall sh. C sh => sh -> Int
Shape.size BandedSquare sub super height
shape
         BandedHermitian BandedHermitian offDiag height
shape -> BandedHermitian offDiag height -> Int
forall sh. C sh => sh -> Int
Shape.size BandedHermitian offDiag height
shape



type family MultipliedBands bandsA bandsB
type instance MultipliedBands Filled bandsB = Filled
type instance MultipliedBands (Bands k) Filled = Filled
type instance MultipliedBands (Bands k) (Bands l) = Bands (k Unary.:+: l)

type family MultipliedStrip contA contB
type instance MultipliedStrip Filled contB = Filled
type instance MultipliedStrip Empty contB = contB

type family MultipliedProperty propA propB
type instance MultipliedProperty Arbitrary propB = Arbitrary
type instance MultipliedProperty Symmetric propB = Arbitrary
type instance MultipliedProperty (Hermitian neg zero pos) propB = Arbitrary
type instance MultipliedProperty Unit Arbitrary = Arbitrary
type instance MultipliedProperty Unit Symmetric = Arbitrary
type instance MultipliedProperty Unit (Hermitian neg zero pos) = Arbitrary
type instance MultipliedProperty Unit Unit = Unit

type family UnitIfTriangular lower upper
type instance UnitIfTriangular Empty upper = Unit
type instance UnitIfTriangular Filled Empty = Unit
type instance UnitIfTriangular Filled Filled = Arbitrary
type instance UnitIfTriangular Filled (Bands (Unary.Succ k)) = Arbitrary
type instance UnitIfTriangular (Bands (Unary.Succ k)) Empty = Unit
type instance UnitIfTriangular (Bands (Unary.Succ k)) Filled = Arbitrary
type instance UnitIfTriangular (Bands (Unary.Succ k)) (Bands (Unary.Succ l)) =
                  Arbitrary

type family MergeUnit unit0 unit1
type instance MergeUnit Unit unit1 = unit1
type instance MergeUnit Arbitrary unit1 = Arbitrary