{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GADTs #-}
module Numeric.LAPACK.Matrix.Symmetric (
   Symmetric,
   takeUpper,
   fromUpper,
   pack,
   assureSymmetry,

   size,
   fromList,
   autoFromList,
   identity,
   diagonal,
   takeDiagonal,
   forceOrder,
   transpose,
   adjoint,

   stack, (#%%%#),
   split,
   takeTopLeft,
   takeTopRight,
   takeBottomRight,

   toSquare,
   fromHermitian,

   multiplyVector,
   multiplyFull,
   square,

   tensorProduct,
   sumRank1, sumRank1NonEmpty,

   gramian,            gramianTransposed,
   congruenceDiagonal, congruenceDiagonalTransposed,
   congruence,         congruenceTransposed,
   anticommutator,     anticommutatorTransposed,
   addTransposed,

   solve,
   inverse,
   determinant,
   ) where

import qualified Numeric.LAPACK.Matrix.Symmetric.Linear as Linear
import qualified Numeric.LAPACK.Matrix.Symmetric.Basic as Basic
import qualified Numeric.LAPACK.Matrix.Symmetric.Unified as Symmetric
import qualified Numeric.LAPACK.Matrix.Triangular as Triangular
import qualified Numeric.LAPACK.Matrix.Mosaic.Packed as Packed
import qualified Numeric.LAPACK.Matrix.Mosaic.Basic as Mosaic
import qualified Numeric.LAPACK.Matrix.Basic as FullBasic

import qualified Numeric.LAPACK.Matrix.Full as Full
import qualified Numeric.LAPACK.Matrix.Array.Unpacked as ArrUnpacked
import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix
import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout
import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni
import qualified Numeric.LAPACK.Matrix.Extent as Extent
import qualified Numeric.LAPACK.Vector as Vector
import Numeric.LAPACK.Matrix.Array.Mosaic
         (Symmetric, SymmetricP, FlexHermitianP, Upper, assureMirrored)
import Numeric.LAPACK.Matrix.Array.Private (Full, General, Square, packTag)
import Numeric.LAPACK.Matrix.Layout.Private (Order)
import Numeric.LAPACK.Matrix.Private (ShapeInt)
import Numeric.LAPACK.Vector (Vector)
import Numeric.LAPACK.Scalar (one)

import qualified Numeric.Netlib.Class as Class

import qualified Type.Data.Bool as TBool

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

import qualified Data.NonEmpty as NonEmpty
import Foreign.Storable (Storable)


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

transpose :: SymmetricP pack sh a -> SymmetricP pack sh a
transpose :: SymmetricP pack sh a -> SymmetricP pack sh a
transpose = SymmetricP pack sh a -> SymmetricP pack sh a
forall a. a -> a
id

adjoint ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   SymmetricP pack sh a -> SymmetricP pack sh a
adjoint :: SymmetricP pack sh a -> SymmetricP pack sh a
adjoint = (PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh sh a)
-> SymmetricP pack sh a -> SymmetricP pack sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
-> PlainArray
     pack Symmetric Filled Filled Shape Small Small sh sh a
forall sh a. (C sh, Floating a) => Vector sh a -> Vector sh a
Vector.conjugate


fromList :: (Shape.C sh, Storable a) => Order -> sh -> [a] -> Symmetric sh a
fromList :: Order -> sh -> [a] -> Symmetric sh a
fromList Order
order sh
sh = Array (SymmetricP Packed sh) a -> Symmetric sh a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (SymmetricP Packed sh) a -> Symmetric sh a)
-> ([a] -> Array (SymmetricP Packed sh) a) -> [a] -> Symmetric sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> sh -> [a] -> Array (SymmetricP Packed sh) a
forall pack mirror uplo sh a.
(Packing pack, Mirror mirror, UpLo uplo, C sh, Storable a) =>
Order -> sh -> [a] -> Mosaic pack mirror uplo sh a
Mosaic.fromList Order
order sh
sh

autoFromList :: (Storable a) => Order -> [a] -> Symmetric ShapeInt a
autoFromList :: Order -> [a] -> Symmetric ShapeInt a
autoFromList Order
order = Array (SymmetricP Packed ShapeInt) a -> Symmetric ShapeInt a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (SymmetricP Packed ShapeInt) a -> Symmetric ShapeInt a)
-> ([a] -> Array (SymmetricP Packed ShapeInt) a)
-> [a]
-> Symmetric ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> [a] -> Array (SymmetricP Packed ShapeInt) a
forall pack mirror uplo a.
(Packing pack, Mirror mirror, UpLo uplo, Storable a) =>
Order -> [a] -> Mosaic pack mirror uplo ShapeInt a
Mosaic.autoFromList Order
order


toSquare ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   SymmetricP pack sh a -> Square sh a
toSquare :: SymmetricP pack sh a -> Square sh a
toSquare SymmetricP pack sh a
a =
   case SymmetricP pack sh a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag SymmetricP pack sh a
a of
      PackingSingleton pack
Layout.Packed -> (PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Shape Small Small sh sh a)
-> SymmetricP pack sh a -> Square sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
-> PlainArray
     Unpacked Arbitrary Filled Filled Shape Small Small sh sh a
forall mirror sh a.
(Mirror mirror, C sh, Floating a) =>
Mosaic mirror Upper sh a -> Square sh a
Symmetric.toSquare SymmetricP pack sh a
a
      PackingSingleton pack
Layout.Unpacked -> (FullArray Shape Small Small sh sh a
 -> FullArray Shape Small Small sh sh a)
-> UnpackedMatrix Symmetric Filled Filled Shape Small Small sh sh a
-> Square sh a
forall propertyA lowerA upperA propertyB lowerB upperB measA vertA
       horizA heightA widthA a measB vertB horizB heightB widthB b.
(Property propertyA, Strip lowerA, Strip upperA,
 Property propertyB, Strip lowerB, Strip upperB) =>
(FullArray measA vertA horizA heightA widthA a
 -> FullArray measB vertB horizB heightB widthB b)
-> UnpackedMatrix
     propertyA lowerA upperA measA vertA horizA heightA widthA a
-> UnpackedMatrix
     propertyB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.liftUnpacked1 FullArray Shape Small Small sh sh a
-> FullArray Shape Small Small sh sh a
forall a. a -> a
id SymmetricP pack sh a
UnpackedMatrix Symmetric Filled Filled Shape Small Small sh sh a
a

fromHermitian ::
   (Layout.Packing pack, TBool.C neg, TBool.C zero, TBool.C pos,
    Shape.C sh, Class.Real a) =>
   FlexHermitianP pack neg zero pos sh a -> SymmetricP pack sh a
