{-# LANGUAGE TypeOperators #-}
module Numeric.LAPACK.Matrix.Array.Unpacked where

import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix
import qualified Numeric.LAPACK.Matrix.Square.Basic as Square
import qualified Numeric.LAPACK.Matrix.Plain as Plain
import qualified Numeric.LAPACK.Matrix.Basic as Basic
import qualified Numeric.LAPACK.Matrix.Private as Matrix
import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout
import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni
import qualified Numeric.LAPACK.Matrix.Extent.Strict as ExtentStrict
import qualified Numeric.LAPACK.Matrix.Extent as Extent
import Numeric.LAPACK.Vector (Vector)
import Numeric.LAPACK.Shape.Private (Unchecked)

import qualified Numeric.Netlib.Class as Class

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



type Unpacked property lower upper meas vert horiz height width =
         ArrMatrix.ArrayMatrix Layout.Unpacked
            property lower upper meas vert horiz height width
type Quadratic property lower upper sh =
         Unpacked property lower upper
            Extent.Shape Extent.Small Extent.Small sh sh
{- |
We do not support unit diagonal tag for trapezoids,
because unit diagonal is not preserved by multiplication of trapezoids.
-}
type LowerTrapezoid meas vert horiz height width =
         Unpacked Omni.Arbitrary Layout.Filled Layout.Empty
            meas vert horiz height width
type UpperTrapezoid meas vert horiz height width =
         Unpacked Omni.Arbitrary Layout.Empty Layout.Filled
            meas vert horiz height width


recheck ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Unpacked property lower upper
      meas vert horiz (Unchecked height) (Unchecked width) a ->
   Unpacked property lower upper meas vert horiz height width a
recheck :: 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
  (Unchecked height)
  (Unchecked width)
  a
-> Unpacked property lower upper meas vert horiz height width a
recheck = (FullArray meas vert horiz (Unchecked height) (Unchecked width) a
 -> FullArray meas vert horiz height width a)
-> UnpackedMatrix
     property
     lower
     upper
     meas
     vert
     horiz
     (Unchecked height)
     (Unchecked width)
     a
-> UnpackedMatrix
     property lower upper meas vert horiz height width 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 meas vert horiz (Unchecked height) (Unchecked width) a
-> FullArray 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

uncheck ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Unpacked property lower upper meas vert horiz height width a ->
   Unpacked property lower upper
      meas vert horiz (Unchecked height) (Unchecked width) a
uncheck :: 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
uncheck = (FullArray meas vert horiz height width a
 -> FullArray
      meas vert horiz (Unchecked height) (Unchecked width) a)
-> UnpackedMatrix
     property lower upper meas vert horiz height width a
-> UnpackedMatrix
     property
     lower
     upper
     meas
     vert
     horiz
     (Unchecked height)
     (Unchecked width)
     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 meas vert horiz height width a
-> FullArray 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


fillLower ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>
   Unpacked property lower upper meas vert horiz height width a ->
   Unpacked property Layout.Filled upper meas vert horiz height width a
fillLower :: forall property lower upper meas vert horiz height width a.
(Property property, Strip lower, Strip upper) =>
Unpacked property lower upper meas vert horiz height width a
-> Unpacked property Filled upper meas vert horiz height width a
fillLower = (FullArray meas vert horiz height width a
 -> FullArray meas vert horiz height width a)
-> UnpackedMatrix
     property lower upper meas vert horiz height width a
-> UnpackedMatrix
     property Filled upper meas vert horiz height width 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 meas vert horiz height width a
-> FullArray meas vert horiz height width a
forall a. a -> a
id

fillUpper ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>
   Unpacked property lower upper meas vert horiz height width a ->
   Unpacked property lower Layout.Filled meas vert horiz height width a
fillUpper :: forall property lower upper meas vert horiz height width a.
(Property property, Strip lower, Strip upper) =>
Unpacked property lower upper meas vert horiz height width a
-> Unpacked property lower Filled meas vert horiz height width a
fillUpper = (FullArray meas vert horiz height width a
 -> FullArray meas vert horiz height width a)
-> UnpackedMatrix
     property lower upper meas vert horiz height width a
-> UnpackedMatrix
     property lower Filled meas vert horiz height width 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 meas vert horiz height width a
-> FullArray meas vert horiz height width a
forall a. a -> a
id

fillBoth ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>
   Unpacked property lower upper meas vert horiz height width a ->
   Unpacked property Layout.Filled Layout.Filled meas vert horiz height width a
fillBoth :: forall property lower upper meas vert horiz height width a.
(Property property, Strip lower, Strip upper) =>
Unpacked property lower upper meas vert horiz height width a
-> Unpacked property Filled Filled meas vert horiz height width a
fillBoth = (FullArray meas vert horiz height width a
 -> FullArray meas vert horiz height width a)
-> UnpackedMatrix
     property lower upper meas vert horiz height width a
-> UnpackedMatrix
     property Filled Filled meas vert horiz height width 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 meas vert horiz height width a
-> FullArray meas vert horiz height width a
forall a. a -> a
id


mapExtent ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>
   (Extent.Measure measA, Extent.C vertA, Extent.C horizA) =>
   (Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>
   Extent.Map measA vertA horizA measB vertB horizB height width ->
   Unpacked property lower upper measA vertA horizA height width a ->
   Unpacked property lower upper measB vertB horizB height width a
mapExtent :: forall property lower upper measA vertA horizA measB vertB horizB
       height width a.
(Property property, Strip lower, Strip upper, Measure measA,
 C vertA, C horizA, Measure measB, C vertB, C horizB) =>
Map measA vertA horizA measB vertB horizB height width
-> Unpacked property lower upper measA vertA horizA height width a
-> Unpacked property lower upper measB vertB horizB height width a
mapExtent = (FullArray measA vertA horizA height width a
 -> FullArray measB vertB horizB height width a)
-> UnpackedMatrix
     property lower upper measA vertA horizA height width a
-> UnpackedMatrix
     property lower upper measB vertB horizB height width 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 measA vertA horizA height width a
  -> FullArray measB vertB horizB height width a)
 -> UnpackedMatrix
      property lower upper measA vertA horizA height width a
 -> UnpackedMatrix
      property lower upper measB vertB horizB height width a)
