{-# LANGUAGE TypeFamilies #-}
module Numeric.LAPACK.Singular (
   values,
   valuesTall,
   valuesWide,
   decompose,
   decomposeTall,
   decomposeWide,
   determinantAbsolute,
   leastSquaresMinimumNormRCond,
   pseudoInverseRCond,
   decomposePolar,
   RealOf,
   ) where

import qualified Numeric.LAPACK.Singular.Plain as Plain

import qualified Numeric.LAPACK.Matrix.Hermitian as Hermitian
import qualified Numeric.LAPACK.Matrix.Mosaic.Private as Mos
import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix
import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent
import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni
import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout
import qualified Numeric.LAPACK.Matrix.Basic as Basic
import qualified Numeric.LAPACK.Matrix as Matrix
import Numeric.LAPACK.Matrix.Array.Banded (RectangularDiagonal)
import Numeric.LAPACK.Matrix.Array.Private (ArrayMatrix, Full, General, Square)
import Numeric.LAPACK.Matrix.Multiply ((##*#), (#*##))
import Numeric.LAPACK.Vector (Vector)
import Numeric.LAPACK.Scalar (RealOf)

import qualified Numeric.Netlib.Class as Class

import qualified Data.Array.Comfort.Shape as Shape

import Data.Tuple.HT (mapFst, mapSnd, mapPair, mapSnd3, mapTriple)


type RealVector sh a = Vector sh (RealOf a)

values ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   (Shape.C height, Shape.C width, Class.Floating a) =>
   Full meas vert horiz height width a ->
   RectangularDiagonal meas vert horiz height width (RealOf a)
values :: Full meas vert horiz height width a
-> RectangularDiagonal meas vert horiz height width (RealOf a)
values = (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Packed
      Arbitrary
      (Bands U0)
      (Bands U0)
      meas
      vert
      horiz
      height
      width
      (RealOf a))
-> Full meas vert horiz height width a
-> RectangularDiagonal meas vert horiz height width (RealOf 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 meas vert horiz height width a
-> PlainArray
     Packed
     Arbitrary
     (Bands U0)
     (Bands U0)
     meas
     vert
     horiz
     height
     width
     (RealOf a)
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width, Floating a) =>
Full meas vert horiz height width a
-> RectangularRealDiagonal meas vert horiz height width a
Plain.values

valuesTall ::
   (Extent.Measure meas, Extent.C vert,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full meas vert Extent.Small height width a -> RealVector width a
valuesTall :: Full meas vert Small height width a -> RealVector width a
valuesTall = Full meas vert Small height width a -> RealVector width a
forall meas vert height width a.
(Measure meas, C vert, C height, C width, Floating a) =>
Full meas vert Small height width a -> RealVector width a
Plain.valuesTall (Full meas vert Small height width a -> RealVector width a)
-> (Full meas vert Small height width a
    -> Full meas vert Small height width a)
-> Full meas vert Small height width a
-> RealVector width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full meas vert Small height width a
-> Full meas vert Small 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

valuesWide ::
   (Extent.Measure meas, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full meas Extent.Small horiz height width a -> RealVector height a
valuesWide :: Full meas Small horiz height width a -> RealVector height a
valuesWide = Full meas Small horiz height width a -> RealVector height a
forall meas horiz height width a.
(Measure meas, C horiz, C height, C width, Floating a) =>
Full meas Small horiz height width a -> RealVector height a
Plain.valuesWide (Full meas Small horiz height width a -> RealVector height a)
-> (Full meas Small horiz height width a
    -> Full meas Small horiz height width a)
-> Full meas Small horiz height width a
-> RealVector height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full meas Small horiz height width a
-> Full meas Small horiz height width a
forall pack property lower upper meas vert horiz height width a.
ToPlain pack property lower upper meas vert horiz height width =>
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> PlainArray
     pack property lower upper meas vert horiz height width a
ArrMatrix.toVector


determinantAbsolute ::
   (Shape.C height, Shape.C width, Class.Floating a) =>
   General height width a -> RealOf a
determinantAbsolute :: General height width a -> RealOf a
determinantAbsolute = General height width a -> RealOf a
forall height width a.
(C height, C width, Floating a) =>
General height width a -> RealOf a
Plain.determinantAbsolute (General height width a -> RealOf a)
-> (General height width a -> General height width a)
-> General height width a
-> RealOf a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. General height width a -> General 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


decompose ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   (Shape.C height, Shape.C width, Class.Floating a) =>
   Full meas vert horiz height width a ->
   (Square height a,
    RectangularDiagonal meas vert horiz height width (RealOf a),
    Square width a)
decompose :: Full meas vert horiz height width a
-> (Square height a,
    RectangularDiagonal meas vert horiz height width (RealOf a),
    Square width a)
decompose = (Array (Banded U0 U0 meas vert horiz height width) (RealOf a)
 -> RectangularDiagonal meas vert horiz height width (RealOf a))
-> (Square height a,
    Array (Banded U0 U0 meas vert horiz height width) (RealOf a),
    Square width a)
-> (Square height a,
    RectangularDiagonal meas vert horiz height width (RealOf a),
    Square width a)
forall b d a c. (b -> d) -> (a, b, c) -> (a, d, c)
mapSnd3 Array (Banded U0 U0 meas vert horiz height width) (RealOf a)
-> RectangularDiagonal meas vert horiz height width (RealOf 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 ((Square height a,
  Array (Banded U0 U0 meas vert horiz height width) (RealOf a),
  Square width a)
 -> (Square height a,
     RectangularDiagonal meas vert horiz height width (RealOf a),
     Square width a))
-> (Full meas vert horiz height width a
    -> (Square height a,
        Array (Banded U0 U0 meas vert horiz height width) (RealOf a),
        Square width a))
-> Full meas vert horiz height width a
-> (Square height a,
    RectangularDiagonal meas vert horiz height width (RealOf a),
    Square width a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FullArray meas vert horiz height width a
 -> (FullArray Shape Small Small height height a,
     Array (Banded U0 U0 meas vert horiz height width) (RealOf a),
     FullArray Shape Small Small width width a))
-> Full meas vert horiz height width a
-> (Square height a,
    Array (Banded U0 U0 meas vert horiz height width) (RealOf a),
    Square width a)
forall measA vertA horizA heightA widthA a measB vertB horizB
       heightB widthB b f measC vertC horizC heightC widthC c.
(FullArray measA vertA horizA heightA widthA a
 -> (FullArray measB vertB horizB heightB widthB b, f,
     FullArray measC vertC horizC heightC widthC c))
-> FullMatrix measA vertA horizA heightA widthA a
-> (FullMatrix measB vertB horizB heightB widthB b, f,
    FullMatrix measC vertC horizC heightC widthC c)
liftDecompose FullArray meas vert horiz height width a
-> (FullArray Shape Small Small height height a,
    Array (Banded U0 U0 meas vert horiz height width) (RealOf a),
    FullArray Shape Small Small width width a)
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width, Floating a) =>
Full meas vert horiz height width a
-> (Square height a,
    RectangularRealDiagonal meas vert horiz height width a,
    Square width a)
Plain.decompose

{- |
> let (u,s,vt) = Singular.decomposeWide a
> in a  ==  u #*## Matrix.scaleRowsReal s vt
-}
decomposeWide ::
   (Extent.Measure meas, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full meas Extent.Small horiz height width a ->
   (Square height a, RealVector height a,
      Full meas Extent.Small horiz height width a)
decomposeWide :: Full meas Small horiz height width a
-> (Square height a, RealVector height a,
    Full meas Small horiz height width a)
decomposeWide = (FullArray meas Small horiz height width a
 -> (FullArray Shape Small Small height height a,
     RealVector height a, FullArray meas Small horiz height width a))
-> Full meas Small horiz height width a
-> (Square height a, RealVector height a,
    Full meas Small horiz height width a)
forall measA vertA horizA heightA widthA a measB vertB horizB
       heightB widthB b f measC vertC horizC heightC widthC c.
(FullArray measA vertA horizA heightA widthA a
 -> (FullArray measB vertB horizB heightB widthB b, f,
     FullArray measC vertC horizC heightC widthC c))
-> FullMatrix measA vertA horizA heightA widthA a
-> (FullMatrix measB vertB horizB heightB widthB b, f,
    FullMatrix measC vertC horizC heightC widthC c)
liftDecompose FullArray meas Small horiz height width a
-> (FullArray Shape Small Small height height a,
    RealVector height a, FullArray meas Small horiz height width a)
forall meas horiz height width a.
(Measure meas, C horiz, C height, C width, Floating a) =>
Full meas Small horiz height width a
-> (Square height a, RealVector height a,
    Full meas Small horiz height width a)
Plain.decomposeWide

{- |
> let (u,s,vt) = Singular.decomposeTall a
> in a  ==  u ##*# Matrix.scaleRowsReal s vt
-}
decomposeTall ::
   (Extent.Measure meas, Extent.C vert,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full meas vert Extent.Small height width a ->
   (Full meas vert Extent.Small height width a,
      RealVector width a, Square width a)
decomposeTall :: Full meas vert Small height width a
-> (Full meas vert Small height width a, RealVector width a,
    Square width a)
decomposeTall = (FullArray meas vert Small height width a
 -> (FullArray meas vert Small height width a, RealVector width a,
     FullArray Shape Small Small width width a))
-> Full meas vert Small height width a
-> (Full meas vert Small height width a, RealVector width a,
    Square width a)
forall measA vertA horizA heightA widthA a measB vertB horizB
       heightB widthB b f measC vertC horizC heightC widthC c.
(FullArray measA vertA horizA heightA widthA a
 -> (FullArray measB vertB horizB heightB widthB b, f,
     FullArray measC vertC horizC heightC widthC c))
-> FullMatrix measA vertA horizA heightA widthA a
-> (FullMatrix measB vertB horizB heightB widthB b, f,
    FullMatrix measC vertC horizC heightC widthC c)
liftDecompose FullArray meas vert Small height width a
-> (FullArray meas vert Small height width a, RealVector width a,
    FullArray Shape Small Small width width a)
forall meas vert height width a.
(Measure meas, C vert, C height, C width, Floating a) =>
Full meas vert Small height width a
-> (Full meas vert Small height width a, RealVector width a,
    Square width a)
Plain.decomposeTall


type FullArray meas vert horiz height width =
         ArrMatrix.PlainArray Layout.Unpacked Omni.Arbitrary
            Layout.Filled Layout.Filled
            meas vert horiz height width
type FullMatrix meas vert horiz height width =
         ArrayMatrix Layout.Unpacked Omni.Arbitrary
            Layout.Filled Layout.Filled
            meas vert horiz height width

liftDecompose ::
   (FullArray measA vertA horizA heightA widthA a ->
    (FullArray measB vertB horizB heightB widthB b, f,
     FullArray measC vertC horizC heightC widthC c)) ->
   FullMatrix measA vertA horizA heightA widthA a ->
    (FullMatrix measB vertB horizB heightB widthB b, f,
     FullMatrix measC vertC horizC heightC widthC c)
liftDecompose :: (FullArray measA vertA horizA heightA widthA a
 -> (FullArray measB vertB horizB heightB widthB b, f,
     FullArray measC vertC horizC heightC widthC c))
-> FullMatrix measA vertA horizA heightA widthA a
-> (FullMatrix measB vertB horizB heightB widthB b, f,
    FullMatrix measC vertC horizC heightC widthC c)
liftDecompose FullArray measA vertA horizA heightA widthA a
-> (FullArray measB vertB horizB heightB widthB b, f,
    FullArray measC vertC horizC heightC widthC c)
f =
   (Array (Full measB vertB horizB heightB widthB) b
 -> FullMatrix measB vertB horizB heightB widthB b,
 f -> f,
 Array (Full measC vertC horizC heightC widthC) c
 -> FullMatrix measC vertC horizC heightC widthC c)
-> (Array (Full measB vertB horizB heightB widthB) b, f,
    Array (Full measC vertC horizC heightC widthC) c)
-> (FullMatrix measB vertB horizB heightB widthB b, f,
    FullMatrix measC vertC horizC heightC widthC c)
forall a d b e c f.
(a -> d, b -> e, c -> f) -> (a, b, c) -> (d, e, f)
mapTriple (Array (Full measB vertB horizB heightB widthB) b
-> FullMatrix measB vertB horizB heightB widthB b
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, f -> f
forall a. a -> a
id, Array (Full measC vertC horizC heightC widthC) c
-> FullMatrix measC vertC horizC heightC widthC c
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 (Full measB vertB horizB heightB widthB) b, f,
  Array (Full measC vertC horizC heightC widthC) c)
 -> (FullMatrix measB vertB horizB heightB widthB b, f,
     FullMatrix measC vertC horizC heightC widthC c))
-> (FullMatrix measA vertA horizA heightA widthA a
    -> (Array (Full measB vertB horizB heightB widthB) b, f,
        Array (Full measC vertC horizC heightC widthC) c))
-> FullMatrix measA vertA horizA heightA widthA a
-> (FullMatrix measB vertB horizB heightB widthB b, f,
    FullMatrix measC vertC horizC heightC widthC c)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array (Full measA vertA horizA heightA widthA) a
-> (Array (Full measB vertB horizB heightB widthB) b, f,
    Array (Full measC vertC horizC heightC widthC) c)
FullArray measA vertA horizA heightA widthA a
-> (FullArray measB vertB horizB heightB widthB b, f,
    FullArray measC vertC horizC heightC widthC c)
f (Array (Full measA vertA horizA heightA widthA) a
 -> (Array (Full measB vertB horizB heightB widthB) b, f,
     Array (Full measC vertC horizC heightC widthC) c))
-> (FullMatrix measA vertA horizA heightA widthA a
    -> Array (Full measA vertA horizA heightA widthA) a)
-> FullMatrix measA vertA horizA heightA widthA a
-> (Array (Full measB vertB horizB heightB widthB) b, f,
    Array (Full measC vertC horizC heightC widthC) c)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FullMatrix measA vertA horizA heightA widthA a
-> Array (Full measA vertA horizA heightA widthA) 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



leastSquaresMinimumNormRCond ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Shape.C nrhs, Class.Floating a) =>
   RealOf a ->
   Full meas horiz vert height width a ->
   Full meas vert horiz height nrhs a ->
   (Int, Full meas vert horiz width nrhs a)
leastSquaresMinimumNormRCond :: RealOf a
-> Full meas horiz vert height width a
-> Full meas vert horiz height nrhs a
-> (Int, Full meas vert horiz width nrhs a)
leastSquaresMinimumNormRCond RealOf a
rcond Full meas horiz vert height width a
a Full meas vert horiz height nrhs a
b =
   (Full meas vert horiz width nrhs a
 -> Full meas vert horiz width nrhs a)
-> (Int, Full meas vert horiz width nrhs a)
-> (Int, Full meas vert horiz width nrhs a)
forall b c a. (b -> c) -> (a, b) -> (a, c)
mapSnd Full meas vert horiz width nrhs a
-> Full meas vert horiz width nrhs 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 ((Int, Full meas vert horiz width nrhs a)
 -> (Int, Full meas vert horiz width nrhs a))
-> (Int, Full meas vert horiz width nrhs a)
-> (Int, Full meas vert horiz width nrhs a)
forall a b. (a -> b) -> a -> b
$
   RealOf a
-> Full meas horiz vert height width a
-> Full meas vert horiz height nrhs a
-> (Int, Full meas vert horiz width nrhs a)
forall meas vert horiz height width nrhs a.
(Measure meas, C vert, C horiz, C height, Eq height, C width,
 C nrhs, Floating a) =>
RealOf a
-> Full meas horiz vert height width a
-> Full meas vert horiz height nrhs a
-> (Int, Full meas vert horiz width nrhs a)
Plain.leastSquaresMinimumNormRCond
      RealOf a
rcond (Full meas horiz vert height width a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas horiz vert 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 Full meas horiz vert height width a
a) (Full meas vert horiz height nrhs a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz height nrhs 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 Full meas vert horiz height nrhs a
b)

pseudoInverseRCond ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   RealOf a ->
   Full meas vert horiz height width a ->
   (Int, Full meas horiz vert width height a)
pseudoInverseRCond :: RealOf a
-> Full meas vert horiz height width a
-> (Int, Full meas horiz vert width height a)
pseudoInverseRCond RealOf a
rcond =
   (Full meas horiz vert (Unchecked width) (Unchecked height) a
 -> Full meas horiz vert width height a)
-> (Int,
    Full meas horiz vert (Unchecked width) (Unchecked height) a)
-> (Int, Full meas horiz vert width height a)
forall b c a. (b -> c) -> (a, b) -> (a, c)
mapSnd (Array (Full meas horiz vert width height) a
-> Full meas horiz vert width 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 (Full meas horiz vert width height) a
 -> Full meas horiz vert width height a)
-> (Full meas horiz vert (Unchecked width) (Unchecked height) a
    -> Array (Full meas horiz vert width height) a)
-> Full meas horiz vert (Unchecked width) (Unchecked height) a
-> Full meas horiz vert width height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full meas horiz vert (Unchecked width) (Unchecked height) a
-> Array (Full meas horiz vert width height) 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
Basic.recheck) ((Int, Full meas horiz vert (Unchecked width) (Unchecked height) a)
 -> (Int, Full meas horiz vert width height a))
-> (Full meas vert horiz height width a
    -> (Int,
        Full meas horiz vert (Unchecked width) (Unchecked height) a))
-> Full meas vert horiz height width a
-> (Int, Full meas horiz vert width height a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
   RealOf a
-> Full meas vert horiz (Unchecked height) (Unchecked width) a
-> (Int,
    Full meas horiz vert (Unchecked width) (Unchecked height) a)
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, Eq height, C width,
 Eq width, Floating a) =>
RealOf a
-> Full meas vert horiz height width a
-> (Int, Full meas horiz vert width height a)
Plain.pseudoInverseRCond RealOf a
rcond (Full meas vert horiz (Unchecked height) (Unchecked width) a
 -> (Int,
     Full meas horiz vert (Unchecked width) (Unchecked height) a))
-> (Full meas vert horiz height width a
    -> Full meas vert horiz (Unchecked height) (Unchecked width) a)
-> Full meas vert horiz height width a
-> (Int,
    Full meas horiz vert (Unchecked width) (Unchecked height) a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
   Full meas vert horiz height width a
-> Full meas vert horiz (Unchecked height) (Unchecked width) a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a
-> Full meas vert horiz (Unchecked height) (Unchecked width) a
Basic.uncheck (Full meas vert horiz height width a
 -> Full meas vert horiz (Unchecked height) (Unchecked width) a)
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Full meas vert horiz (Unchecked height) (Unchecked width) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall pack property lower upper meas vert horiz height width a.
ToPlain pack property lower upper meas vert horiz height width =>
ArrayMatrix
  pack property lower upper meas vert horiz height width a
-> PlainArray
     pack property lower upper meas vert horiz height width a
ArrMatrix.toVector



{- |
In @decomposePolar a = (u,h)@,
@u@ is the orthogonal matrix closest to @a@
with respect to the 2- and the Frobenius norm.
(Higham: Functions of Matrices - Theory and Computation.)
-}
decomposePolar ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full meas vert horiz height width a ->
   (Full meas vert horiz height width a, Matrix.Hermitian width a)
decomposePolar :: Full meas vert horiz height width a
-> (Full meas vert horiz height width a, Hermitian width a)
decomposePolar =
   (ArrayMatrix
   Unpacked
   Arbitrary
   Filled
   Filled
   meas
   vert
   horiz
   (Unchecked height)
   (Unchecked width)
   a
 -> Full meas vert horiz height width a,
 ArrayMatrix
   Packed
   HermitianUnknownDefiniteness
   Filled
   Filled
   Shape
   Small
   Small
   (Unchecked width)
   (Unchecked width)
   a
 -> Hermitian width a)
-> (ArrayMatrix
      Unpacked
      Arbitrary
      Filled
      Filled
      meas
      vert
      horiz
      (Unchecked height)
      (Unchecked width)
      a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
-> (Full meas vert horiz height width a, Hermitian width a)
forall a c b d. (a -> c, b -> d) -> (a, b) -> (c, d)
mapPair
      ((PlainArray
   Unpacked
   Arbitrary
   Filled
   Filled
   meas
   vert
   horiz
   (Unchecked height)
   (Unchecked width)
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a)
-> ArrayMatrix
     Unpacked
     Arbitrary
     Filled
     Filled
     meas
     vert
     horiz
     (Unchecked height)
     (Unchecked width)
     a
-> Full meas vert horiz height width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray
  Unpacked
  Arbitrary
  Filled
  Filled
  meas
  vert
  horiz
  (Unchecked height)
  (Unchecked width)
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz height width 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
Basic.recheck,
       (PlainArray
   Packed
   HermitianUnknownDefiniteness
   Filled
   Filled
   Shape
   Small
   Small
   (Unchecked width)
   (Unchecked width)
   a
 -> PlainArray
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      width
      width
      a)
-> ArrayMatrix
     Packed
     HermitianUnknownDefiniteness
     Filled
     Filled
     Shape
     Small
     Small
     (Unchecked width)
     (Unchecked width)
     a
-> Hermitian width a
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(ToPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 FromPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(PlainArray
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> PlainArray
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> ArrayMatrix
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> ArrayMatrix
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.lift1 PlainArray
  Packed
  HermitianUnknownDefiniteness
  Filled
  Filled
  Shape
  Small
  Small
  (Unchecked width)
  (Unchecked width)
  a
-> PlainArray
     Packed
     HermitianUnknownDefiniteness
     Filled
     Filled
     Shape
     Small
     Small
     width
     width
     a
forall pack mirror uplo sh a.
Mosaic pack mirror uplo (Unchecked sh) a
-> Mosaic pack mirror uplo sh a
Mos.recheck)
   ((ArrayMatrix
    Unpacked
    Arbitrary
    Filled
    Filled
    meas
    vert
    horiz
    (Unchecked height)
    (Unchecked width)
    a,
  ArrayMatrix
    Packed
    HermitianUnknownDefiniteness
    Filled
    Filled
    Shape
    Small
    Small
    (Unchecked width)
    (Unchecked width)
    a)
 -> (Full meas vert horiz height width a, Hermitian width a))
-> (Full meas vert horiz height width a
    -> (ArrayMatrix
          Unpacked
          Arbitrary
          Filled
          Filled
          meas
          vert
          horiz
          (Unchecked height)
          (Unchecked width)
          a,
        ArrayMatrix
          Packed
          HermitianUnknownDefiniteness
          Filled
          Filled
          Shape
          Small
          Small
          (Unchecked width)
          (Unchecked width)
          a))
-> Full meas vert horiz height width a
-> (Full meas vert horiz height width a, Hermitian width a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
   DecomposePolar
  (Unchecked height) (Unchecked width) a meas vert horiz
-> ArrayMatrix
     Unpacked
     Arbitrary
     Filled
     Filled
     meas
     vert
     horiz
     (Unchecked height)
     (Unchecked width)
     a
-> (ArrayMatrix
      Unpacked
      Arbitrary
      Filled
      Filled
      meas
      vert
      horiz
      (Unchecked height)
      (Unchecked width)
      a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall height width a meas vert horiz.
DecomposePolar height width a meas vert horiz
-> Full meas vert horiz height width a
-> (Full meas vert horiz height width a, Hermitian width a)
getDecomposePolar
      (DecomposePolar
  (Unchecked height) (Unchecked width) a Shape Small Small
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Small Small
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Small Big
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Big Small
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Big Big
-> DecomposePolar
     (Unchecked height) (Unchecked width) a meas vert horiz
forall meas vert horiz (f :: * -> * -> * -> *).
(Measure meas, C vert, C horiz) =>
f Shape Small Small
-> f Size Small Small
-> f Size Small Big
-> f Size Big Small
-> f Size Big Big
-> f meas vert horiz
Extent.switchTagTriple
         ((Full Shape Small Small (Unchecked height) (Unchecked width) a
 -> (Full Shape Small Small (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Shape Small Small
forall height width a meas vert horiz.
(Full meas vert horiz height width a
 -> (Full meas vert horiz height width a, Hermitian width a))
-> DecomposePolar height width a meas vert horiz
DecomposePolar Full Shape Small Small (Unchecked height) (Unchecked width) a
-> (Full Shape Small Small (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall meas horiz height width a.
(Measure meas, C horiz, C height, Eq height, C width, Eq width,
 Floating a) =>
Full meas Small horiz height width a
-> (Full meas Small horiz height width a, Hermitian width a)
decomposePolarWide)
         ((Full Size Small Small (Unchecked height) (Unchecked width) a
 -> (Full Size Small Small (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Small Small
forall height width a meas vert horiz.
(Full meas vert horiz height width a
 -> (Full meas vert horiz height width a, Hermitian width a))
-> DecomposePolar height width a meas vert horiz
DecomposePolar Full Size Small Small (Unchecked height) (Unchecked width) a
-> (Full Size Small Small (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall meas horiz height width a.
(Measure meas, C horiz, C height, Eq height, C width, Eq width,
 Floating a) =>
Full meas Small horiz height width a
-> (Full meas Small horiz height width a, Hermitian width a)
decomposePolarWide)
         ((Full Size Small Big (Unchecked height) (Unchecked width) a
 -> (Full Size Small Big (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Small Big
forall height width a meas vert horiz.
(Full meas vert horiz height width a
 -> (Full meas vert horiz height width a, Hermitian width a))
-> DecomposePolar height width a meas vert horiz
DecomposePolar Full Size Small Big (Unchecked height) (Unchecked width) a
-> (Full Size Small Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall meas horiz height width a.
(Measure meas, C horiz, C height, Eq height, C width, Eq width,
 Floating a) =>
Full meas Small horiz height width a
-> (Full meas Small horiz height width a, Hermitian width a)
decomposePolarWide)
         ((Full Size Big Small (Unchecked height) (Unchecked width) a
 -> (Full Size Big Small (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Big Small
forall height width a meas vert horiz.
(Full meas vert horiz height width a
 -> (Full meas vert horiz height width a, Hermitian width a))
-> DecomposePolar height width a meas vert horiz
DecomposePolar Full Size Big Small (Unchecked height) (Unchecked width) a
-> (Full Size Big Small (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall meas vert height width a.
(Measure meas, C vert, C height, C width, Eq width, Floating a) =>
Full meas vert Small height width a
-> (Full meas vert Small height width a, Hermitian width a)
decomposePolarTall)
         ((Full Size Big Big (Unchecked height) (Unchecked width) a
 -> (Full Size Big Big (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Big Big
forall height width a meas vert horiz.
(Full meas vert horiz height width a
 -> (Full meas vert horiz height width a, Hermitian width a))
-> DecomposePolar height width a meas vert horiz
DecomposePolar ((Full Size Big Big (Unchecked height) (Unchecked width) a
  -> (Full Size Big Big (Unchecked height) (Unchecked width) a,
      ArrayMatrix
        Packed
        HermitianUnknownDefiniteness
        Filled
        Filled
        Shape
        Small
        Small
        (Unchecked width)
        (Unchecked width)
        a))
 -> DecomposePolar
      (Unchecked height) (Unchecked width) a Size Big Big)
-> (Full Size Big Big (Unchecked height) (Unchecked width) a
    -> (Full Size Big Big (Unchecked height) (Unchecked width) a,
        ArrayMatrix
          Packed
          HermitianUnknownDefiniteness
          Filled
          Filled
          Shape
          Small
          Small
          (Unchecked width)
          (Unchecked width)
          a))
-> DecomposePolar
     (Unchecked height) (Unchecked width) a Size Big Big
forall a b. (a -> b) -> a -> b
$
            (Full Size Big Small (Unchecked height) (Unchecked width) a
 -> (Full Size Big Big (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> (Full Size Small Big (Unchecked height) (Unchecked width) a
    -> (Full Size Big Big (Unchecked height) (Unchecked width) a,
        ArrayMatrix
          Packed
          HermitianUnknownDefiniteness
          Filled
          Filled
          Shape
          Small
          Small
          (Unchecked width)
          (Unchecked width)
          a))
-> Either
     (Full Size Big Small (Unchecked height) (Unchecked width) a)
     (Full Size Small Big (Unchecked height) (Unchecked width) a)
-> (Full Size Big Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either
               ((Full Size Big Small (Unchecked height) (Unchecked width) a
 -> Full Size Big Big (Unchecked height) (Unchecked width) a)
-> (Full Size Big Small (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
-> (Full Size Big Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall a c b. (a -> c) -> (a, b) -> (c, b)
mapFst Full Size Big Small (Unchecked height) (Unchecked width) a
-> Full Size Big Big (Unchecked height) (Unchecked width) a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a -> General height width a
Matrix.fromFull ((Full Size Big Small (Unchecked height) (Unchecked width) a,
  ArrayMatrix
    Packed
    HermitianUnknownDefiniteness
    Filled
    Filled
    Shape
    Small
    Small
    (Unchecked width)
    (Unchecked width)
    a)
 -> (Full Size Big Big (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> (Full Size Big Small (Unchecked height) (Unchecked width) a
    -> (Full Size Big Small (Unchecked height) (Unchecked width) a,
        ArrayMatrix
          Packed
          HermitianUnknownDefiniteness
          Filled
          Filled
          Shape
          Small
          Small
          (Unchecked width)
          (Unchecked width)
          a))
-> Full Size Big Small (Unchecked height) (Unchecked width) a
-> (Full Size Big Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Small (Unchecked height) (Unchecked width) a
-> (Full Size Big Small (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall meas vert height width a.
(Measure meas, C vert, C height, C width, Eq width, Floating a) =>
Full meas vert Small height width a
-> (Full meas vert Small height width a, Hermitian width a)
decomposePolarTall)
               ((Full Size Small Big (Unchecked height) (Unchecked width) a
 -> Full Size Big Big (Unchecked height) (Unchecked width) a)
-> (Full Size Small Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
-> (Full Size Big Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall a c b. (a -> c) -> (a, b) -> (c, b)
mapFst Full Size Small Big (Unchecked height) (Unchecked width) a
-> Full Size Big Big (Unchecked height) (Unchecked width) a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a -> General height width a
Matrix.fromFull ((Full Size Small Big (Unchecked height) (Unchecked width) a,
  ArrayMatrix
    Packed
    HermitianUnknownDefiniteness
    Filled
    Filled
    Shape
    Small
    Small
    (Unchecked width)
    (Unchecked width)
    a)
 -> (Full Size Big Big (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> (Full Size Small Big (Unchecked height) (Unchecked width) a
    -> (Full Size Small Big (Unchecked height) (Unchecked width) a,
        ArrayMatrix
          Packed
          HermitianUnknownDefiniteness
          Filled
          Filled
          Shape
          Small
          Small
          (Unchecked width)
          (Unchecked width)
          a))
-> Full Size Small Big (Unchecked height) (Unchecked width) a
-> (Full Size Big Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Small Big (Unchecked height) (Unchecked width) a
-> (Full Size Small Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall meas horiz height width a.
(Measure meas, C horiz, C height, Eq height, C width, Eq width,
 Floating a) =>
Full meas Small horiz height width a
-> (Full meas Small horiz height width a, Hermitian width a)
decomposePolarWide)
            (Either
   (Full Size Big Small (Unchecked height) (Unchecked width) a)
   (Full Size Small Big (Unchecked height) (Unchecked width) a)
 -> (Full Size Big Big (Unchecked height) (Unchecked width) a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> (Full Size Big Big (Unchecked height) (Unchecked width) a
    -> Either
         (Full Size Big Small (Unchecked height) (Unchecked width) a)
         (Full Size Small Big (Unchecked height) (Unchecked width) a))
-> Full Size Big Big (Unchecked height) (Unchecked width) a
-> (Full Size Big Big (Unchecked height) (Unchecked width) a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
            Full Size Big Big (Unchecked height) (Unchecked width) a
-> Either
     (Full Size Big Small (Unchecked height) (Unchecked width) a)
     (Full Size Small Big (Unchecked height) (Unchecked width) a)
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width) =>
Full meas vert horiz height width a
-> Either (Tall height width a) (Wide height width a)
Matrix.caseTallWide))
   (ArrayMatrix
   Unpacked
   Arbitrary
   Filled
   Filled
   meas
   vert
   horiz
   (Unchecked height)
   (Unchecked width)
   a
 -> (ArrayMatrix
       Unpacked
       Arbitrary
       Filled
       Filled
       meas
       vert
       horiz
       (Unchecked height)
       (Unchecked width)
       a,
     ArrayMatrix
       Packed
       HermitianUnknownDefiniteness
       Filled
       Filled
       Shape
       Small
       Small
       (Unchecked width)
       (Unchecked width)
       a))
-> (Full meas vert horiz height width a
    -> ArrayMatrix
         Unpacked
         Arbitrary
         Filled
         Filled
         meas
         vert
         horiz
         (Unchecked height)
         (Unchecked width)
         a)
-> Full meas vert horiz height width a
-> (ArrayMatrix
      Unpacked
      Arbitrary
      Filled
      Filled
      meas
      vert
      horiz
      (Unchecked height)
      (Unchecked width)
      a,
    ArrayMatrix
      Packed
      HermitianUnknownDefiniteness
      Filled
      Filled
      Shape
      Small
      Small
      (Unchecked width)
      (Unchecked width)
      a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
   (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked
      Arbitrary
      Filled
      Filled
      meas
      vert
      horiz
      (Unchecked height)
      (Unchecked width)
      a)
-> Full meas vert horiz height width a
-> ArrayMatrix
     Unpacked
     Arbitrary
     Filled
     Filled
     meas
     vert
     horiz
     (Unchecked height)
     (Unchecked 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 meas vert horiz height width a
-> PlainArray
     Unpacked
     Arbitrary
     Filled
     Filled
     meas
     vert
     horiz
     (Unchecked height)
     (Unchecked width)
     a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a
-> Full meas vert horiz (Unchecked height) (Unchecked width) a
Basic.uncheck

newtype DecomposePolar height width a meas vert horiz =
   DecomposePolar {
      DecomposePolar height width a meas vert horiz
-> Full meas vert horiz height width a
-> (Full meas vert horiz height width a, Hermitian width a)
getDecomposePolar ::
         Full meas vert horiz height width a ->
         (Full meas vert horiz height width a, Matrix.Hermitian width a)
   }

decomposePolarTall ::
   (Extent.Measure meas, Extent.C vert,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Full meas vert Extent.Small height width a ->
   (Full meas vert Extent.Small height width a, Matrix.Hermitian width a)
decomposePolarTall :: Full meas vert Small height width a
-> (Full meas vert Small height width a, Hermitian width a)
decomposePolarTall Full meas vert Small height width a
a =
   let (Full meas vert Small height width a
u,Vector width (RealOf a)
s,Square width a
vt) = Full meas vert Small height width a
-> (Full meas vert Small height width a, Vector width (RealOf a),
    Square width a)
forall meas vert height width a.
(Measure meas, C vert, C height, C width, Floating a) =>
Full meas vert Small height width a
-> (Full meas vert Small height width a, RealVector width a,
    Square width a)
decomposeTall Full meas vert Small height width a
a
   in (Full meas vert Small height width a
u Full meas vert Small height width a
-> Square width a -> Full meas vert Small height width a
forall typ xl xu lowerA upperA lowerB upperB lowerC upperC measA
       measB measC vert horiz height fuse width a.
(MultiplySquare typ, ToQuadratic typ, MultiplySquareExtra typ xl,
 MultiplySquareExtra typ xu, BoxExtra typ xl, BoxExtra typ xu,
 Strip lowerA, Strip upperA, Strip lowerB, Strip upperB,
 Strip lowerC, Strip upperC, MultipliedBands lowerA lowerB ~ lowerC,
 MultipliedBands lowerB lowerA ~ lowerC,
 MultipliedBands upperA upperB ~ upperC,
 MultipliedBands upperB upperA ~ upperC, Measure measA,
 Measure measB, Measure measC, MultiplyMeasure measA measB ~ measC,
 C vert, C horiz, C height, C fuse, Eq fuse, C width, Floating a) =>
Unpacked lowerB upperB measB vert horiz height fuse a
-> QuadraticMeas typ xl xu lowerA upperA measA fuse width a
-> Unpacked lowerC upperC measC vert horiz height width a
##*# Square width a
vt, Vector width (RealOf a)
-> General width width a -> Hermitian width a
forall pack height width a.
(Packing pack, C height, Eq height, C width, Floating a) =>
Vector height (RealOf a)
-> General height width a -> HermitianP pack width a
Hermitian.congruenceDiagonal Vector width (RealOf a)
s (General width width a -> Hermitian width a)
-> General width width a -> Hermitian width a
forall a b. (a -> b) -> a -> b
$ Square width a -> General width width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a -> General height width a
Matrix.fromFull Square width a
vt)

decomposePolarWide ::
   (Extent.Measure meas, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>
   Full meas Extent.Small horiz height width a ->
   (Full meas Extent.Small horiz height width a, Matrix.Hermitian width a)
decomposePolarWide :: Full meas Small horiz height width a
-> (Full meas Small horiz height width a, Hermitian width a)
decomposePolarWide Full meas Small horiz height width a
a =
   let (Square height a
u,Vector height (RealOf a)
s,Full meas Small horiz height width a
vt) = Full meas Small horiz height width a
-> (Square height a, Vector height (RealOf a),
    Full meas Small horiz height width a)
forall meas horiz height width a.
(Measure meas, C horiz, C height, C width, Floating a) =>
Full meas Small horiz height width a
-> (Square height a, RealVector height a,
    Full meas Small horiz height width a)
decomposeWide Full meas Small horiz height width a
a
   in (Square height a
u Square height a
-> Full meas Small horiz height width a
-> Full meas Small horiz height width a
forall typ xl xu lowerA upperA lowerB upperB lowerC upperC measA
       measB measC vert horiz height fuse width a.
(MultiplySquare typ, ToQuadratic typ, MultiplySquareExtra typ xl,
 MultiplySquareExtra typ xu, BoxExtra typ xl, BoxExtra typ xu,
 Strip lowerA, Strip upperA, Strip lowerB, Strip upperB,
 Strip lowerC, Strip upperC, MultipliedBands lowerA lowerB ~ lowerC,
 MultipliedBands lowerB lowerA ~ lowerC,
 MultipliedBands upperA upperB ~ upperC,
 MultipliedBands upperB upperA ~ upperC, Measure measA,
 Measure measB, Measure measC, MultiplyMeasure measA measB ~ measC,
 C vert, C horiz, C height, C fuse, Eq fuse, C width, Floating a) =>
QuadraticMeas typ xl xu lowerA upperA measA height fuse a
-> Unpacked lowerB upperB measB vert horiz fuse width a
-> Unpacked lowerC upperC measC vert horiz height width a
#*## Full meas Small horiz height width a
vt, Vector height (RealOf a)
-> General height width a -> Hermitian width a
forall pack height width a.
(Packing pack, C height, Eq height, C width, Floating a) =>
Vector height (RealOf a)
-> General height width a -> HermitianP pack width a
Hermitian.congruenceDiagonal Vector height (RealOf a)
s (General height width a -> Hermitian width a)
-> General height width a -> Hermitian width a
forall a b. (a -> b) -> a -> b
$ Full meas Small horiz height width a -> General height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a -> General height width a
Matrix.fromFull Full meas Small horiz height width a
vt)