fromHermitian :: FlexHermitianP pack neg zero pos sh a -> SymmetricP pack sh a
fromHermitian =
   (PlainArray
   pack
   (Hermitian neg zero pos)
   Filled
   Filled
   Shape
   Small
   Small
   sh
   sh
   a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh sh a)
-> FlexHermitianP pack neg zero pos sh a -> SymmetricP pack sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 ((PlainArray
    pack
    (Hermitian neg zero pos)
    Filled
    Filled
    Shape
    Small
    Small
    sh
    sh
    a
  -> PlainArray
       pack Symmetric Filled Filled Shape Small Small sh sh a)
 -> FlexHermitianP pack neg zero pos sh a -> SymmetricP pack sh a)
-> (PlainArray
      pack
      (Hermitian neg zero pos)
      Filled
      Filled
      Shape
      Small
      Small
      sh
      sh
      a
    -> PlainArray
         pack Symmetric Filled Filled Shape Small Small sh sh a)
-> FlexHermitianP pack neg zero pos sh a
-> SymmetricP pack sh a
forall a b. (a -> b) -> a -> b
$ (HermitianP pack sh -> SymmetricP pack sh)
-> Array (HermitianP pack sh) a -> Array (SymmetricP pack sh) a
forall sh0 sh1 a. (sh0 -> sh1) -> Array sh0 a -> Array sh1 a
Array.mapShape HermitianP pack sh -> SymmetricP pack sh
forall pack size. HermitianP pack size -> SymmetricP pack size
Layout.symmetricFromHermitian


identity :: (Shape.C sh, Class.Floating a) => Order -> sh -> Symmetric sh a
identity :: Order -> sh -> Symmetric sh a
identity Order
order = Array (SymmetricP Packed sh) a -> Symmetric sh a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (SymmetricP Packed sh) a -> Symmetric sh a)
-> (sh -> Array (SymmetricP Packed sh) a) -> sh -> Symmetric sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> sh -> Array (SymmetricP Packed sh) a
forall mirror uplo sh a.
(Mirror mirror, UpLo uplo, C sh, Floating a) =>
Order -> sh -> Mosaic mirror uplo sh a
Packed.identity Order
order

diagonal ::
   (Shape.C sh, Class.Floating a) => Order -> Vector sh a -> Symmetric sh a
diagonal :: Order -> Vector sh a -> Symmetric sh a
diagonal Order
order = Array (SymmetricP Packed sh) a -> Symmetric sh a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (SymmetricP Packed sh) a -> Symmetric sh a)
-> (Vector sh a -> Array (SymmetricP Packed sh) a)
-> Vector sh a
-> Symmetric sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> Vector sh a -> Array (SymmetricP Packed sh) a
forall mirror uplo sh a.
(Mirror mirror, UpLo uplo, C sh, Floating a) =>
Order -> Vector sh a -> Mosaic mirror uplo sh a
Packed.diagonal Order
order

takeDiagonal :: (Shape.C sh, Class.Floating a) => Symmetric sh a -> Vector sh a
takeDiagonal :: Symmetric sh a -> Vector sh a
takeDiagonal = TriangularP Packed Empty Arbitrary Filled sh a -> Vector sh a
forall lo up diag sh a pack.
(PowerStrip lo, PowerStrip up, TriDiag diag, C sh, Floating a) =>
TriangularP pack lo diag up sh a -> Vector sh a
Triangular.takeDiagonal (TriangularP Packed Empty Arbitrary Filled sh a -> Vector sh a)
-> (Symmetric sh a
    -> TriangularP Packed Empty Arbitrary Filled sh a)
-> Symmetric sh a
-> Vector sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Symmetric sh a -> TriangularP Packed Empty Arbitrary Filled sh a
forall sh a. Symmetric sh a -> Upper sh a
takeUpper

forceOrder ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   Order -> SymmetricP pack sh a -> SymmetricP pack sh a
forceOrder :: Order -> SymmetricP pack sh a -> SymmetricP pack sh a
forceOrder Order
order SymmetricP pack sh a
a =
   case SymmetricP pack sh a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag SymmetricP pack sh a
a of
      PackingSingleton pack
Layout.Packed -> (PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh sh a)
-> SymmetricP pack sh a -> SymmetricP pack sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 (Order
-> Mosaic SimpleMirror Upper sh a -> Mosaic SimpleMirror Upper sh a
forall uplo sh a mirror.
(UpLo uplo, C sh, Floating a) =>
Order -> Mosaic mirror uplo sh a -> Mosaic mirror uplo sh a
Packed.forceOrder Order
order) SymmetricP pack sh a
a
      PackingSingleton pack
Layout.Unpacked -> (FullArray Shape Small Small sh sh a
 -> FullArray Shape Small Small sh sh a)
-> UnpackedMatrix Symmetric Filled Filled Shape Small Small sh sh a
-> UnpackedMatrix Symmetric Filled Filled Shape Small Small sh sh a
forall propertyA lowerA upperA propertyB lowerB upperB measA vertA
       horizA heightA widthA a measB vertB horizB heightB widthB b.
(Property propertyA, Strip lowerA, Strip upperA,
 Property propertyB, Strip lowerB, Strip upperB) =>
(FullArray measA vertA horizA heightA widthA a
 -> FullArray measB vertB horizB heightB widthB b)
-> UnpackedMatrix
     propertyA lowerA upperA measA vertA horizA heightA widthA a
-> UnpackedMatrix
     propertyB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.liftUnpacked1 (Order
-> FullArray Shape Small Small sh sh a
-> FullArray Shape Small Small sh sh a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width, Floating a) =>
Order
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
FullBasic.forceOrder Order
order) SymmetricP pack sh a
UnpackedMatrix Symmetric Filled Filled Shape Small Small sh sh a
a


pack ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   SymmetricP pack sh a -> Symmetric sh a
pack :: SymmetricP pack sh a -> Symmetric sh a
pack = (PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
 -> PlainArray
      Packed Symmetric Filled Filled Shape Small Small sh sh a)
-> SymmetricP pack sh a -> Symmetric sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
-> PlainArray
     Packed Symmetric Filled Filled Shape Small Small sh sh a
forall uplo sh a pack mirror.
(UpLo uplo, C sh, Floating a) =>
Mosaic pack mirror uplo sh a -> Mosaic mirror uplo sh a
Mosaic.pack

takeUpper :: Symmetric sh a -> Upper sh a
takeUpper :: Symmetric sh a -> Upper sh a
takeUpper = (PlainArray
   Packed Symmetric Filled Filled Shape Small Small sh sh a
 -> PlainArray
      Packed Arbitrary Empty Filled Shape Small Small sh sh a)
-> Symmetric sh a -> Upper sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray Packed Symmetric Filled Filled Shape Small Small sh sh a
-> PlainArray
     Packed Arbitrary Empty Filled Shape Small Small sh sh a