-> (Map measA vertA horizA measB vertB horizB height width
    -> FullArray measA vertA horizA height width a
    -> FullArray measB vertB horizB height width a)
-> Map measA vertA horizA measB vertB horizB height width
-> UnpackedMatrix
     property lower upper measA vertA horizA height width a
-> UnpackedMatrix
     property lower upper measB vertB horizB height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map measA vertA horizA measB vertB horizB height width
-> FullArray measA vertA horizA height width a
-> FullArray measB vertB horizB height width a
forall measA vertA horizA measB vertB horizB height width a.
(Measure measA, C vertA, C horizA, Measure measB, C vertB,
 C horizB) =>
Map measA vertA horizA measB vertB horizB height width
-> Full measA vertA horizA height width a
-> Full measB vertB horizB height width a
Plain.mapExtent (Map measA vertA horizA measB vertB horizB height width
 -> FullArray measA vertA horizA height width a
 -> FullArray measB vertB horizB height width a)
-> (Map measA vertA horizA measB vertB horizB height width
    -> Map measA vertA horizA measB vertB horizB height width)
-> Map measA vertA horizA measB vertB horizB height width
-> FullArray measA vertA horizA height width a
-> FullArray measB vertB horizB height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map measA vertA horizA measB vertB horizB height width
-> Map measA vertA horizA measB vertB horizB height width
forall measA vertA horizA measB vertB horizB height width.
Map measA vertA horizA measB vertB horizB height width
-> Map measA vertA horizA measB vertB horizB height width
ExtentStrict.apply

transpose ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Unpacked property lower upper meas vert horiz height width a ->
   Unpacked property upper lower meas horiz vert width height a
transpose :: 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 upper lower meas horiz vert width height a
transpose = (FullArray meas vert horiz height width a
 -> FullArray meas horiz vert width height a)
-> UnpackedMatrix
     property lower upper meas vert horiz height width a
-> UnpackedMatrix
     property upper lower meas horiz vert width height 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 meas vert horiz height width a
-> FullArray meas horiz vert width height 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
Basic.transpose