forall mirror sh a. MosaicUpper mirror sh a -> Upper sh a
Mosaic.takeUpper

fromUpper :: Upper sh a -> Symmetric sh a
fromUpper :: Upper sh a -> Symmetric sh a
fromUpper = (PlainArray Packed Arbitrary Empty Filled Shape Small Small sh sh a
 -> PlainArray
      Packed Symmetric Filled Filled Shape Small Small sh sh a)
-> Upper sh a -> Symmetric sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray Packed Arbitrary Empty Filled Shape Small Small sh sh a
-> PlainArray
     Packed Symmetric Filled Filled Shape Small Small sh sh a
forall mirror sh a.
Mirror mirror =>
Upper sh a -> MosaicUpper mirror sh a
Mosaic.fromUpper

assureSymmetry ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   Square sh a -> SymmetricP pack sh a
assureSymmetry :: Square sh a -> SymmetricP pack sh a
assureSymmetry = Square sh a -> SymmetricP pack sh a
forall pack mirror uplo meas vert horiz prop lower upper sh a.
(Packing pack, Mirror mirror, UpLo uplo, meas ~ Shape,
 vert ~ Small, horiz ~ Small,
 FromPlain pack prop lower upper meas vert horiz sh sh,
 Plain pack prop lower upper meas vert horiz sh sh
 ~ Mosaic pack mirror uplo sh,
 C sh, Floating a) =>
Square sh a -> Quadratic pack prop lower upper sh a
assureMirrored


stack ::
   (Layout.Packing pack,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   SymmetricP pack sh0 a ->
   General sh0 sh1 a ->
   SymmetricP pack sh1 a ->
   SymmetricP pack (sh0::+sh1) a
stack :: SymmetricP pack sh0 a
-> General sh0 sh1 a
-> SymmetricP pack sh1 a
-> SymmetricP pack (sh0 ::+ sh1) a
stack SymmetricP pack sh0 a
a =
   case SymmetricP pack sh0 a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag SymmetricP pack sh0 a
a of
      PackingSingleton pack
Layout.Packed -> (PlainArray
   pack Symmetric Filled Filled Shape Small Small sh0 sh0 a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big sh0 sh1 a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh1 sh1 a
 -> PlainArray
      pack
      Symmetric
      Filled
      Filled
      Shape
      Small
      Small
      (sh0 ::+ sh1)
      (sh0 ::+ sh1)
      a)
-> SymmetricP pack sh0 a
-> General sh0 sh1 a
-> SymmetricP pack sh1 a
-> SymmetricP pack (sh0 ::+ sh1) a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC packD propD
       lowerD upperD measD vertD horizD heightD widthD a b c d.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB,
 ToPlain
   packC propC lowerC upperC measC vertC horizC heightC widthC,
 FromPlain
   packD propD lowerD upperD measD vertD horizD heightD widthD) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b
 -> PlainArray
      packC propC lowerC upperC measC vertC horizC heightC widthC c
 -> PlainArray
      packD propD lowerD upperD measD vertD horizD heightD widthD d)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
-> ArrayMatrix
     packC propC lowerC upperC measC vertC horizC heightC widthC c
-> ArrayMatrix
     packD propD lowerD upperD measD vertD horizD heightD widthD d
ArrMatrix.lift3 PlainArray pack Symmetric Filled Filled Shape Small Small sh0 sh0 a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big sh0 sh1 a
-> PlainArray
     pack Symmetric Filled Filled Shape Small Small sh1 sh1 a
-> PlainArray
     pack
     Symmetric
     Filled
     Filled
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
forall height width a mirror.
(C height, Eq height, C width, Eq width, Floating a) =>
MosaicUpper mirror height a
-> General height width a
-> MosaicUpper mirror width a
-> MosaicUpper mirror (height ::+ width) a
Packed.stackUpper SymmetricP pack sh0 a
a
      PackingSingleton pack
Layout.Unpacked ->
         (FullArray Shape Small Small sh0 sh0 a
 -> FullArray Size Big Big sh0 sh1 a
 -> FullArray Shape Small Small sh1 sh1 a
 -> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> UnpackedMatrix
     Symmetric Filled Filled Shape Small Small sh0 sh0 a
-> General sh0 sh1 a
-> UnpackedMatrix
     Symmetric Filled Filled Shape Small Small sh1 sh1 a
-> UnpackedMatrix
     Symmetric
     Filled
     Filled
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
forall propertyA lowerA upperA propertyB lowerB upperB propertyC
       lowerC upperC propertyD lowerD upperD measA vertA horizA heightA
       widthA a measB vertB horizB heightB widthB b measC vertC horizC
       heightC widthC c measD vertD horizD heightD widthD d.
(Property propertyA, Strip lowerA, Strip upperA,
 Property propertyB, Strip lowerB, Strip upperB, Property propertyC,
 Strip lowerC, Strip upperC, Property propertyD, Strip lowerD,
 Strip upperD) =>
(FullArray measA vertA horizA heightA widthA a
 -> FullArray measB vertB horizB heightB widthB b
 -> FullArray measC vertC horizC heightC widthC c
 -> FullArray measD vertD horizD heightD widthD d)
-> UnpackedMatrix
     propertyA lowerA upperA measA vertA horizA heightA widthA a
-> UnpackedMatrix
     propertyB lowerB upperB measB vertB horizB heightB widthB b
-> UnpackedMatrix
     propertyC lowerC upperC measC vertC horizC heightC widthC c
-> UnpackedMatrix
     propertyD lowerD upperD measD vertD horizD heightD widthD d
ArrMatrix.liftUnpacked3
            (\FullArray Shape Small Small sh0 sh0 a
a_ FullArray Size Big Big sh0 sh1 a
b_ FullArray Shape Small Small sh1 sh1 a
c_ ->
               FullArray Shape Small Small sh0 sh0 a
-> FullArray Size Big Big sh0 sh1 a
-> General sh1 sh0 a
-> FullArray Shape Small Small sh1 sh1 a
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
forall shA shB a.
(C shA, Eq shA, C shB, Eq shB, Floating a) =>
Square shA a
-> General shA shB a
-> General shB shA a
-> Square shB a
-> Square (shA ::+ shB) a
FullBasic.stackMosaic FullArray Shape Small Small sh0 sh0 a
a_ FullArray Size Big Big sh0 sh1 a
b_ (FullArray Size Big Big sh0 sh1 a -> General sh1 sh0 a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a
-> Full meas horiz vert width height a
FullBasic.transpose FullArray Size Big Big sh0 sh1 a
b_) FullArray Shape Small Small sh1 sh1 a
c_)
            SymmetricP pack sh0 a
UnpackedMatrix Symmetric Filled Filled Shape Small Small sh0 sh0 a
a

infixr 2 #%%%#

(#%%%#) ::
   (Layout.Packing pack,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   (SymmetricP pack sh0 a, General sh0 sh1 a) ->
   SymmetricP pack sh1 a ->
   SymmetricP pack (sh0::+sh1) a
#%%%# :: (SymmetricP pack sh0 a, General sh0 sh1 a)
-> SymmetricP pack sh1 a -> SymmetricP pack (sh0 ::+ sh1) a
(#%%%#) = (SymmetricP pack sh0 a
 -> General sh0 sh1 a
 -> SymmetricP pack sh1 a
 -> SymmetricP pack (sh0 ::+ sh1) a)
-> (SymmetricP pack sh0 a, General sh0 sh1 a)
-> SymmetricP pack sh1 a
-> SymmetricP pack (sh0 ::+ sh1) a
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry SymmetricP pack sh0 a
-> General sh0 sh1 a
-> SymmetricP pack sh1 a
-> SymmetricP pack (sh0 ::+ sh1) a
forall pack sh0 sh1 a.
(Packing pack, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) =>
SymmetricP pack sh0 a
-> General sh0 sh1 a
-> SymmetricP pack sh1 a
-> SymmetricP pack (sh0 ::+ sh1) a
stack


split ::
   (Layout.Packing pack,
    Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1, Class.Floating a) =>
   SymmetricP pack (sh0::+sh1) a ->
   (SymmetricP pack sh0 a, General sh0 sh1 a, SymmetricP pack sh1 a)
split :: SymmetricP pack (sh0 ::+ sh1) a
-> (SymmetricP pack sh0 a, General sh0 sh1 a,
    SymmetricP pack sh1 a)
split SymmetricP pack (sh0 ::+ sh1) a
a = (SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh0 a
forall pack sh0 sh1 a.
(Packing pack, C sh0, C sh1, Floating a) =>
SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh0 a
takeTopLeft SymmetricP pack (sh0 ::+ sh1) a
a, SymmetricP pack (sh0 ::+ sh1) a -> General sh0 sh1 a
forall pack sh0 sh1 a.
(Packing pack, C sh0, C sh1, Floating a) =>
SymmetricP pack (sh0 ::+ sh1) a -> General sh0 sh1 a
takeTopRight SymmetricP pack (sh0 ::+ sh1) a
a, SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh1 a
forall pack sh0 sh1 a.
(Packing pack, C sh0, C sh1, Floating a) =>
SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh1 a
takeBottomRight SymmetricP pack (sh0 ::+ sh1) a
a)

takeTopLeft ::
   (Layout.Packing pack, Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   SymmetricP pack (sh0::+sh1) a -> SymmetricP pack sh0 a
takeTopLeft :: SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh0 a
takeTopLeft SymmetricP pack (sh0 ::+ sh1) a
a =
   case SymmetricP pack (sh0 ::+ sh1) a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag SymmetricP pack (sh0 ::+ sh1) a
a of
      PackingSingleton pack
Layout.Packed -> (PlainArray
   pack
   Symmetric
   Filled
   Filled
   Shape
   Small
   Small
   (sh0 ::+ sh1)
   (sh0 ::+ sh1)
   a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh0 sh0 a)
-> SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh0 a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray
  pack
  Symmetric
  Filled
  Filled
  Shape
  Small
  Small
  (sh0 ::+ sh1)
  (sh0 ::+ sh1)
  a
-> PlainArray
     pack Symmetric Filled Filled Shape Small Small sh0 sh0 a
forall uplo height width a mirror.
(UpLo uplo, C height, C width, Floating a) =>
Mosaic mirror uplo (height ::+ width) a
-> Mosaic mirror uplo height a
Packed.takeTopLeft SymmetricP pack (sh0 ::+ sh1) a
a
      PackingSingleton pack
Layout.Unpacked -> Quadratic Symmetric Filled Filled (sh0 ::+ sh1) a
-> Quadratic Symmetric Filled Filled sh0 a
forall property lower upper sh0 sh1 a.
(Property property, Strip lower, Strip upper, C sh0, C sh1,
 Floating a) =>
Quadratic property lower upper (sh0 ::+ sh1) a
-> Quadratic property lower upper sh0 a
ArrUnpacked.takeTopLeft SymmetricP pack (sh0 ::+ sh1) a
Quadratic Symmetric Filled Filled (sh0 ::+ sh1) a
a

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

takeBottomRight ::
   (Layout.Packing pack, Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   SymmetricP pack (sh0::+sh1) a -> SymmetricP pack sh1 a
takeBottomRight :: SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh1 a
takeBottomRight SymmetricP pack (sh0 ::+ sh1) a
a =
   case SymmetricP pack (sh0 ::+ sh1) a -> PackingSingleton pack
forall pack diag lower upper meas vert horiz height width a.
Packing pack =>
ArrayMatrix pack diag lower upper meas vert horiz height width a
-> PackingSingleton pack
packTag SymmetricP pack (sh0 ::+ sh1) a
a of
      PackingSingleton pack
Layout.Unpacked -> Quadratic Symmetric Filled Filled (sh0 ::+ sh1) a
-> Quadratic Symmetric Filled Filled sh1 a
forall property lower upper sh0 sh1 a.
(Property property, Strip lower, Strip upper, C sh0, C sh1,
 Floating a) =>
Quadratic property lower upper (sh0 ::+ sh1) a
-> Quadratic property lower upper sh1 a
ArrUnpacked.takeBottomRight SymmetricP pack (sh0 ::+ sh1) a
Quadratic Symmetric Filled Filled (sh0 ::+ sh1) a
a
      PackingSingleton pack
Layout.Packed -> (PlainArray
   pack
   Symmetric
   Filled
   Filled
   Shape
   Small
   Small
   (sh0 ::+ sh1)
   (sh0 ::+ sh1)
   a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh1 sh1 a)
-> SymmetricP pack (sh0 ::+ sh1) a -> SymmetricP pack sh1 a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray
  pack
  Symmetric
  Filled
  Filled
  Shape
  Small
  Small
  (sh0 ::+ sh1)
  (sh0 ::+ sh1)
  a
-> PlainArray
     pack Symmetric Filled Filled Shape Small Small sh1 sh1 a
forall uplo height width a mirror.
(UpLo uplo, C height, C width, Floating a) =>
Mosaic mirror uplo (height ::+ width) a
-> Mosaic mirror uplo width a
Packed.takeBottomRight SymmetricP pack (sh0 ::+ sh1) a
a



multiplyVector ::
   (Layout.Packing pack) =>
   (Shape.C sh, Eq sh, Class.Floating a) =>
   SymmetricP pack sh a -> Vector sh a -> Vector sh a
multiplyVector :: SymmetricP pack sh a -> Vector sh a -> Vector sh a
multiplyVector = Mosaic pack SimpleMirror Upper sh a -> Vector sh a -> Vector sh a
forall mirror sh a pack uplo.
(Mirror mirror, C sh, Eq sh, Floating a) =>
Mosaic pack mirror uplo sh a -> Vector sh a -> Vector sh a
Symmetric.multiplyVector (Mosaic pack SimpleMirror Upper sh a -> Vector sh a -> Vector sh a)
-> (SymmetricP pack sh a -> Mosaic pack SimpleMirror Upper sh a)
-> SymmetricP pack sh a
-> Vector sh a
-> Vector sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SymmetricP pack sh a -> Mosaic pack SimpleMirror Upper sh a
forall pack property lower upper meas vert horiz height width a.
ToPlain pack property lower upper meas vert horiz height width =>
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> PlainArray
     pack property lower upper meas vert horiz height width a
ArrMatrix.toVector

multiplyFull ::
   (Layout.Packing pack) =>
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width,
    Class.Floating a) =>
   SymmetricP pack height a ->
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
multiplyFull :: SymmetricP pack height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
multiplyFull = (PlainArray
   pack Symmetric Filled Filled Shape Small Small height height a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a)
-> SymmetricP pack height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB,
 FromPlain
   packC propC lowerC upperC measC vertC horizC heightC widthC) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b
 -> PlainArray
      packC propC lowerC upperC measC vertC horizC heightC widthC c)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
-> ArrayMatrix
     packC propC lowerC upperC measC vertC horizC heightC widthC c
ArrMatrix.lift2 PlainArray
  pack Symmetric Filled Filled Shape Small Small height height a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz height width a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz height width a
forall uplo meas vert horiz height width a pack mirror.
(UpLo uplo, Measure meas, C vert, C horiz, C height, Eq height,
 C width, Floating a) =>
Mosaic pack mirror uplo height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Symmetric.multiplyFull

square ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   SymmetricP pack sh a -> SymmetricP pack sh a
square :: SymmetricP pack sh a -> SymmetricP pack sh a
square = (PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh sh a)
-> SymmetricP pack sh a -> SymmetricP pack sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 ((PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
  -> PlainArray
       pack Symmetric Filled Filled Shape Small Small sh sh a)
 -> SymmetricP pack sh a -> SymmetricP pack sh a)
-> (PlainArray
      pack Symmetric Filled Filled Shape Small Small sh sh a
    -> PlainArray
         pack Symmetric Filled Filled Shape Small Small sh sh a)
-> SymmetricP pack sh a
-> SymmetricP pack sh a
forall a b. (a -> b) -> a -> b
$ DiagSingleton Arbitrary
-> Mosaic pack SimpleMirror Upper sh a
-> Mosaic pack SimpleMirror Upper sh a
forall pack diag uplo sh a mirror.
(Packing pack, TriDiag diag, UpLo uplo, C sh, Floating a) =>
DiagSingleton diag
-> Mosaic pack mirror uplo sh a -> Mosaic pack mirror uplo sh a
Mosaic.square DiagSingleton Arbitrary
Omni.Arbitrary



tensorProduct ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   Order -> Vector sh a -> SymmetricP pack sh a
tensorProduct :: Order -> Vector sh a -> SymmetricP pack sh a
tensorProduct Order
order = Array (SymmetricP pack sh) a -> SymmetricP pack sh a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (SymmetricP pack sh) a -> SymmetricP pack sh a)
-> (Vector sh a -> Array (SymmetricP pack sh) a)
-> Vector sh a
-> SymmetricP pack sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> Vector sh a -> Array (SymmetricP pack sh) a
forall pack mirror sh a.
(Packing pack, Mirror mirror, C sh, Floating a) =>
Order -> Vector sh a -> Mosaic pack mirror Upper sh a
Symmetric.outerUpper Order
order

sumRank1 ::
   (Layout.Packing pack, Shape.C sh, Eq sh, Class.Floating a) =>
   Order -> sh -> [(a, Vector sh a)] -> SymmetricP pack sh a
sumRank1 :: Order -> sh -> [(a, Vector sh a)] -> SymmetricP pack sh a
sumRank1 Order
order sh
sh = Array (SymmetricP pack sh) a -> SymmetricP pack sh a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (SymmetricP pack sh) a -> SymmetricP pack sh a)
-> ([(a, Vector sh a)] -> Array (SymmetricP pack sh) a)
-> [(a, Vector sh a)]
-> SymmetricP pack sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> sh -> [(a, Vector sh a)] -> Array (SymmetricP pack sh) a
forall pack sh a.
(Packing pack, C sh, Eq sh, Floating a) =>
Order -> sh -> [(a, Vector sh a)] -> SymmetricP pack sh a
Basic.sumRank1 Order
order sh
sh