swapMultiply ::
   (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>
   (Omni.Property propertyB, Omni.Strip lowerB, Omni.Strip upperB) =>
   (Extent.Measure measA, Extent.C vertA, Extent.C horizA,
    Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>
   (matrix ->
    Unpacked propertyA upperA lowerA measA horizA vertA widthA heightA a ->
    Unpacked propertyB upperB lowerB measB horizB vertB widthB heightB a) ->
   Unpacked propertyA lowerA upperA measA vertA horizA heightA widthA a ->
   matrix ->
   Unpacked propertyB lowerB upperB measB vertB horizB heightB widthB a
swapMultiply :: forall propertyA lowerA upperA propertyB lowerB upperB measA vertA
       horizA measB vertB horizB matrix widthA heightA a widthB heightB.
(Property propertyA, Strip lowerA, Strip upperA,
 Property propertyB, Strip lowerB, Strip upperB, Measure measA,
 C vertA, C horizA, Measure measB, C vertB, C horizB) =>
(matrix
 -> Unpacked
      propertyA upperA lowerA measA horizA vertA widthA heightA a
 -> Unpacked
      propertyB upperB lowerB measB horizB vertB widthB heightB a)
-> Unpacked
     propertyA lowerA upperA measA vertA horizA heightA widthA a
-> matrix
-> Unpacked
     propertyB lowerB upperB measB vertB horizB heightB widthB a
swapMultiply matrix
-> Unpacked
     propertyA upperA lowerA measA horizA vertA widthA heightA a
-> Unpacked
     propertyB upperB lowerB measB horizB vertB widthB heightB a
multiplyTrans Unpacked
  propertyA lowerA upperA measA vertA horizA heightA widthA a
a matrix
b = Unpacked
  propertyB upperB lowerB measB horizB vertB widthB heightB a
-> Unpacked
     propertyB lowerB upperB measB vertB horizB heightB widthB 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 upper lower meas horiz vert width height a
transpose (Unpacked
   propertyB upperB lowerB measB horizB vertB widthB heightB a
 -> Unpacked
      propertyB lowerB upperB measB vertB horizB heightB widthB a)
-> Unpacked
     propertyB upperB lowerB measB horizB vertB widthB heightB a
-> Unpacked
     propertyB lowerB upperB measB vertB horizB heightB widthB a
forall a b. (a -> b) -> a -> b
$ matrix
-> Unpacked
     propertyA upperA lowerA measA horizA vertA widthA heightA a
-> Unpacked
     propertyB upperB lowerB measB horizB vertB widthB heightB a
multiplyTrans matrix
b (Unpacked
   propertyA upperA lowerA measA horizA vertA widthA heightA a
 -> Unpacked
      propertyB upperB lowerB measB horizB vertB widthB heightB a)
-> Unpacked
     propertyA upperA lowerA measA horizA vertA widthA heightA a
-> Unpacked
     propertyB upperB lowerB measB horizB vertB widthB heightB a
forall a b. (a -> b) -> a -> b
$ Unpacked
  propertyA lowerA upperA measA vertA horizA heightA widthA a
-> Unpacked
     propertyA upperA lowerA measA horizA vertA widthA heightA 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 upper lower meas horiz vert width height a
transpose Unpacked
  propertyA lowerA upperA measA vertA horizA heightA widthA a
a


takeTopLeft ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   Quadratic property lower upper (sh0::+sh1) a ->
   Quadratic property lower upper sh0 a
takeTopLeft :: 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
takeTopLeft =
   (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> FullArray Shape Small Small sh0 sh0 a)
-> UnpackedMatrix
     property
     lower
     upper
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
-> UnpackedMatrix property lower upper Shape Small Small sh0 sh0 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 (sh0 ::+ sh1) (sh0 ::+ sh1) a
  -> FullArray Shape Small Small sh0 sh0 a)
 -> UnpackedMatrix
      property
      lower
      upper
      Shape
      Small
      Small
      (sh0 ::+ sh1)
      (sh0 ::+ sh1)
      a
 -> UnpackedMatrix property lower upper Shape Small Small sh0 sh0 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> FullArray Shape Small Small sh0 sh0 a)
-> UnpackedMatrix
     property
     lower
     upper
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
-> UnpackedMatrix property lower upper Shape Small Small sh0 sh0 a
forall a b. (a -> b) -> a -> b
$
      Full Shape Small Small (Unchecked sh0) (Unchecked sh0) a