sumRank1NonEmpty ::
   (Layout.Packing pack, Shape.C sh, Eq sh, Class.Floating a) =>
   Order -> NonEmpty.T [] (a, Vector sh a) -> SymmetricP pack sh a
sumRank1NonEmpty :: Order -> T [] (a, Vector sh a) -> SymmetricP pack sh a
sumRank1NonEmpty Order
order (NonEmpty.Cons (a, Vector sh a)
x [(a, Vector sh a)]
xs) =
   Order -> sh -> [(a, Vector sh a)] -> SymmetricP pack sh a
forall pack sh a.
(Packing pack, C sh, Eq sh, Floating a) =>
Order -> sh -> [(a, Vector sh a)] -> SymmetricP pack sh a
sumRank1 Order
order (Vector sh a -> sh
forall sh a. Array sh a -> sh
Array.shape (Vector sh a -> sh) -> Vector sh a -> sh
forall a b. (a -> b) -> a -> b
$ (a, Vector sh a) -> Vector sh a
forall a b. (a, b) -> b
snd (a, Vector sh a)
x) ((a, Vector sh a)
x(a, Vector sh a) -> [(a, Vector sh a)] -> [(a, Vector sh a)]
forall a. a -> [a] -> [a]
:[(a, Vector sh a)]
xs)

{-
We do not export a generic function that is polymorphic in the mirror parameter,
because Symmetric and Hermitian Gramian are actually different functions.
-}
{- |
gramian A = A^T * A
-}
gramian ::
   (Layout.Packing pack) =>
   (Shape.C height, Shape.C width, Class.Floating a) =>
   General height width a -> SymmetricP pack width a
gramian :: General height width a -> SymmetricP pack width a
gramian = (PlainArray
   Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small width width a)
-> General height width a -> SymmetricP pack width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray
  Unpacked Arbitrary Filled Filled Size Big Big height width a
-> PlainArray
     pack Symmetric Filled Filled Shape Small Small width width a
forall pack mirror height width a.
(Packing pack, Mirror mirror, C height, C width, Floating a) =>
General height width a -> Mosaic pack mirror Upper width a
Symmetric.gramian

{- |
gramianTransposed A = A * A^T = gramian (A^T)
-}
gramianTransposed ::
   (Layout.Packing pack) =>
   (Shape.C height, Shape.C width, Class.Floating a) =>
   General height width a -> SymmetricP pack height a
gramianTransposed :: General height width a -> SymmetricP pack height a
gramianTransposed = (PlainArray
   Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small height height a)
-> General height width a -> SymmetricP pack height a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray
  Unpacked Arbitrary Filled Filled Size Big Big height width a
-> PlainArray
     pack Symmetric Filled Filled Shape Small Small height height a
forall pack mirror height width a.
(Packing pack, Mirror mirror, C height, C width, Floating a) =>
General height width a -> Mosaic pack mirror Upper height a
Symmetric.gramianTransposed

{- |
congruenceDiagonal D A = A^T * D * A
-}
congruenceDiagonal ::
   (Layout.Packing pack) =>
   (Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   Vector height a -> General height width a -> SymmetricP pack width a
congruenceDiagonal :: Vector height a
-> General height width a -> SymmetricP pack width a
congruenceDiagonal = (Array (Full Size Big Big height width) a
 -> Array (SymmetricP pack width) a)
-> General height width a -> SymmetricP pack width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 ((Array (Full Size Big Big height width) a
  -> Array (SymmetricP pack width) a)
 -> General height width a -> SymmetricP pack width a)
-> (Vector height a
    -> Array (Full Size Big Big height width) a
    -> Array (SymmetricP pack width) a)
-> Vector height a
-> General height width a
-> SymmetricP pack width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector height a
-> Array (Full Size Big Big height width) a
-> Array (SymmetricP pack width) a
forall pack height width a.
(Packing pack, C height, Eq height, C width, Floating a) =>
Vector height a
-> General height width a -> SymmetricP pack width a
Basic.congruenceDiagonal

{- |
congruenceDiagonalTransposed A D = A * D * A^T
-}
congruenceDiagonalTransposed ::
   (Layout.Packing pack) =>
   (Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   General height width a -> Vector width a -> SymmetricP pack height a
congruenceDiagonalTransposed :: General height width a
-> Vector width a -> SymmetricP pack height a
congruenceDiagonalTransposed General height width a
a =
   Array (SymmetricP pack height) a -> SymmetricP pack height a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (SymmetricP pack height) a -> SymmetricP pack height a)
-> (Vector width a -> Array (SymmetricP pack height) a)
-> Vector width a
-> SymmetricP pack height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. General height width a
-> Vector width a -> Array (SymmetricP pack height) a
forall pack height width a.
(Packing pack, C height, C width, Eq width, Floating a) =>
General height width a
-> Vector width a -> SymmetricP pack height a
Basic.congruenceDiagonalTransposed (General height width a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big height width a
forall pack property lower upper meas vert horiz height width a.
ToPlain pack property lower upper meas vert horiz height width =>
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> PlainArray
     pack property lower upper meas vert horiz height width a
ArrMatrix.toVector General height width a
a)

{- |
congruence B A = A^T * B * A
-}
congruence ::
   (Layout.Packing pack) =>
   (Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   SymmetricP pack height a -> General height width a -> SymmetricP pack width a
congruence :: SymmetricP pack height a
-> General height width a -> SymmetricP pack width a
congruence =
   (PlainArray
   pack Symmetric Filled Filled Shape Small Small height height a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small width width a)
-> SymmetricP pack height a
-> General height width a
-> SymmetricP pack width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB,
 FromPlain
   packC propC lowerC upperC measC vertC horizC heightC widthC) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b
 -> PlainArray
      packC propC lowerC upperC measC vertC horizC heightC widthC c)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
-> ArrayMatrix
     packC propC lowerC upperC measC vertC horizC heightC widthC c
ArrMatrix.lift2 ((PlainArray
    pack Symmetric Filled Filled Shape Small Small height height a
  -> PlainArray
       Unpacked Arbitrary Filled Filled Size Big Big height width a
  -> PlainArray
       pack Symmetric Filled Filled Shape Small Small width width a)
 -> SymmetricP pack height a
 -> General height width a
 -> SymmetricP pack width a)
-> (PlainArray
      pack Symmetric Filled Filled Shape Small Small height height a
    -> PlainArray
         Unpacked Arbitrary Filled Filled Size Big Big height width a
    -> PlainArray
         pack Symmetric Filled Filled Shape Small Small width width a)
-> SymmetricP pack height a
-> General height width a
-> SymmetricP pack width a
forall a b. (a -> b) -> a -> b
$ \PlainArray
  pack Symmetric Filled Filled Shape Small Small height height a
b -> Mosaic SimpleMirror Upper height a
-> General height width a -> Mosaic pack SimpleMirror Upper width a
forall pack mirror height width a.
(Packing pack, Mirror mirror, C height, Eq height, C width,
 Floating a) =>
Mosaic mirror Upper height a
-> General height width a -> Mosaic pack mirror Upper width a
Symmetric.congruence (Mosaic pack SimpleMirror Upper height a
-> Mosaic SimpleMirror Upper height a
forall uplo sh a pack mirror.
(UpLo uplo, C sh, Floating a) =>
Mosaic pack mirror uplo sh a -> MosaicUnpacked mirror uplo sh a
Mosaic.unpackDirty Mosaic pack SimpleMirror Upper height a
PlainArray
  pack Symmetric Filled Filled Shape Small Small height height a
b)

{- |
congruenceTransposed B A = A * B * A^T
-}
congruenceTransposed ::
   (Layout.Packing pack) =>
   (Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   General height width a -> SymmetricP pack width a -> SymmetricP pack height a
congruenceTransposed :: General height width a
-> SymmetricP pack width a -> SymmetricP pack height a
congruenceTransposed =
   (PlainArray
   Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small width width a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small height height a)
-> General height width a
-> SymmetricP pack width a
-> SymmetricP pack height a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB,
 FromPlain
   packC propC lowerC upperC measC vertC horizC heightC widthC) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b
 -> PlainArray
      packC propC lowerC upperC measC vertC horizC heightC widthC c)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
-> ArrayMatrix
     packC propC lowerC upperC measC vertC horizC heightC widthC c
ArrMatrix.lift2 ((PlainArray
    Unpacked Arbitrary Filled Filled Size Big Big height width a
  -> PlainArray
       pack Symmetric Filled Filled Shape Small Small width width a
  -> PlainArray
       pack Symmetric Filled Filled Shape Small Small height height a)
 -> General height width a
 -> SymmetricP pack width a
 -> SymmetricP pack height a)
-> (PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big height width a
    -> PlainArray
         pack Symmetric Filled Filled Shape Small Small width width a
    -> PlainArray
         pack Symmetric Filled Filled Shape Small Small height height a)