-> FullArray Shape Small Small sh0 sh0 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 (Full Shape Small Small (Unchecked sh0) (Unchecked sh0) a
 -> FullArray Shape Small Small sh0 sh0 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Shape Small Small (Unchecked sh0) (Unchecked sh0) a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> FullArray Shape Small Small sh0 sh0 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Big (Unchecked sh0) (Unchecked sh0) a
-> Full Shape Small Small (Unchecked sh0) (Unchecked sh0) a
forall meas vert horiz sh a.
(Measure meas, C vert, C horiz, Eq sh) =>
Full meas vert horiz sh sh a -> Square sh a
Square.fromFull (Full Size Big Big (Unchecked sh0) (Unchecked sh0) a
 -> Full Shape Small Small (Unchecked sh0) (Unchecked sh0) a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (Unchecked sh0) (Unchecked sh0) a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Shape Small Small (Unchecked sh0) (Unchecked sh0) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Big sh0 sh0 a
-> Full Size Big Big (Unchecked sh0) (Unchecked sh0) 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 Size Big Big sh0 sh0 a
 -> Full Size Big Big (Unchecked sh0) (Unchecked sh0) a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big sh0 sh0 a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (Unchecked sh0) (Unchecked sh0) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
      Full Size Big Big (sh0 ::+ sh1) sh0 a
-> Full Size Big Big sh0 sh0 a
forall vert height0 height1 width a.
(C vert, C height0, C height1, C width, Floating a) =>
Full Size vert Big (height0 ::+ height1) width a
-> Full Size vert Big height0 width a
Basic.takeTop (Full Size Big Big (sh0 ::+ sh1) sh0 a
 -> Full Size Big Big sh0 sh0 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (sh0 ::+ sh1) sh0 a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big sh0 sh0 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) sh0 a
forall vert height width0 width1 a.
(C vert, C height, C width0, C width1, Floating a) =>
Full Size Big vert height (width0 ::+ width1) a
-> Full Size Big vert height width0 a
Basic.takeLeft (Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> Full Size Big Big (sh0 ::+ sh1) sh0 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) sh0 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) 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

takeTopRight ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   Quadratic property lower upper (sh0::+sh1) a -> ArrMatrix.General sh0 sh1 a
takeTopRight :: 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
takeTopRight =
   (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> FullArray Size Big Big sh0 sh1 a)
-> UnpackedMatrix
     property
     lower
     upper
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
-> UnpackedMatrix Arbitrary Filled Filled Size Big Big sh0 sh1 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 (sh0 ::+ sh1) (sh0 ::+ sh1) a
  -> FullArray Size Big Big sh0 sh1 a)
 -> UnpackedMatrix
      property
      lower
      upper
      Shape
      Small
      Small
      (sh0 ::+ sh1)
      (sh0 ::+ sh1)
      a
 -> UnpackedMatrix Arbitrary Filled Filled Size Big Big sh0 sh1 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> FullArray Size Big Big sh0 sh1 a)
-> UnpackedMatrix
     property
     lower
     upper
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
-> UnpackedMatrix Arbitrary Filled Filled Size Big Big sh0 sh1 a
forall a b. (a -> b) -> a -> b
$
      Full Size Big Big (sh0 ::+ sh1) sh1 a
-> FullArray Size Big Big sh0 sh1 a
forall vert height0 height1 width a.
(C vert, C height0, C height1, C width, Floating a) =>
Full Size vert Big (height0 ::+ height1) width a
-> Full Size vert Big height0 width a
Basic.takeTop (Full Size Big Big (sh0 ::+ sh1) sh1 a
 -> FullArray Size Big Big sh0 sh1 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (sh0 ::+ sh1) sh1 a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> FullArray Size Big Big sh0 sh1 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) sh1 a
forall vert height width0 width1 a.
(C vert, C height, C width0, C width1, Floating a) =>
Full Size Big vert height (width0 ::+ width1) a
-> Full Size Big vert height width1 a
Basic.takeRight (Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> Full Size Big Big (sh0 ::+ sh1) sh1 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) sh1 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) 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

takeBottomLeft ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   Quadratic property lower upper (sh0::+sh1) a -> ArrMatrix.General sh1 sh0 a
takeBottomLeft :: forall property lower upper sh0 sh1 a.
(Property property, Strip lower, Strip upper, C sh0, C sh1,
 Floating a) =>
Quadratic property lower upper (sh0 ::+ sh1) a -> General sh1 sh0 a
takeBottomLeft =
   (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> FullArray Size Big Big sh1 sh0 a)
-> UnpackedMatrix
     property
     lower
     upper
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
-> UnpackedMatrix Arbitrary Filled Filled Size Big Big sh1 sh0 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 (sh0 ::+ sh1) (sh0 ::+ sh1) a
  -> FullArray Size Big Big sh1 sh0 a)
 -> UnpackedMatrix
      property
      lower
      upper
      Shape
      Small
      Small
      (sh0 ::+ sh1)
      (sh0 ::+ sh1)
      a
 -> UnpackedMatrix Arbitrary Filled Filled Size Big Big sh1 sh0 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> FullArray Size Big Big sh1 sh0 a)
-> UnpackedMatrix
     property
     lower
     upper
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
-> UnpackedMatrix Arbitrary Filled Filled Size Big Big sh1 sh0 a
forall a b. (a -> b) -> a -> b
$
      Full Size Big Big (sh0 ::+ sh1) sh0 a
-> FullArray Size Big Big sh1 sh0 a
forall vert height0 height1 width a.
(C vert, C height0, C height1, C width, Floating a) =>
Full Size vert Big (height0 ::+ height1) width a
-> Full Size vert Big height1 width a
Basic.takeBottom (Full Size Big Big (sh0 ::+ sh1) sh0 a
 -> FullArray Size Big Big sh1 sh0 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (sh0 ::+ sh1) sh0 a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> FullArray Size Big Big sh1 sh0 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) sh0 a
forall vert height width0 width1 a.
(C vert, C height, C width0, C width1, Floating a) =>
Full Size Big vert height (width0 ::+ width1) a
-> Full Size Big vert height width0 a
Basic.takeLeft (Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> Full Size Big Big (sh0 ::+ sh1) sh0 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) sh0 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) 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

takeBottomRight ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper,
    Shape.C sh0, Shape.C sh1, Class.Floating a) =>
   Quadratic property lower upper (sh0::+sh1) a ->
   Quadratic property lower upper sh1 a
takeBottomRight :: 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
takeBottomRight =
   (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> FullArray Shape Small Small sh1 sh1 a)
-> UnpackedMatrix
     property
     lower
     upper
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
-> UnpackedMatrix property lower upper Shape Small Small sh1 sh1 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 (sh0 ::+ sh1) (sh0 ::+ sh1) a
  -> FullArray Shape Small Small sh1 sh1 a)
 -> UnpackedMatrix
      property
      lower
      upper
      Shape
      Small
      Small
      (sh0 ::+ sh1)
      (sh0 ::+ sh1)
      a
 -> UnpackedMatrix property lower upper Shape Small Small sh1 sh1 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> FullArray Shape Small Small sh1 sh1 a)
-> UnpackedMatrix
     property
     lower
     upper
     Shape
     Small
     Small
     (sh0 ::+ sh1)
     (sh0 ::+ sh1)
     a
-> UnpackedMatrix property lower upper Shape Small Small sh1 sh1 a
forall a b. (a -> b) -> a -> b
$
      Full Shape Small Small (Unchecked sh1) (Unchecked sh1) a
-> FullArray Shape Small Small sh1 sh1 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 (Full Shape Small Small (Unchecked sh1) (Unchecked sh1) a
 -> FullArray Shape Small Small sh1 sh1 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Shape Small Small (Unchecked sh1) (Unchecked sh1) a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> FullArray Shape Small Small sh1 sh1 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Big (Unchecked sh1) (Unchecked sh1) a
-> Full Shape Small Small (Unchecked sh1) (Unchecked sh1) a
forall meas vert horiz sh a.
(Measure meas, C vert, C horiz, Eq sh) =>
Full meas vert horiz sh sh a -> Square sh a
Square.fromFull (Full Size Big Big (Unchecked sh1) (Unchecked sh1) a
 -> Full Shape Small Small (Unchecked sh1) (Unchecked sh1) a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (Unchecked sh1) (Unchecked sh1) a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Shape Small Small (Unchecked sh1) (Unchecked sh1) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Big sh1 sh1 a
-> Full Size Big Big (Unchecked sh1) (Unchecked sh1) 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 Size Big Big sh1 sh1 a
 -> Full Size Big Big (Unchecked sh1) (Unchecked sh1) a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big sh1 sh1 a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (Unchecked sh1) (Unchecked sh1) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
      Full Size Big Big (sh0 ::+ sh1) sh1 a
-> Full Size Big Big sh1 sh1 a
forall vert height0 height1 width a.
(C vert, C height0, C height1, C width, Floating a) =>
Full Size vert Big (height0 ::+ height1) width a
-> Full Size vert Big height1 width a
Basic.takeBottom (Full Size Big Big (sh0 ::+ sh1) sh1 a
 -> Full Size Big Big sh1 sh1 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (sh0 ::+ sh1) sh1 a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big sh1 sh1 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) sh1 a
forall vert height width0 width1 a.
(C vert, C height, C width0, C width1, Floating a) =>
Full Size Big vert height (width0 ::+ width1) a
-> Full Size Big vert height width1 a
Basic.takeRight (Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a
 -> Full Size Big Big (sh0 ::+ sh1) sh1 a)
-> (FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
    -> Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) a)
-> FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) sh1 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FullArray Shape Small Small (sh0 ::+ sh1) (sh0 ::+ sh1) a
-> Full Size Big Big (sh0 ::+ sh1) (sh0 ::+ sh1) 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