-> General height width a
-> SymmetricP pack width a
-> SymmetricP pack height a
forall a b. (a -> b) -> a -> b
$ \PlainArray
  Unpacked Arbitrary Filled Filled Size Big Big height width a
a ->
      General height width a
-> Mosaic SimpleMirror Upper width a
-> Mosaic pack SimpleMirror Upper height a
forall pack mirror height width a.
(Packing pack, Mirror mirror, C height, C width, Eq width,
 Floating a) =>
General height width a
-> Mosaic mirror Upper width a -> Mosaic pack mirror Upper height a
Symmetric.congruenceTransposed General height width a
PlainArray
  Unpacked Arbitrary Filled Filled Size Big Big height width a
a (Mosaic SimpleMirror Upper width a
 -> Mosaic pack SimpleMirror Upper height a)
-> (Mosaic pack SimpleMirror Upper width a
    -> Mosaic SimpleMirror Upper width a)
-> Mosaic pack SimpleMirror Upper width a
-> Mosaic pack SimpleMirror Upper height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mosaic pack SimpleMirror Upper width a
-> Mosaic SimpleMirror Upper width a
forall uplo sh a pack mirror.
(UpLo uplo, C sh, Floating a) =>
Mosaic pack mirror uplo sh a -> MosaicUnpacked mirror uplo sh a
Mosaic.unpackDirty


{- |
anticommutator A B  =  A^T * B + B^T * A

Not exactly a matrix anticommutator,
thus I like to call it Symmetric anticommutator.
-}
anticommutator ::
   (Layout.Packing pack,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Eq width,
    Class.Floating a) =>
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a -> SymmetricP pack width a
anticommutator :: Full meas vert horiz height width a
-> Full meas vert horiz height width a -> SymmetricP pack width a
anticommutator =
   (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small width width a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
-> SymmetricP pack width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB,
 FromPlain
   packC propC lowerC upperC measC vertC horizC heightC widthC) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b
 -> PlainArray
      packC propC lowerC upperC measC vertC horizC heightC widthC c)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
-> ArrayMatrix
     packC propC lowerC upperC measC vertC horizC heightC widthC c
ArrMatrix.lift2 ((PlainArray
    Unpacked Arbitrary Filled Filled meas vert horiz height width a
  -> PlainArray
       Unpacked Arbitrary Filled Filled meas vert horiz height width a
  -> PlainArray
       pack Symmetric Filled Filled Shape Small Small width width a)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a
 -> SymmetricP pack width a)
-> (PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
    -> PlainArray
         Unpacked Arbitrary Filled Filled meas vert horiz height width a
    -> PlainArray
         pack Symmetric Filled Filled Shape Small Small width width a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
-> SymmetricP pack width a
forall a b. (a -> b) -> a -> b
$
      MirrorSingleton SimpleMirror
-> a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
-> Mosaic pack SimpleMirror Upper width a
forall pack mirror meas vert horiz height width a.
(Packing pack, Mirror mirror, Measure meas, C vert, C horiz,
 C height, Eq height, C width, Eq width, Floating a) =>
MirrorSingleton mirror
-> a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
-> Mosaic pack mirror Upper width a
Symmetric.scaledAnticommutator MirrorSingleton SimpleMirror
Layout.SimpleMirror a
forall a. Floating a => a
one

{- |
anticommutatorTransposed A B
   = A * B^T + B * A^T
   = anticommutator (transpose A) (transpose B)
-}
anticommutatorTransposed ::
   (Layout.Packing pack,
    Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Eq width,
    Class.Floating a) =>
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a -> SymmetricP pack height a
anticommutatorTransposed :: Full meas vert horiz height width a
-> Full meas vert horiz height width a -> SymmetricP pack height a
anticommutatorTransposed =
   (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small height height a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
-> SymmetricP pack height a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB,
 FromPlain
   packC propC lowerC upperC measC vertC horizC heightC widthC) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b
 -> PlainArray
      packC propC lowerC upperC measC vertC horizC heightC widthC c)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
-> ArrayMatrix
     packC propC lowerC upperC measC vertC horizC heightC widthC c
ArrMatrix.lift2 ((PlainArray
    Unpacked Arbitrary Filled Filled meas vert horiz height width a
  -> PlainArray
       Unpacked Arbitrary Filled Filled meas vert horiz height width a
  -> PlainArray
       pack Symmetric Filled Filled Shape Small Small height height a)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a
 -> SymmetricP pack height a)