multiplyVector ::
   (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Unpacked property lower upper meas vert horiz height width a ->
   Vector width a -> Vector height a
multiplyVector :: forall property lower upper meas vert horiz height width a.
(Property property, Strip lower, Strip upper, Measure meas, C vert,
 C horiz, C height, C width, Eq width, Floating a) =>
Unpacked property lower upper meas vert horiz height width a
-> Vector width a -> Vector height a
multiplyVector = Full meas vert horiz height width a
-> Vector width a -> Vector height a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width, Eq width,
 Floating a) =>
Full meas vert horiz height width a
-> Vector width a -> Vector height a
Basic.multiplyVector (Full meas vert horiz height width a
 -> Vector width a -> Vector height a)
-> (Unpacked property lower upper meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Unpacked property lower upper meas vert horiz height width a
-> Vector width a
-> Vector height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unpacked property lower upper meas vert horiz height width a
-> Full meas vert horiz height width a
forall property lower upper meas vert horiz height width a.
(Property property, Strip lower, Strip upper) =>
UnpackedMatrix property lower upper meas vert horiz height width a
-> FullArray meas vert horiz height width a
ArrMatrix.unpackedToVector

multiply ::
   (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>
   (Omni.Property propertyB, Omni.Strip lowerB, Omni.Strip upperB) =>
   (Omni.Property propertyC, Omni.Strip lowerC, Omni.Strip upperC) =>
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height,
    Shape.C fuse, Eq fuse,
    Shape.C width,
    Class.Floating a) =>
   Unpacked propertyA lowerA upperA meas vert horiz height fuse a ->
   Unpacked propertyB upperB lowerB meas vert horiz fuse width a ->
   Unpacked propertyC upperC lowerC meas vert horiz height width a
multiply :: forall propertyA lowerA upperA propertyB lowerB upperB propertyC
       lowerC upperC meas vert horiz height fuse width a.
(Property propertyA, Strip lowerA, Strip upperA,
 Property propertyB, Strip lowerB, Strip upperB, Property propertyC,
 Strip lowerC, Strip upperC, Measure meas, C vert, C horiz,
 C height, C fuse, Eq fuse, C width, Floating a) =>
Unpacked propertyA lowerA upperA meas vert horiz height fuse a
-> Unpacked propertyB upperB lowerB meas vert horiz fuse width a
-> Unpacked propertyC upperC lowerC meas vert horiz height width a
multiply = (FullArray meas vert horiz height fuse a
 -> FullArray meas vert horiz fuse width a
 -> FullArray meas vert horiz height width a)
-> UnpackedMatrix
     propertyA lowerA upperA meas vert horiz height fuse a
-> UnpackedMatrix
     propertyB upperB lowerB meas vert horiz fuse width a
-> UnpackedMatrix
     propertyC upperC lowerC meas vert horiz height width a
forall propertyA lowerA upperA propertyB lowerB upperB propertyC
       lowerC upperC measA vertA horizA heightA widthA a measB vertB
       horizB heightB widthB b measC vertC horizC heightC widthC c.
(Property propertyA, Strip lowerA, Strip upperA,
 Property propertyB, Strip lowerB, Strip upperB, Property propertyC,
 Strip lowerC, Strip upperC) =>
(FullArray measA vertA horizA heightA widthA a
 -> FullArray measB vertB horizB heightB widthB b
 -> FullArray measC vertC horizC heightC widthC c)
-> 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
ArrMatrix.liftUnpacked2 FullArray meas vert horiz height fuse a
-> FullArray meas vert horiz fuse width a
-> FullArray meas vert horiz height width a
forall meas vert horiz height fuse width a.
(Measure meas, C vert, C horiz, C height, C fuse, Eq fuse, C width,
 Floating a) =>
Full meas vert horiz height fuse a
-> Full meas vert horiz fuse width a
-> Full meas vert horiz height width a
Basic.multiply