-> (PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
    -> PlainArray
         Unpacked Arbitrary Filled Filled meas vert horiz height width a
    -> PlainArray
         pack Symmetric Filled Filled Shape Small Small height height a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
-> SymmetricP pack height a
forall a b. (a -> b) -> a -> b
$
      MirrorSingleton SimpleMirror
-> a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
-> Mosaic pack SimpleMirror Upper height a
forall pack mirror meas vert horiz height width a.
(Packing pack, Mirror mirror, Measure meas, C vert, C horiz,
 C height, Eq height, C width, Eq width, Floating a) =>
MirrorSingleton mirror
-> a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
-> Mosaic pack mirror Upper height a
Symmetric.scaledAnticommutatorTransposed MirrorSingleton SimpleMirror
Layout.SimpleMirror a
forall a. Floating a => a
one


{- |
addTransposed A = A^T + A
-}
addTransposed ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   Square sh a -> SymmetricP pack sh a
addTransposed :: Square sh a -> SymmetricP pack sh a
addTransposed Square sh a
a =
   let pck :: PackingSingleton pack
pck = PackingSingleton pack
forall pack. Packing pack => PackingSingleton pack
Layout.autoPacking
   in PackingSingleton pack -> Id (SymmetricP pack sh a)
forall pack property lower upper meas vert horiz height width a.
PackingSingleton pack
-> Id
     (ArrayMatrix
        pack property lower upper meas vert horiz height width a)
ArrMatrix.requirePacking PackingSingleton pack
pck Id (SymmetricP pack sh a) -> Id (SymmetricP pack sh a)
forall a b. (a -> b) -> a -> b
$
      case PackingSingleton pack
pck of
         PackingSingleton pack
Layout.Packed -> (PlainArray
   Unpacked Arbitrary Filled Filled Shape Small Small sh sh a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh sh a)
-> Square sh a -> SymmetricP pack sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray
  Unpacked Arbitrary Filled Filled Shape Small Small sh sh a
-> PlainArray
     pack Symmetric Filled Filled Shape Small Small sh sh a
forall mirror sh a.
(Mirror mirror, C sh, Floating a) =>
Square sh a -> Mosaic mirror Upper sh a
Symmetric.addMirrored Square sh a
a
         PackingSingleton pack
Layout.Unpacked ->
            (FullArray Shape Small Small (Unchecked sh) (Unchecked sh) a
 -> FullArray Shape Small Small sh sh a)
-> UnpackedMatrix
     Arbitrary
     Filled
     Filled
     Shape
     Small
     Small
     (Unchecked sh)
     (Unchecked sh)
     a
-> UnpackedMatrix Symmetric Filled Filled Shape Small Small sh sh a
forall propertyA lowerA upperA propertyB lowerB upperB measA vertA
       horizA heightA widthA a measB vertB horizB heightB widthB b.
(Property propertyA, Strip lowerA, Strip upperA,
 Property propertyB, Strip lowerB, Strip upperB) =>
(FullArray measA vertA horizA heightA widthA a
 -> FullArray measB vertB horizB heightB widthB b)
-> UnpackedMatrix
     propertyA lowerA upperA measA vertA horizA heightA widthA a
-> UnpackedMatrix
     propertyB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.liftUnpacked1 FullArray Shape Small Small (Unchecked sh) (Unchecked sh) a
-> FullArray Shape Small Small sh sh a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz (Unchecked height) (Unchecked width) a
-> Full meas vert horiz height width a
FullBasic.recheck (UnpackedMatrix
   Arbitrary
   Filled
   Filled
   Shape
   Small
   Small
   (Unchecked sh)
   (Unchecked sh)
   a
 -> UnpackedMatrix
      Symmetric Filled Filled Shape Small Small sh sh a)
-> UnpackedMatrix
     Arbitrary
     Filled
     Filled
     Shape
     Small
     Small
     (Unchecked sh)
     (Unchecked sh)
     a
-> UnpackedMatrix Symmetric Filled Filled Shape Small Small sh sh a
forall a b. (a -> b) -> a -> b
$
               let au :: UnpackedMatrix
  Arbitrary
  Filled
  Filled
  Shape
  Small
  Small
  (Unchecked sh)
  (Unchecked sh)
  a
au = Square sh a
-> UnpackedMatrix
     Arbitrary
     Filled
     Filled
     Shape
     Small
     Small
     (Unchecked sh)
     (Unchecked sh)
     a
forall property lower upper meas vert horiz height width a.
(Property property, Strip lower, Strip upper, Measure meas, C vert,
 C horiz) =>
Unpacked property lower upper meas vert horiz height width a
-> Unpacked
     property
     lower
     upper
     meas
     vert
     horiz
     (Unchecked height)
     (Unchecked width)
     a
ArrUnpacked.uncheck Square sh a
a
               in UnpackedMatrix
  Arbitrary
  Filled
  Filled
  Shape
  Small
  Small
  (Unchecked sh)
  (Unchecked sh)
  a
-> UnpackedMatrix
     Arbitrary
     Filled
     Filled
     Shape
     Small
     Small
     (Unchecked sh)
     (Unchecked sh)
     a
-> UnpackedMatrix
     Arbitrary
     Filled
     Filled
     Shape
     Small
     Small
     (Unchecked sh)
     (Unchecked sh)
     a
forall meas vert horiz property height width a pack lower upper.
(Measure meas, C vert, C horiz, Additive property, C height,
 Eq height, C width, Eq width, Floating a) =>
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> ArrayMatrix
     pack property lower upper meas vert horiz height width a
-> ArrayMatrix
     pack property lower upper meas vert horiz height width a
ArrMatrix.add (UnpackedMatrix
  Arbitrary
  Filled
  Filled
  Shape
  Small
  Small
  (Unchecked sh)
  (Unchecked sh)
  a
-> UnpackedMatrix
     Arbitrary
     Filled
     Filled
     Shape
     Small
     Small
     (Unchecked sh)
     (Unchecked sh)
     a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a
-> Full meas horiz vert width height a
Full.transpose UnpackedMatrix
  Arbitrary
  Filled
  Filled
  Shape
  Small
  Small
  (Unchecked sh)
  (Unchecked sh)
  a
au) UnpackedMatrix
  Arbitrary
  Filled
  Filled
  Shape
  Small
  Small
  (Unchecked sh)
  (Unchecked sh)
  a
au



solve ::
   (Layout.Packing pack) =>
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C sh, Eq sh, Shape.C nrhs, Class.Floating a) =>
   SymmetricP pack sh a ->
   Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a
solve :: SymmetricP pack sh a
-> Full meas vert horiz sh nrhs a -> Full meas vert horiz sh nrhs a
solve = (PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz sh nrhs a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz sh nrhs a)
-> SymmetricP pack sh a
-> Full meas vert horiz sh nrhs a
-> Full meas vert horiz sh nrhs a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB packC
       propC lowerC upperC measC vertC horizC heightC widthC a b c.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB,
 FromPlain
   packC propC lowerC upperC measC vertC horizC heightC widthC) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b
 -> PlainArray
      packC propC lowerC upperC measC vertC horizC heightC widthC c)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
-> ArrayMatrix
     packC propC lowerC upperC measC vertC horizC heightC widthC c
ArrMatrix.lift2 PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz sh nrhs a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz sh nrhs a
forall mirror meas vert horiz height width a pack.
(Mirror mirror, Measure meas, C vert, C horiz, Eq height, C height,
 C width, Floating a) =>
Mosaic pack mirror Upper height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Symmetric.solve

inverse ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   SymmetricP pack sh a -> SymmetricP pack sh a
inverse :: SymmetricP pack sh a -> SymmetricP pack sh a
inverse = (PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
 -> PlainArray
      pack Symmetric Filled Filled Shape Small Small sh sh a)
-> SymmetricP pack sh a -> SymmetricP pack sh a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray pack Symmetric Filled Filled Shape Small Small sh sh a
-> PlainArray
     pack Symmetric Filled Filled Shape Small Small sh sh a
forall mirror uplo sh a pack.
(Mirror mirror, UpLo uplo, C sh, Floating a) =>
Mosaic pack mirror uplo sh a -> Mosaic pack mirror uplo sh a
Symmetric.inverse

determinant ::
   (Layout.Packing pack, Shape.C sh, Class.Floating a) =>
   SymmetricP pack sh a -> a
determinant :: SymmetricP pack sh a -> a
determinant = SymmetricP pack sh a -> a
forall pack sh a.
(Packing pack, C sh, Floating a) =>
SymmetricP pack sh a -> a
Linear.determinant (SymmetricP pack sh a -> a)
-> (SymmetricP pack sh a -> SymmetricP pack sh a)
-> SymmetricP pack sh a
-> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SymmetricP pack sh a -> SymmetricP pack sh a
forall pack property lower upper meas vert horiz height width a.
ToPlain pack property lower upper meas vert horiz height width =>
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> PlainArray
     pack property lower upper meas vert horiz height width a
ArrMatrix.toVector