{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module Numeric.LAPACK.Matrix (
   Matrix.Matrix,
   Full,
   General, Tall, Wide, Square.Square, ArrMatrix.LiberalSquare,
   Matrix.Quadratic,
   Triangular.Triangular, Triangular.Upper, Triangular.Lower,
   Triangular.Symmetric,
   Triangular.Hermitian,
   Triangular.HermitianPosDef,
   Triangular.HermitianPosSemidef,
   Triangular.FlexHermitian,
   Banded.Diagonal, Banded.FlexDiagonal,
   Banded.RectangularDiagonal,
   Banded.Banded,
   BandedHermitian.BandedHermitian,
   PermMatrix.Permutation,

   ShapeInt, shapeInt,
   Matrix.Transpose, Matrix.transpose, MatrixClass.adjoint,
   Matrix.height, Matrix.width,
   Matrix.Box, Matrix.indices,
   ArrMatrix.reshape,
   ArrMatrix.mapShape,
   caseTallWide,
   fromScalar, toScalar,
   fromList,
   Matrix.mapExtent, fromFull, OmniMatrix.toFull, OmniMatrix.unpack,
   asGeneral, asTall, asWide,
   tallFromGeneral, wideFromGeneral,
   generalizeTall, generalizeWide,
   MatrixClass.mapHeight, MatrixClass.mapWidth,
   MatrixClass.mapSquareSize,
   Quadratic.identity,
   Quadratic.diagonal,
   fromRowsNonEmpty,    fromRowArray,    fromRows,
   fromRowsNonEmptyContainer,    fromRowContainer,
   fromColumnsNonEmpty, fromColumnArray, fromColumns,
   fromColumnsNonEmptyContainer, fromColumnContainer,
   singleRow,   singleColumn,
   flattenRow,  flattenColumn,
   liftRow,     liftColumn,
   unliftRow,   unliftColumn,
   toRows, toColumns,
   toRowArray, toColumnArray,
   toRowContainer, toColumnContainer,
   takeRow, takeColumn,
   takeRows, takeColumns, takeEqually,
   dropRows, dropColumns, dropEqually,
   takeTop, takeBottom,
   takeLeft, takeRight,
   takeRowArray, takeColumnArray,
   swapRows, swapColumns,
   reverseRows, reverseColumns,
   fromRowMajor, toRowMajor,
   ArrMatrix.forceOrder, ArrMatrix.adaptOrder,
   Basic.OrderBias, leftBias, rightBias, contiguousBias,
   (|||), beside,
   (===), above,
   stack,

   (|*-),
   tensorProduct,
   outer,
   kronecker,
   sumRank1,

   map,
   MatrixClass.Complex, MatrixClass.conjugate,
   MatrixClass.fromReal, MatrixClass.toComplex,
   MatrixClass.SquareShape, MatrixClass.toSquare,
   OmniMatrix.identityFromShape,
   MatrixClass.identityFrom,
   MatrixClass.takeDiagonal, MatrixClass.trace,

   RealOf,
   rowSums, columnSums,
   rowArgAbsMaximums, columnArgAbsMaximums,
   scaleRows, scaleColumns,
   scaleRowsReal, scaleColumnsReal,
   (\*#), (#*\),
   (\\#), (#/\),
   Full.multiply,
   Full.multiplyVector,

   Matrix.ToQuadratic,

   ArrMatrix.zero, ArrMatrix.negate,
   ArrMatrix.scale, ArrMatrix.scaleReal, ArrMatrix.scaleRealReal,
   (ArrMatrix..*#),
   ArrMatrix.add, ArrMatrix.sub,
   (ArrMatrix.#+#), (ArrMatrix.#-#),
   Multiply.Multiply, (Multiply.#*#),
   Multiply.MultiplyVector, (Multiply.#*|), (Multiply.-*#),
   Multiply.MultiplySquare, multiplySquare,
   Multiply.Power, Multiply.square,
   Multiply.power, Multiply.powers, Multiply.powers1,
   (Multiply.##*#), (Multiply.#*##),
   Indexed.Indexed, (Indexed.#!),

   Divide.Determinant, Divide.determinant,
   Divide.Solve, Divide.solve, Divide.solveLeft, Divide.solveRight,
   (Divide.##/#), (Divide.#\##),
   Divide.solveVector, (Divide.-/#), (Divide.#\|),
   Divide.Inverse, Divide.inverse,
   Mod.Transposition(..),
   ) where

import qualified Numeric.LAPACK.Matrix.Permutation as PermMatrix
import qualified Numeric.LAPACK.Matrix.Array.Mosaic as Triangular
import qualified Numeric.LAPACK.Matrix.BandedHermitian as BandedHermitian
import qualified Numeric.LAPACK.Matrix.Banded as Banded
import qualified Numeric.LAPACK.Matrix.Quadratic as Quadratic
import qualified Numeric.LAPACK.Matrix.Square as Square
import qualified Numeric.LAPACK.Matrix.Full as Full

import qualified Numeric.LAPACK.Matrix.Extent as Extent
import qualified Numeric.LAPACK.Matrix.Basic as Basic
import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix
import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix
import qualified Numeric.LAPACK.Matrix.Type as Matrix
import qualified Numeric.LAPACK.Matrix.Plain as Plain
import qualified Numeric.LAPACK.Matrix.Modifier as Mod
import qualified Numeric.LAPACK.Matrix.Divide as Divide
import qualified Numeric.LAPACK.Matrix.Multiply as Multiply
import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni
import qualified Numeric.LAPACK.Matrix.Indexed as Indexed
import qualified Numeric.LAPACK.Matrix.Class as MatrixClass
import qualified Numeric.LAPACK.Matrix.Private as MatrixPriv
import qualified Numeric.LAPACK.Vector as Vector
import qualified Numeric.LAPACK.Shape as ExtShape
import Numeric.LAPACK.Matrix.Layout.Private (Order)
import Numeric.LAPACK.Matrix.Array (Full, General, Tall, Wide)
import Numeric.LAPACK.Matrix.Private (ShapeInt, shapeInt)
import Numeric.LAPACK.Vector (Vector)
import Numeric.LAPACK.Scalar (RealOf)

import qualified Numeric.Netlib.Class as Class

import qualified Data.Array.Comfort.Storable as Array
import qualified Data.Array.Comfort.Boxed as BoxedArray
import qualified Data.Array.Comfort.Container as Container
import qualified Data.Array.Comfort.Shape as Shape
import Data.Array.Comfort.Storable.Unchecked (Array, (!))
import Data.Array.Comfort.Shape ((::+))

import Foreign.Storable (Storable)

import qualified Data.NonEmpty as NonEmpty
import qualified Data.Either.HT as EitherHT
import Data.Function.HT (Id)

import Prelude hiding (map)


fromFull ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Full meas vert horiz height width a -> General height width a
fromFull :: Full meas vert horiz height width a -> General height width a
fromFull = (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big height width a)
-> Full meas vert horiz height width a -> General 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 height width a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big 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
Plain.fromFull

tallFromGeneral ::
   (Shape.C height, Shape.C width, Storable a) =>
   General height width a -> Tall height width a
tallFromGeneral :: General height width a -> Tall height width a
tallFromGeneral = (PlainArray
   Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Small height width a)
-> General height width a -> Tall 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 Size Big Big height width a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Small height width a
forall height width a.
(C height, C width, Storable a) =>
General height width a -> Tall height width a
Plain.tallFromGeneral

wideFromGeneral ::
   (Shape.C height, Shape.C width, Storable a) =>
   General height width a -> Wide height width a
wideFromGeneral :: General height width a -> Wide height width a
wideFromGeneral = (PlainArray
   Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Small Big height width a)
-> General height width a -> Wide 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 Size Big Big height width a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Small Big height width a
forall height width a.
(C height, C width, Storable a) =>
General height width a -> Wide height width a
Plain.wideFromGeneral

generalizeTall ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Full meas vert Extent.Small height width a ->
   Full Extent.Size vert horiz height width a
generalizeTall :: Full meas vert Small height width a
-> Full Size vert horiz height width a
generalizeTall = Map meas vert Small Size vert horiz height width
-> Full meas vert Small height width a
-> Full Size vert horiz 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
Full.mapExtent Map meas vert Small Size vert horiz height width
forall meas vert horiz height width.
(Measure meas, C vert, C horiz) =>
Map meas vert Small Size vert horiz height width
Extent.generalizeTall

generalizeWide ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>
   Full meas Extent.Small horiz height width a ->
   Full Extent.Size vert horiz height width a
generalizeWide :: Full meas Small horiz height width a
-> Full Size vert horiz height width a
generalizeWide = Map meas Small horiz Size vert horiz height width
-> Full meas Small horiz height width a
-> Full Size vert horiz 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
Full.mapExtent Map meas Small horiz Size vert horiz height width
forall meas vert horiz height width.
(Measure meas, C vert, C horiz) =>
Map meas Small horiz Size vert horiz height width
Extent.generalizeWide


asGeneral :: Id (General height width a)
asGeneral :: Id (General height width a)
asGeneral = Id (General height width a)
forall a. a -> a
id

asTall :: Id (Tall height width a)
asTall :: Id (Tall height width a)
asTall = Id (Tall height width a)
forall a. a -> a
id

asWide :: Id (Wide height width a)
asWide :: Id (Wide height width a)
asWide = Id (Wide height width a)
forall a. a -> a
id



fromScalar :: (Storable a) => a -> General () () a
fromScalar :: a -> General () () a
fromScalar = Full Shape Small Small () () a -> General () () 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
fromFull (Full Shape Small Small () () a -> General () () a)
-> (a -> Full Shape Small Small () () a) -> a -> General () () a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Full Shape Small Small () () a
forall a. Storable a => a -> Square () a
Square.fromScalar

toScalar :: (Storable a) => General () () a -> a
toScalar :: General () () a -> a
toScalar General () () a
a =
   (Array ((), ()) a -> Array ((), ()) a)
-> (Array ((), ()) a -> Array ((), ()) a)
-> Either (Array ((), ()) a) (Array ((), ()) a)
-> Array ((), ()) a
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either Array ((), ()) a -> Array ((), ()) a
forall a. a -> a
id Array ((), ()) a -> Array ((), ()) a
forall a. a -> a
id (Full Size Big Big () () a
-> Either (Array ((), ()) a) (Array ((), ()) a)
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz) =>
Full meas vert horiz height width a
-> Either (Array (height, width) a) (Array (width, height) a)
MatrixPriv.revealOrder (General () () a
-> PlainArray Unpacked Arbitrary Filled Filled Size Big Big () () 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 () () a
a)) Array ((), ()) a -> Index ((), ()) -> a
forall sh a.
(Indexed sh, Storable a) =>
Array sh a -> Index sh -> a
! ((),())

fromList ::
   (Shape.C height, Shape.C width, Storable a) =>
   height -> width -> [a] -> General height width a
fromList :: height -> width -> [a] -> General height width a
fromList height
height width
width = Array (Full Size Big Big height width) a -> General height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big height width) a
 -> General height width a)
-> ([a] -> Array (Full Size Big Big height width) a)
-> [a]
-> General height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. height -> width -> [a] -> Array (Full Size Big Big height width) a
forall height width a.
(C height, C width, Storable a) =>
height -> width -> [a] -> General height width a
Plain.fromList height
height width
width


{- |
Square matrices will be classified as 'Tall'.
-}
caseTallWide ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width) =>
   Full meas vert horiz height width a ->
   Either (Tall height width a) (Wide height width a)
caseTallWide :: Full meas vert horiz height width a
-> Either (Tall height width a) (Wide height width a)
caseTallWide =
   (Tall height width a -> Tall height width a)
-> (Wide height width a -> Wide height width a)
-> Either (Tall height width a) (Wide height width a)
-> Either (Tall height width a) (Wide height width a)
forall a c b d. (a -> c) -> (b -> d) -> Either a b -> Either c d
EitherHT.mapBoth Tall height width a -> Tall height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 Wide height width a -> Wide height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Either (Tall height width a) (Wide height width a)
 -> Either (Tall height width a) (Wide height width a))
-> (Full meas vert horiz height width a
    -> Either (Tall height width a) (Wide height width a))
-> Full meas vert horiz height width a
-> Either (Tall height width a) (Wide height width a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
   Full meas vert horiz height width a
-> Either (Tall height width a) (Wide height 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)
Basic.caseTallWide (Full meas vert horiz height width a
 -> Either (Tall height width a) (Wide height width a))
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Either (Tall height width a) (Wide height 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


singleRow :: Order -> Vector width a -> General () width a
singleRow :: Order -> Vector width a -> General () width a
singleRow Order
order = Array (Full Size Big Big () width) a -> General () width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big () width) a -> General () width a)
-> (Vector width a -> Array (Full Size Big Big () width) a)
-> Vector width a
-> General () width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> Vector width a -> Array (Full Size Big Big () width) a
forall width a. Order -> Vector width a -> General () width a
Basic.singleRow Order
order

singleColumn :: Order -> Vector height a -> General height () a
singleColumn :: Order -> Vector height a -> General height () a
singleColumn Order
order = Array (Full Size Big Big height ()) a -> General 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 Size Big Big height ()) a -> General height () a)
-> (Vector height a -> Array (Full Size Big Big height ()) a)
-> Vector height a
-> General height () a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> Vector height a -> Array (Full Size Big Big height ()) a
forall height a. Order -> Vector height a -> General height () a
Basic.singleColumn Order
order

flattenRow :: General () width a -> Vector width a
flattenRow :: General () width a -> Vector width a
flattenRow = General () width a -> Vector width a
forall width a. General () width a -> Vector width a
Basic.flattenRow (General () width a -> Vector width a)
-> (General () width a -> General () width a)
-> General () width a
-> Vector width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. General () width a -> General () 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

flattenColumn :: General height () a -> Vector height a
flattenColumn :: General height () a -> Vector height a
flattenColumn = General height () a -> Vector height a
forall height a. General height () a -> Vector height a
Basic.flattenColumn (General height () a -> Vector height a)
-> (General height () a -> General height () a)
-> General height () a
-> Vector height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. General height () a -> General height () 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

liftRow ::
   Order ->
   (Vector height0 a -> Vector height1 b) ->
   General () height0 a -> General () height1 b
liftRow :: Order
-> (Vector height0 a -> Vector height1 b)
-> General () height0 a
-> General () height1 b
liftRow Order
order = (Array (Full Size Big Big () height0) a
 -> Array (Full Size Big Big () height1) b)
-> General () height0 a -> General () height1 b
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 () height0) a
  -> Array (Full Size Big Big () height1) b)
 -> General () height0 a -> General () height1 b)
-> ((Vector height0 a -> Vector height1 b)
    -> Array (Full Size Big Big () height0) a
    -> Array (Full Size Big Big () height1) b)
-> (Vector height0 a -> Vector height1 b)
-> General () height0 a
-> General () height1 b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order
-> (Vector height0 a -> Vector height1 b)
-> Array (Full Size Big Big () height0) a
-> Array (Full Size Big Big () height1) b
forall height0 a height1 b.
Order
-> (Vector height0 a -> Vector height1 b)
-> General () height0 a
-> General () height1 b
Basic.liftRow Order
order

liftColumn ::
   Order ->
   (Vector height0 a -> Vector height1 b) ->
   General height0 () a -> General height1 () b
liftColumn :: Order
-> (Vector height0 a -> Vector height1 b)
-> General height0 () a
-> General height1 () b
liftColumn Order
order = (Array (Full Size Big Big height0 ()) a
 -> Array (Full Size Big Big height1 ()) b)
-> General height0 () a -> General height1 () b
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 height0 ()) a
  -> Array (Full Size Big Big height1 ()) b)
 -> General height0 () a -> General height1 () b)
-> ((Vector height0 a -> Vector height1 b)
    -> Array (Full Size Big Big height0 ()) a
    -> Array (Full Size Big Big height1 ()) b)
-> (Vector height0 a -> Vector height1 b)
-> General height0 () a
-> General height1 () b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order
-> (Vector height0 a -> Vector height1 b)
-> Array (Full Size Big Big height0 ()) a
-> Array (Full Size Big Big height1 ()) b
forall height0 a height1 b.
Order
-> (Vector height0 a -> Vector height1 b)
-> General height0 () a
-> General height1 () b
Basic.liftColumn Order
order

unliftRow ::
   Order ->
   (General () height0 a -> General () height1 b) ->
   Vector height0 a -> Vector height1 b
unliftRow :: Order
-> (General () height0 a -> General () height1 b)
-> Vector height0 a
-> Vector height1 b
unliftRow Order
order = Order
-> (General () height0 a -> General () height1 b)
-> Vector height0 a
-> Vector height1 b
forall height0 a height1 b.
Order
-> (General () height0 a -> General () height1 b)
-> Vector height0 a
-> Vector height1 b
Basic.unliftRow Order
order ((General () height0 a -> General () height1 b)
 -> Vector height0 a -> Vector height1 b)
-> ((General () height0 a -> General () height1 b)
    -> General () height0 a -> General () height1 b)
-> (General () height0 a -> General () height1 b)
-> Vector height0 a
-> Vector height1 b
forall b c a. (b -> c) -> (a -> b) -> a -> c
.  (General () height0 a -> General () height1 b)
-> General () height0 a -> General () height1 b
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(FromPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(ArrayMatrix
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> ArrayMatrix
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> PlainArray
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> PlainArray
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.unlift1

unliftColumn ::
   Order ->
   (General height0 () a -> General height1 () b) ->
   Vector height0 a -> Vector height1 b
unliftColumn :: Order
-> (General height0 () a -> General height1 () b)
-> Vector height0 a
-> Vector height1 b
unliftColumn Order
order = Order
-> (General height0 () a -> General height1 () b)
-> Vector height0 a
-> Vector height1 b
forall height0 a height1 b.
Order
-> (General height0 () a -> General height1 () b)
-> Vector height0 a
-> Vector height1 b
Basic.unliftColumn Order
order ((General height0 () a -> General height1 () b)
 -> Vector height0 a -> Vector height1 b)
-> ((General height0 () a -> General height1 () b)
    -> General height0 () a -> General height1 () b)
-> (General height0 () a -> General height1 () b)
-> Vector height0 a
-> Vector height1 b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (General height0 () a -> General height1 () b)
-> General height0 () a -> General height1 () b
forall packA propA lowerA upperA measA vertA horizA heightA widthA
       packB propB lowerB upperB measB vertB horizB heightB widthB a b.
(FromPlain
   packA propA lowerA upperA measA vertA horizA heightA widthA,
 ToPlain
   packB propB lowerB upperB measB vertB horizB heightB widthB) =>
(ArrayMatrix
   packA propA lowerA upperA measA vertA horizA heightA widthA a
 -> ArrayMatrix
      packB propB lowerB upperB measB vertB horizB heightB widthB b)
-> PlainArray
     packA propA lowerA upperA measA vertA horizA heightA widthA a
-> PlainArray
     packB propB lowerB upperB measB vertB horizB heightB widthB b
ArrMatrix.unlift1


fromRowsNonEmpty ::
   (Shape.C width, Eq width, Storable a) =>
   NonEmpty.T [] (Vector width a) -> General ShapeInt width a
fromRowsNonEmpty :: T [] (Vector width a) -> General ShapeInt width a
fromRowsNonEmpty = Array (Full Size Big Big ShapeInt width) a
-> General ShapeInt width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big ShapeInt width) a
 -> General ShapeInt width a)
-> (T [] (Vector width a)
    -> Array (Full Size Big Big ShapeInt width) a)
-> T [] (Vector width a)
-> General ShapeInt width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. T [] (Vector width a) -> Array (Full Size Big Big ShapeInt width) a
forall width a.
(C width, Eq width, Storable a) =>
T [] (Vector width a) -> General ShapeInt width a
Plain.fromRowsNonEmpty

fromRowArray ::
   (Shape.C height, Shape.C width, Eq width, Storable a) =>
   width -> BoxedArray.Array height (Vector width a) -> General height width a
fromRowArray :: width -> Array height (Vector width a) -> General height width a
fromRowArray width
width = Array (Full Size Big Big height width) a -> General height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big height width) a
 -> General height width a)
-> (Array height (Vector width a)
    -> Array (Full Size Big Big height width) a)
-> Array height (Vector width a)
-> General height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. width
-> Array height (Vector width a)
-> Array (Full Size Big Big height width) a
forall height width a.
(C height, C width, Eq width, Storable a) =>
width -> Array height (Vector width a) -> General height width a
Plain.fromRowArray width
width

-- ToDo: generalize to a new NonEmpty.Head class
fromRowsNonEmptyContainer ::
   (f ~ NonEmpty.T g, Container.C g,
    Shape.C width, Eq width, Storable a) =>
   f (Vector width a) -> General (Container.Shape f) width a
fromRowsNonEmptyContainer :: f (Vector width a) -> General (Shape f) width a
fromRowsNonEmptyContainer = Array (Full Size Big Big (Shape f) width) a
-> General (Shape f) width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big (Shape f) width) a
 -> General (Shape f) width a)
-> (f (Vector width a)
    -> Array (Full Size Big Big (Shape f) width) a)
-> f (Vector width a)
-> General (Shape f) width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f (Vector width a) -> Array (Full Size Big Big (Shape f) width) a
forall (f :: * -> *) (g :: * -> *) width a.
(f ~ T g, C g, C width, Eq width, Storable a) =>
f (Vector width a) -> General (Shape f) width a
Plain.fromRowsNonEmptyContainer

fromRowContainer ::
   (Container.C f, Shape.C width, Eq width, Storable a) =>
   width -> f (Vector width a) -> General (Container.Shape f) width a
fromRowContainer :: width -> f (Vector width a) -> General (Shape f) width a
fromRowContainer width
width = Array (Full Size Big Big (Shape f) width) a
-> General (Shape f) width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big (Shape f) width) a
 -> General (Shape f) width a)
-> (f (Vector width a)
    -> Array (Full Size Big Big (Shape f) width) a)
-> f (Vector width a)
-> General (Shape f) width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. width
-> f (Vector width a)
-> Array (Full Size Big Big (Shape f) width) a
forall (f :: * -> *) width a.
(C f, C width, Eq width, Storable a) =>
width -> f (Vector width a) -> General (Shape f) width a
Plain.fromRowContainer width
width

fromRows ::
   (Shape.C width, Eq width, Storable a) =>
   width -> [Vector width a] -> General ShapeInt width a
fromRows :: width -> [Vector width a] -> General ShapeInt width a
fromRows width
width = Array (Full Size Big Big ShapeInt width) a
-> General ShapeInt width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big ShapeInt width) a
 -> General ShapeInt width a)
-> ([Vector width a] -> Array (Full Size Big Big ShapeInt width) a)
-> [Vector width a]
-> General ShapeInt width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. width
-> [Vector width a] -> Array (Full Size Big Big ShapeInt width) a
forall width a.
(C width, Eq width, Storable a) =>
width -> [Vector width a] -> General ShapeInt width a
Plain.fromRows width
width


fromColumnsNonEmpty ::
   (Shape.C height, Eq height, Storable a) =>
   NonEmpty.T [] (Vector height a) -> General height ShapeInt a
fromColumnsNonEmpty :: T [] (Vector height a) -> General height ShapeInt a
fromColumnsNonEmpty = Array (Full Size Big Big height ShapeInt) a
-> General height 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 (Full Size Big Big height ShapeInt) a
 -> General height ShapeInt a)
-> (T [] (Vector height a)
    -> Array (Full Size Big Big height ShapeInt) a)
-> T [] (Vector height a)
-> General height ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. T [] (Vector height a)
-> Array (Full Size Big Big height ShapeInt) a
forall height a.
(C height, Eq height, Storable a) =>
T [] (Vector height a) -> General height ShapeInt a
Plain.fromColumnsNonEmpty

fromColumnArray ::
   (Shape.C height, Eq height, Shape.C width, Storable a) =>
   height -> BoxedArray.Array width (Vector height a) -> General height width a
fromColumnArray :: height -> Array width (Vector height a) -> General height width a
fromColumnArray height
height = Array (Full Size Big Big height width) a -> General height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big height width) a
 -> General height width a)
-> (Array width (Vector height a)
    -> Array (Full Size Big Big height width) a)
-> Array width (Vector height a)
-> General height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. height
-> Array width (Vector height a)
-> Array (Full Size Big Big height width) a
forall height width a.
(C height, Eq height, C width, Storable a) =>
height -> Array width (Vector height a) -> General height width a
Plain.fromColumnArray height
height

fromColumnsNonEmptyContainer ::
   (f ~ NonEmpty.T g, Container.C g,
    Shape.C height, Eq height, Storable a) =>
   f (Vector height a) -> General height (Container.Shape f) a
fromColumnsNonEmptyContainer :: f (Vector height a) -> General height (Shape f) a
fromColumnsNonEmptyContainer =
   Array (Full Size Big Big height (Shape f)) a
-> General height (Shape f) 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 Size Big Big height (Shape f)) a
 -> General height (Shape f) a)
-> (f (Vector height a)
    -> Array (Full Size Big Big height (Shape f)) a)
-> f (Vector height a)
-> General height (Shape f) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f (Vector height a) -> Array (Full Size Big Big height (Shape f)) a
forall (f :: * -> *) (g :: * -> *) height a.
(f ~ T g, C g, C height, Eq height, Storable a) =>
f (Vector height a) -> General height (Shape f) a
Plain.fromColumnsNonEmptyContainer

fromColumnContainer ::
   (Container.C f, Shape.C height, Eq height, Storable a) =>
   height -> f (Vector height a) -> General height (Container.Shape f) a
fromColumnContainer :: height -> f (Vector height a) -> General height (Shape f) a
fromColumnContainer height
height = Array (Full Size Big Big height (Shape f)) a
-> General height (Shape f) 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 Size Big Big height (Shape f)) a
 -> General height (Shape f) a)
-> (f (Vector height a)
    -> Array (Full Size Big Big height (Shape f)) a)
-> f (Vector height a)
-> General height (Shape f) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. height
-> f (Vector height a)
-> Array (Full Size Big Big height (Shape f)) a
forall height (f :: * -> *) a.
(C height, Eq height, C f, Storable a) =>
height -> f (Vector height a) -> General height (Shape f) a
Plain.fromColumnContainer height
height

fromColumns ::
   (Shape.C height, Eq height, Storable a) =>
   height -> [Vector height a] -> General height ShapeInt a
fromColumns :: height -> [Vector height a] -> General height ShapeInt a
fromColumns height
height = Array (Full Size Big Big height ShapeInt) a
-> General height 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 (Full Size Big Big height ShapeInt) a
 -> General height ShapeInt a)
-> ([Vector height a]
    -> Array (Full Size Big Big height ShapeInt) a)
-> [Vector height a]
-> General height ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. height
-> [Vector height a] -> Array (Full Size Big Big height ShapeInt) a
forall height a.
(C height, Eq height, Storable a) =>
height -> [Vector height a] -> General height ShapeInt a
Plain.fromColumns height
height


toRows ::
   (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 -> [Vector width a]
toRows :: Full meas vert horiz height width a -> [Vector width a]
toRows = Full meas vert horiz height width a -> [Vector 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 -> [Vector width a]
Plain.toRows (Full meas vert horiz height width a -> [Vector width a])
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> [Vector 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

toColumns ::
   (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 -> [Vector height a]
toColumns :: Full meas vert horiz height width a -> [Vector height a]
toColumns = Full meas vert horiz height width a -> [Vector height 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 -> [Vector height a]
Plain.toColumns (Full meas vert horiz height width a -> [Vector height a])
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> [Vector height 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

toRowArray ::
   (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 ->
   BoxedArray.Array height (Vector width a)
toRowArray :: Full meas vert horiz height width a
-> Array height (Vector width a)
toRowArray = Full meas vert horiz height width a
-> Array height (Vector 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
-> Array height (Vector width a)
Plain.toRowArray (Full meas vert horiz height width a
 -> Array height (Vector width a))
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Array height (Vector 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

toColumnArray ::
   (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 ->
   BoxedArray.Array width (Vector height a)
toColumnArray :: Full meas vert horiz height width a
-> Array width (Vector height a)
toColumnArray = Full meas vert horiz height width a
-> Array width (Vector height 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
-> Array width (Vector height a)
Plain.toColumnArray (Full meas vert horiz height width a
 -> Array width (Vector height a))
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Array width (Vector height 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

toRowContainer ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Container.C f, Shape.C width, Class.Floating a) =>
   Full meas vert horiz (Container.Shape f) width a -> f (Vector width a)
toRowContainer :: Full meas vert horiz (Shape f) width a -> f (Vector width a)
toRowContainer = Full meas vert horiz (Shape f) width a -> f (Vector width a)
forall meas vert horiz (f :: * -> *) width a.
(Measure meas, C vert, C horiz, C f, C width, Floating a) =>
Full meas vert horiz (Shape f) width a -> f (Vector width a)
Plain.toRowContainer (Full meas vert horiz (Shape f) width a -> f (Vector width a))
-> (Full meas vert horiz (Shape f) width a
    -> Full meas vert horiz (Shape f) width a)
-> Full meas vert horiz (Shape f) width a
-> f (Vector width a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full meas vert horiz (Shape f) width a
-> Full meas vert horiz (Shape f) 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

toColumnContainer ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Container.C f, Class.Floating a) =>
   Full meas vert horiz height (Container.Shape f) a -> f (Vector height a)
toColumnContainer :: Full meas vert horiz height (Shape f) a -> f (Vector height a)
toColumnContainer = Full meas vert horiz height (Shape f) a -> f (Vector height a)
forall meas vert horiz height (f :: * -> *) a.
(Measure meas, C vert, C horiz, C height, C f, Floating a) =>
Full meas vert horiz height (Shape f) a -> f (Vector height a)
Plain.toColumnContainer (Full meas vert horiz height (Shape f) a -> f (Vector height a))
-> (Full meas vert horiz height (Shape f) a
    -> Full meas vert horiz height (Shape f) a)
-> Full meas vert horiz height (Shape f) a
-> f (Vector height a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full meas vert horiz height (Shape f) a
-> Full meas vert horiz height (Shape f) 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



{-
The parameter order is swapped with respect to 'takeRowArray'
but it is the order that is used most oftenly.
-}
takeRow ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.Indexed height, Shape.C width, Shape.Index height ~ ix,
    Class.Floating a) =>
   Full meas vert horiz height width a -> ix -> Vector width a
takeRow :: Full meas vert horiz height width a -> ix -> Vector width a
takeRow = Full meas vert horiz height width a -> ix -> Vector width a
forall meas vert horiz height width ix a.
(Measure meas, C vert, C horiz, Indexed height, C width,
 Index height ~ ix, Floating a) =>
Full meas vert horiz height width a -> ix -> Vector width a
Plain.takeRow (Full meas vert horiz height width a -> ix -> Vector width a)
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> ix
-> Vector 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

takeColumn ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.Indexed width, Shape.Index width ~ ix,
    Class.Floating a) =>
   Full meas vert horiz height width a -> ix -> Vector height a
takeColumn :: Full meas vert horiz height width a -> ix -> Vector height a
takeColumn = Full meas vert horiz height width a -> ix -> Vector height a
forall meas vert horiz height width ix a.
(Measure meas, C vert, C horiz, C height, Indexed width,
 Index width ~ ix, Floating a) =>
Full meas vert horiz height width a -> ix -> Vector height a
Plain.takeColumn (Full meas vert horiz height width a -> ix -> Vector height a)
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> ix
-> Vector height 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


takeTop ::
   (Extent.C vert, Shape.C height0, Shape.C height1, Shape.C width,
    Class.Floating a) =>
   Full Extent.Size vert Extent.Big (height0::+height1) width a ->
   Full Extent.Size vert Extent.Big height0 width a
takeTop :: Full Size vert Big (height0 ::+ height1) width a
-> Full Size vert Big height0 width a
takeTop = (PlainArray
   Unpacked
   Arbitrary
   Filled
   Filled
   Size
   vert
   Big
   (height0 ::+ height1)
   width
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size vert Big height0 width a)
-> Full Size vert Big (height0 ::+ height1) width a
-> Full Size vert Big height0 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
  vert
  Big
  (height0 ::+ height1)
  width
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size vert Big height0 width 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

takeBottom ::
   (Extent.C vert, Shape.C height0, Shape.C height1, Shape.C width,
    Class.Floating a) =>
   Full Extent.Size vert Extent.Big (height0::+height1) width a ->
   Full Extent.Size vert Extent.Big height1 width a
takeBottom :: Full Size vert Big (height0 ::+ height1) width a
-> Full Size vert Big height1 width a
takeBottom = (PlainArray
   Unpacked
   Arbitrary
   Filled
   Filled
   Size
   vert
   Big
   (height0 ::+ height1)
   width
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size vert Big height1 width a)
-> Full Size vert Big (height0 ::+ height1) width a
-> Full Size vert Big height1 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
  vert
  Big
  (height0 ::+ height1)
  width
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size vert Big height1 width 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

takeLeft ::
   (Extent.C vert, Shape.C height, Shape.C width0, Shape.C width1,
    Class.Floating a) =>
   Full Extent.Size Extent.Big vert height (width0::+width1) a ->
   Full Extent.Size Extent.Big vert height width0 a
takeLeft :: Full Size Big vert height (width0 ::+ width1) a
-> Full Size Big vert height width0 a
takeLeft = (PlainArray
   Unpacked
   Arbitrary
   Filled
   Filled
   Size
   Big
   vert
   height
   (width0 ::+ width1)
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big vert height width0 a)
-> Full Size Big vert height (width0 ::+ width1) a
-> Full Size Big vert height width0 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
  vert
  height
  (width0 ::+ width1)
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big vert height width0 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

takeRight ::
   (Extent.C vert, Shape.C height, Shape.C width0, Shape.C width1,
    Class.Floating a) =>
   Full Extent.Size Extent.Big vert height (width0::+width1) a ->
   Full Extent.Size Extent.Big vert height width1 a
takeRight :: Full Size Big vert height (width0 ::+ width1) a
-> Full Size Big vert height width1 a
takeRight = (PlainArray
   Unpacked
   Arbitrary
   Filled
   Filled
   Size
   Big
   vert
   height
   (width0 ::+ width1)
   a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big vert height width1 a)
-> Full Size Big vert height (width0 ::+ width1) a
-> Full Size Big vert height width1 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
  vert
  height
  (width0 ::+ width1)
  a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big vert height width1 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

takeRows, dropRows ::
   (Extent.C vert, Shape.C width, Class.Floating a) =>
   Int ->
   Full Extent.Size vert Extent.Big ShapeInt width a ->
   Full Extent.Size vert Extent.Big ShapeInt width a
takeRows :: Int
-> Full Size vert Big ShapeInt width a
-> Full Size vert Big ShapeInt width a
takeRows = (Array (Full Size vert Big ShapeInt width) a
 -> Array (Full Size vert Big ShapeInt width) a)
-> Full Size vert Big ShapeInt width a
-> Full Size vert Big ShapeInt 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 vert Big ShapeInt width) a
  -> Array (Full Size vert Big ShapeInt width) a)
 -> Full Size vert Big ShapeInt width a
 -> Full Size vert Big ShapeInt width a)
-> (Int
    -> Array (Full Size vert Big ShapeInt width) a
    -> Array (Full Size vert Big ShapeInt width) a)
-> Int
-> Full Size vert Big ShapeInt width a
-> Full Size vert Big ShapeInt width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full Size vert Big ShapeInt width) a
-> Array (Full Size vert Big ShapeInt width) a
forall vert width a.
(C vert, C width, Floating a) =>
Int
-> Full Size vert Big ShapeInt width a
-> Full Size vert Big ShapeInt width a
Basic.takeRows
dropRows :: Int
-> Full Size vert Big ShapeInt width a
-> Full Size vert Big ShapeInt width a
dropRows = (Array (Full Size vert Big ShapeInt width) a
 -> Array (Full Size vert Big ShapeInt width) a)
-> Full Size vert Big ShapeInt width a
-> Full Size vert Big ShapeInt 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 vert Big ShapeInt width) a
  -> Array (Full Size vert Big ShapeInt width) a)
 -> Full Size vert Big ShapeInt width a
 -> Full Size vert Big ShapeInt width a)
-> (Int
    -> Array (Full Size vert Big ShapeInt width) a
    -> Array (Full Size vert Big ShapeInt width) a)
-> Int
-> Full Size vert Big ShapeInt width a
-> Full Size vert Big ShapeInt width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full Size vert Big ShapeInt width) a
-> Array (Full Size vert Big ShapeInt width) a
forall vert width a.
(C vert, C width, Floating a) =>
Int
-> Full Size vert Big ShapeInt width a
-> Full Size vert Big ShapeInt width a
Basic.dropRows

takeColumns, dropColumns ::
   (Extent.C horiz, Shape.C height, Class.Floating a) =>
   Int ->
   Full Extent.Size Extent.Big horiz height ShapeInt a ->
   Full Extent.Size Extent.Big horiz height ShapeInt a
takeColumns :: Int
-> Full Size Big horiz height ShapeInt a
-> Full Size Big horiz height ShapeInt a
takeColumns = (Array (Full Size Big horiz height ShapeInt) a
 -> Array (Full Size Big horiz height ShapeInt) a)
-> Full Size Big horiz height ShapeInt a
-> Full Size Big horiz height ShapeInt 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 horiz height ShapeInt) a
  -> Array (Full Size Big horiz height ShapeInt) a)
 -> Full Size Big horiz height ShapeInt a
 -> Full Size Big horiz height ShapeInt a)
-> (Int
    -> Array (Full Size Big horiz height ShapeInt) a
    -> Array (Full Size Big horiz height ShapeInt) a)
-> Int
-> Full Size Big horiz height ShapeInt a
-> Full Size Big horiz height ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full Size Big horiz height ShapeInt) a
-> Array (Full Size Big horiz height ShapeInt) a
forall horiz height a.
(C horiz, C height, Floating a) =>
Int
-> Full Size Big horiz height ShapeInt a
-> Full Size Big horiz height ShapeInt a
Basic.takeColumns
dropColumns :: Int
-> Full Size Big horiz height ShapeInt a
-> Full Size Big horiz height ShapeInt a
dropColumns = (Array (Full Size Big horiz height ShapeInt) a
 -> Array (Full Size Big horiz height ShapeInt) a)
-> Full Size Big horiz height ShapeInt a
-> Full Size Big horiz height ShapeInt 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 horiz height ShapeInt) a
  -> Array (Full Size Big horiz height ShapeInt) a)
 -> Full Size Big horiz height ShapeInt a
 -> Full Size Big horiz height ShapeInt a)
-> (Int
    -> Array (Full Size Big horiz height ShapeInt) a
    -> Array (Full Size Big horiz height ShapeInt) a)
-> Int
-> Full Size Big horiz height ShapeInt a
-> Full Size Big horiz height ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full Size Big horiz height ShapeInt) a
-> Array (Full Size Big horiz height ShapeInt) a
forall horiz height a.
(C horiz, C height, Floating a) =>
Int
-> Full Size Big horiz height ShapeInt a
-> Full Size Big horiz height ShapeInt a
Basic.dropColumns


{- |
Take a left-top aligned square or as much as possible of it.
The advantange of this function is that it maintains the matrix size relation,
e.g. Square remains Square, Tall remains Tall.
-}
takeEqually ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz, Class.Floating a) =>
   Int ->
   Full meas vert horiz ShapeInt ShapeInt a ->
   Full meas vert horiz ShapeInt ShapeInt a
takeEqually :: Int
-> Full meas vert horiz ShapeInt ShapeInt a
-> Full meas vert horiz ShapeInt ShapeInt a
takeEqually = (Array (Full meas vert horiz ShapeInt ShapeInt) a
 -> Array (Full meas vert horiz ShapeInt ShapeInt) a)
-> Full meas vert horiz ShapeInt ShapeInt a
-> Full meas vert horiz ShapeInt ShapeInt 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 meas vert horiz ShapeInt ShapeInt) a
  -> Array (Full meas vert horiz ShapeInt ShapeInt) a)
 -> Full meas vert horiz ShapeInt ShapeInt a
 -> Full meas vert horiz ShapeInt ShapeInt a)
-> (Int
    -> Array (Full meas vert horiz ShapeInt ShapeInt) a
    -> Array (Full meas vert horiz ShapeInt ShapeInt) a)
-> Int
-> Full meas vert horiz ShapeInt ShapeInt a
-> Full meas vert horiz ShapeInt ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full meas vert horiz ShapeInt ShapeInt) a
-> Array (Full meas vert horiz ShapeInt ShapeInt) a
forall meas vert horiz a.
(Measure meas, C vert, C horiz, Floating a) =>
Int
-> Full meas vert horiz ShapeInt ShapeInt a
-> Full meas vert horiz ShapeInt ShapeInt a
Plain.takeEqually

{- |
Drop the same number of top-most rows and left-most columns.
The advantange of this function is that it maintains the matrix size relation,
e.g. Square remains Square, Tall remains Tall.
-}
dropEqually ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz, Class.Floating a) =>
   Int ->
   Full meas vert horiz ShapeInt ShapeInt a ->
   Full meas vert horiz ShapeInt ShapeInt a
dropEqually :: Int
-> Full meas vert horiz ShapeInt ShapeInt a
-> Full meas vert horiz ShapeInt ShapeInt a
dropEqually = (Array (Full meas vert horiz ShapeInt ShapeInt) a
 -> Array (Full meas vert horiz ShapeInt ShapeInt) a)
-> Full meas vert horiz ShapeInt ShapeInt a
-> Full meas vert horiz ShapeInt ShapeInt 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 meas vert horiz ShapeInt ShapeInt) a
  -> Array (Full meas vert horiz ShapeInt ShapeInt) a)
 -> Full meas vert horiz ShapeInt ShapeInt a
 -> Full meas vert horiz ShapeInt ShapeInt a)
-> (Int
    -> Array (Full meas vert horiz ShapeInt ShapeInt) a
    -> Array (Full meas vert horiz ShapeInt ShapeInt) a)
-> Int
-> Full meas vert horiz ShapeInt ShapeInt a
-> Full meas vert horiz ShapeInt ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full meas vert horiz ShapeInt ShapeInt) a
-> Array (Full meas vert horiz ShapeInt ShapeInt) a
forall meas vert horiz a.
(Measure meas, C vert, C horiz, Floating a) =>
Int
-> Full meas vert horiz ShapeInt ShapeInt a
-> Full meas vert horiz ShapeInt ShapeInt a
Plain.dropEqually


swapRows ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.Indexed height, Shape.C width, Class.Floating a) =>
   Shape.Index height -> Shape.Index height ->
   Full meas vert horiz height width a -> Full meas vert horiz height width a
swapRows :: Index height
-> Index height
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
swapRows Index height
i Index height
j = (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width 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 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 height width a)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> (PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
    -> PlainArray
         Unpacked Arbitrary Filled Filled meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall a b. (a -> b) -> a -> b
$ Index height
-> Index height
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, Indexed height, C width,
 Floating a) =>
Index height
-> Index height
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Plain.swapRows Index height
i Index height
j

swapColumns ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.Indexed width, Class.Floating a) =>
   Shape.Index width -> Shape.Index width ->
   Full meas vert horiz height width a -> Full meas vert horiz height width a
swapColumns :: Index width
-> Index width
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
swapColumns Index width
i Index width
j =  (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width 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 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 height width a)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> (PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width a
    -> PlainArray
         Unpacked Arbitrary Filled Filled meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall a b. (a -> b) -> a -> b
$ Index width
-> Index width
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, Indexed width,
 Floating a) =>
Index width
-> Index width
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Plain.swapColumns Index width
i Index width
j


reverseRows ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    ExtShape.Permutable height, Shape.C width, Class.Floating a) =>
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
reverseRows :: Full meas vert horiz height width a
-> Full meas vert horiz height width a
reverseRows = (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width 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 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 height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, Permutable height, C width,
 Floating a) =>
Full meas vert horiz height width a
-> Full meas vert horiz height width a
Plain.reverseRows

reverseColumns ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, ExtShape.Permutable width, Class.Floating a) =>
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
reverseColumns :: Full meas vert horiz height width a
-> Full meas vert horiz height width a
reverseColumns = (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz height width a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz height width 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 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 height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, Permutable width,
 Floating a) =>
Full meas vert horiz height width a
-> Full meas vert horiz height width a
Plain.reverseColumns


{- |
The function is optimized for blocks of consecutive rows.
For scattered rows in column major order
the function has quite ugly memory access patterns.
-}
takeRowArray ::
   (Shape.Indexed height, Shape.C width, Shape.C sh, Class.Floating a) =>
   BoxedArray.Array sh (Shape.Index height) ->
   General height width a -> General sh width a
takeRowArray :: Array sh (Index height)
-> General height width a -> General sh width a
takeRowArray = (Array (Full Size Big Big height width) a
 -> Array (Full Size Big Big sh width) a)
-> General height width a -> General sh 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 (Full Size Big Big sh width) a)
 -> General height width a -> General sh width a)
-> (Array sh (Index height)
    -> Array (Full Size Big Big height width) a
    -> Array (Full Size Big Big sh width) a)
-> Array sh (Index height)
-> General height width a
-> General sh width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array sh (Index height)
-> Array (Full Size Big Big height width) a
-> Array (Full Size Big Big sh width) a
forall height width sh a.
(Indexed height, C width, C sh, Floating a) =>
Array sh (Index height)
-> General height width a -> General sh width a
Plain.takeRowArray

takeColumnArray ::
   (Shape.C height, Shape.Indexed width, Shape.C sh, Class.Floating a) =>
   BoxedArray.Array sh (Shape.Index width) ->
   General height width a -> General height sh a
takeColumnArray :: Array sh (Index width)
-> General height width a -> General height sh a
takeColumnArray = (Array (Full Size Big Big height width) a
 -> Array (Full Size Big Big height sh) a)
-> General height width a -> General height 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 ((Array (Full Size Big Big height width) a
  -> Array (Full Size Big Big height sh) a)
 -> General height width a -> General height sh a)
-> (Array sh (Index width)
    -> Array (Full Size Big Big height width) a
    -> Array (Full Size Big Big height sh) a)
-> Array sh (Index width)
-> General height width a
-> General height sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array sh (Index width)
-> Array (Full Size Big Big height width) a
-> Array (Full Size Big Big height sh) a
forall height width sh a.
(C height, Indexed width, C sh, Floating a) =>
Array sh (Index width)
-> General height width a -> General height sh a
Plain.takeColumnArray



fromRowMajor ::
   (Shape.C height, Shape.C width, Class.Floating a) =>
   Array (height,width) a -> General height width a
fromRowMajor :: Array (height, width) a -> General height width a
fromRowMajor = Array (Full Size Big Big height width) a -> General height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big height width) a
 -> General height width a)
-> (Array (height, width) a
    -> Array (Full Size Big Big height width) a)
-> Array (height, width) a
-> General height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array (height, width) a -> Array (Full Size Big Big height width) a
forall height width a.
(C height, C width, Storable a) =>
Array (height, width) a -> General height width a
Plain.fromRowMajor

toRowMajor ::
   (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 -> Array (height,width) a
toRowMajor :: Full meas vert horiz height width a -> Array (height, width) a
toRowMajor = Full meas vert horiz height width a -> Array (height, 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 -> Array (height, width) a
Plain.toRowMajor (Full meas vert horiz height width a -> Array (height, width) a)
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Array (height, 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


infixr 3 |||
infixr 2 ===

(|||) ::
   (Extent.C vertA, Extent.C vertB, Extent.C vertC,
    Extent.Append vertA vertB ~ vertC,
    Shape.C height, Eq height, Shape.C widthA, Shape.C widthB,
    Class.Floating a) =>
   Full Extent.Size vertA Extent.Big height widthA a ->
   Full Extent.Size vertB Extent.Big height widthB a ->
   Full Extent.Size vertC Extent.Big height (widthA::+widthB) a
||| :: Full Size vertA Big height widthA a
-> Full Size vertB Big height widthB a
-> Full Size vertC Big height (widthA ::+ widthB) a
(|||) = OrderBias
-> AppendMode vertA vertB vertC height widthA widthB
-> Full Size vertA Big height widthA a
-> Full Size vertB Big height widthB a
-> Full Size vertC Big height (widthA ::+ widthB) a
forall vertA vertB vertC height widthA widthB a.
(C vertA, C vertB, C vertC, C height, Eq height, C widthA,
 C widthB, Floating a) =>
OrderBias
-> AppendMode vertA vertB vertC height widthA widthB
-> Full Size vertA Big height widthA a
-> Full Size vertB Big height widthB a
-> Full Size vertC Big height (widthA ::+ widthB) a
beside OrderBias
rightBias AppendMode vertA vertB vertC height widthA widthB
forall vertA vertB height widthA widthB.
(C vertA, C vertB) =>
AppendMode vertA vertB (Append vertA vertB) height widthA widthB
Extent.appendAny

(===) ::
   (Extent.C horizA, Extent.C horizB, Extent.C horizC,
    Extent.Append horizA horizB ~ horizC,
    Shape.C width, Eq width, Shape.C heightA, Shape.C heightB,
    Class.Floating a) =>
   Full Extent.Size Extent.Big horizA heightA width a ->
   Full Extent.Size Extent.Big horizB heightB width a ->
   Full Extent.Size Extent.Big horizC (heightA::+heightB) width a
=== :: Full Size Big horizA heightA width a
-> Full Size Big horizB heightB width a
-> Full Size Big horizC (heightA ::+ heightB) width a
(===) = OrderBias
-> AppendMode horizA horizB horizC width heightA heightB
-> Full Size Big horizA heightA width a
-> Full Size Big horizB heightB width a
-> Full Size Big horizC (heightA ::+ heightB) width a
forall horizA horizB horizC width heightA heightB a.
(C horizA, C horizB, C horizC, C width, Eq width, C heightA,
 C heightB, Floating a) =>
OrderBias
-> AppendMode horizA horizB horizC width heightA heightB
-> Full Size Big horizA heightA width a
-> Full Size Big horizB heightB width a
-> Full Size Big horizC (heightA ::+ heightB) width a
above OrderBias
rightBias AppendMode horizA horizB horizC width heightA heightB
forall vertA vertB height widthA widthB.
(C vertA, C vertB) =>
AppendMode vertA vertB (Append vertA vertB) height widthA widthB
Extent.appendAny

beside ::
   (Extent.C vertA, Extent.C vertB, Extent.C vertC,
    Shape.C height, Eq height, Shape.C widthA, Shape.C widthB,
    Class.Floating a) =>
   Basic.OrderBias ->
   Extent.AppendMode vertA vertB vertC height widthA widthB ->
   Full Extent.Size vertA Extent.Big height widthA a ->
   Full Extent.Size vertB Extent.Big height widthB a ->
   Full Extent.Size vertC Extent.Big height (widthA::+widthB) a
beside :: OrderBias
-> AppendMode vertA vertB vertC height widthA widthB
-> Full Size vertA Big height widthA a
-> Full Size vertB Big height widthB a
-> Full Size vertC Big height (widthA ::+ widthB) a
beside OrderBias
orderBias = (Array (Full Size vertA Big height widthA) a
 -> Array (Full Size vertB Big height widthB) a
 -> Array (Full Size vertC Big height (widthA ::+ widthB)) a)
-> Full Size vertA Big height widthA a
-> Full Size vertB Big height widthB a
-> Full Size vertC Big height (widthA ::+ widthB) 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 ((Array (Full Size vertA Big height widthA) a
  -> Array (Full Size vertB Big height widthB) a
  -> Array (Full Size vertC Big height (widthA ::+ widthB)) a)
 -> Full Size vertA Big height widthA a
 -> Full Size vertB Big height widthB a
 -> Full Size vertC Big height (widthA ::+ widthB) a)
-> (AppendMode vertA vertB vertC height widthA widthB
    -> Array (Full Size vertA Big height widthA) a
    -> Array (Full Size vertB Big height widthB) a
    -> Array (Full Size vertC Big height (widthA ::+ widthB)) a)
-> AppendMode vertA vertB vertC height widthA widthB
-> Full Size vertA Big height widthA a
-> Full Size vertB Big height widthB a
-> Full Size vertC Big height (widthA ::+ widthB) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OrderBias
-> AppendMode vertA vertB vertC height widthA widthB
-> Array (Full Size vertA Big height widthA) a
-> Array (Full Size vertB Big height widthB) a
-> Array (Full Size vertC Big height (widthA ::+ widthB)) a
forall vertA vertB vertC height widthA widthB a.
(C vertA, C vertB, C vertC, C height, Eq height, C widthA,
 C widthB, Floating a) =>
OrderBias
-> AppendMode vertA vertB vertC height widthA widthB
-> Full Size vertA Big height widthA a
-> Full Size vertB Big height widthB a
-> Full Size vertC Big height (widthA ::+ widthB) a
Basic.beside OrderBias
orderBias

above ::
   (Extent.C horizA, Extent.C horizB, Extent.C horizC,
    Shape.C width, Eq width, Shape.C heightA, Shape.C heightB,
    Class.Floating a) =>
   Basic.OrderBias ->
   Extent.AppendMode horizA horizB horizC width heightA heightB ->
   Full Extent.Size Extent.Big horizA heightA width a ->
   Full Extent.Size Extent.Big horizB heightB width a ->
   Full Extent.Size Extent.Big horizC (heightA::+heightB) width a
above :: OrderBias
-> AppendMode horizA horizB horizC width heightA heightB
-> Full Size Big horizA heightA width a
-> Full Size Big horizB heightB width a
-> Full Size Big horizC (heightA ::+ heightB) width a
above OrderBias
orderBias = (Array (Full Size Big horizA heightA width) a
 -> Array (Full Size Big horizB heightB width) a
 -> Array (Full Size Big horizC (heightA ::+ heightB) width) a)
-> Full Size Big horizA heightA width a
-> Full Size Big horizB heightB width a
-> Full Size Big horizC (heightA ::+ heightB) 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 ((Array (Full Size Big horizA heightA width) a
  -> Array (Full Size Big horizB heightB width) a
  -> Array (Full Size Big horizC (heightA ::+ heightB) width) a)
 -> Full Size Big horizA heightA width a
 -> Full Size Big horizB heightB width a
 -> Full Size Big horizC (heightA ::+ heightB) width a)
-> (AppendMode horizA horizB horizC width heightA heightB
    -> Array (Full Size Big horizA heightA width) a
    -> Array (Full Size Big horizB heightB width) a
    -> Array (Full Size Big horizC (heightA ::+ heightB) width) a)
-> AppendMode horizA horizB horizC width heightA heightB
-> Full Size Big horizA heightA width a
-> Full Size Big horizB heightB width a
-> Full Size Big horizC (heightA ::+ heightB) width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OrderBias
-> AppendMode horizA horizB horizC width heightA heightB
-> Array (Full Size Big horizA heightA width) a
-> Array (Full Size Big horizB heightB width) a
-> Array (Full Size Big horizC (heightA ::+ heightB) width) a
forall horizA horizB horizC width heightA heightB a.
(C horizA, C horizB, C horizC, C width, Eq width, C heightA,
 C heightB, Floating a) =>
OrderBias
-> AppendMode horizA horizB horizC width heightA heightB
-> Full Size Big horizA heightA width a
-> Full Size Big horizB heightB width a
-> Full Size Big horizC (heightA ::+ heightB) width a
Basic.above OrderBias
orderBias

{- |
Use the element order of the first operand.
-}
leftBias :: Basic.OrderBias
leftBias :: OrderBias
leftBias = OrderBias
Basic.LeftBias

{- |
Use the element order of the second operand.
-}
rightBias :: Basic.OrderBias
rightBias :: OrderBias
rightBias = OrderBias
Basic.RightBias

{- |
Choose element order such that, if possible,
one part can be copied as one block.
For 'above' this means that 'RowMajor' is chosen
whenever at least one operand is 'RowMajor'
and 'ColumnMajor' is chosen when both operands are 'ColumnMajor'.
-}
contiguousBias :: Basic.OrderBias
contiguousBias :: OrderBias
contiguousBias = OrderBias
Basic.ContiguousBias


stack ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C heightA, Eq heightA, Shape.C heightB, Eq heightB,
    Shape.C widthA, Eq widthA, Shape.C widthB, Eq widthB, Class.Floating a) =>
   Full meas vert horiz heightA widthA a -> General heightA widthB a ->
   General heightB widthA a -> Full meas vert horiz heightB widthB a ->
   Full meas vert horiz (heightA::+heightB) (widthA::+widthB) a
stack :: Full meas vert horiz heightA widthA a
-> General heightA widthB a
-> General heightB widthA a
-> Full meas vert horiz heightB widthB a
-> Full meas vert horiz (heightA ::+ heightB) (widthA ::+ widthB) a
stack = (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz heightA widthA a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big heightA widthB a
 -> PlainArray
      Unpacked Arbitrary Filled Filled Size Big Big heightB widthA a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz heightB widthB a
 -> PlainArray
      Unpacked
      Arbitrary
      Filled
      Filled
      meas
      vert
      horiz
      (heightA ::+ heightB)
      (widthA ::+ widthB)
      a)
-> Full meas vert horiz heightA widthA a
-> General heightA widthB a
-> General heightB widthA a
-> Full meas vert horiz heightB widthB a
-> Full meas vert horiz (heightA ::+ heightB) (widthA ::+ widthB) 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 packE propE lowerE
       upperE measE vertE horizE heightE widthE a b c d e.
(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,
 ToPlain
   packD propD lowerD upperD measD vertD horizD heightD widthD,
 FromPlain
   packE propE lowerE upperE measE vertE horizE heightE widthE) =>
(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
 -> PlainArray
      packE propE lowerE upperE measE vertE horizE heightE widthE e)
-> 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
-> ArrayMatrix
     packE propE lowerE upperE measE vertE horizE heightE widthE e
ArrMatrix.lift4 PlainArray
  Unpacked Arbitrary Filled Filled meas vert horiz heightA widthA a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big heightA widthB a
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big heightB widthA a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz heightB widthB a
-> PlainArray
     Unpacked
     Arbitrary
     Filled
     Filled
     meas
     vert
     horiz
     (heightA ::+ heightB)
     (widthA ::+ widthB)
     a
forall meas vert horiz heightA heightB widthA widthB a.
(Measure meas, C vert, C horiz, C heightA, Eq heightA, C heightB,
 Eq heightB, C widthA, Eq widthA, C widthB, Eq widthB,
 Floating a) =>
Full meas vert horiz heightA widthA a
-> General heightA widthB a
-> General heightB widthA a
-> Full meas vert horiz heightB widthB a
-> Full meas vert horiz (heightA ::+ heightB) (widthA ::+ widthB) a
Basic.stack



rowSums ::
   (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 -> Vector height a
rowSums :: Full meas vert horiz height width a -> Vector height a
rowSums = Full meas vert horiz height width a -> Vector height 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 -> Vector height a
Plain.rowSums (Full meas vert horiz height width a -> Vector height a)
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Vector height 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

columnSums ::
   (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 -> Vector width a
columnSums :: Full meas vert horiz height width a -> Vector width a
columnSums = Full meas vert horiz height width a -> Vector 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 -> Vector width a
Plain.columnSums (Full meas vert horiz height width a -> Vector width a)
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Vector 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


rowArgAbsMaximums ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.InvIndexed width, Shape.Index width ~ ix, Storable ix,
    Class.Floating a) =>
   Full meas vert horiz height width a -> (Vector height ix, Vector height a)
rowArgAbsMaximums :: Full meas vert horiz height width a
-> (Vector height ix, Vector height a)
rowArgAbsMaximums = Full meas vert horiz height width a
-> (Vector height ix, Vector height a)
forall meas vert horiz height width ix a.
(Measure meas, C vert, C horiz, C height, InvIndexed width,
 Index width ~ ix, Storable ix, Floating a) =>
Full meas vert horiz height width a
-> (Vector height ix, Vector height a)
Plain.rowArgAbsMaximums (Full meas vert horiz height width a
 -> (Vector height ix, Vector height a))
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> (Vector height ix, Vector height 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

columnArgAbsMaximums ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.InvIndexed height, Shape.C width,
    Shape.Index height ~ ix, Storable ix,
    Class.Floating a) =>
   Full meas vert horiz height width a -> (Vector width ix, Vector width a)
columnArgAbsMaximums :: Full meas vert horiz height width a
-> (Vector width ix, Vector width a)
columnArgAbsMaximums = Full meas vert horiz height width a
-> (Vector width ix, Vector width a)
forall meas vert horiz height width ix a.
(Measure meas, C vert, C horiz, InvIndexed height, C width,
 Index height ~ ix, Storable ix, Floating a) =>
Full meas vert horiz height width a
-> (Vector width ix, Vector width a)
Plain.columnArgAbsMaximums (Full meas vert horiz height width a
 -> (Vector width ix, Vector width a))
-> (Full meas vert horiz height width a
    -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> (Vector width ix, Vector 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


map ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Storable a, Storable b) =>
   (a -> b) ->
   Full meas vert horiz height width a -> Full meas vert horiz height width b
map :: (a -> b)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width b
map = (Array (Full meas vert horiz height width) a
 -> Array (Full meas vert horiz height width) b)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width b
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 meas vert horiz height width) a
  -> Array (Full meas vert horiz height width) b)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width b)
-> ((a -> b)
    -> Array (Full meas vert horiz height width) a
    -> Array (Full meas vert horiz height width) b)
-> (a -> b)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b)
-> Array (Full meas vert horiz height width) a
-> Array (Full meas vert horiz height width) b
forall sh a b.
(C sh, Storable a, Storable b) =>
(a -> b) -> Array sh a -> Array sh b
Array.map


infixl 7 |*-

(|*-) ::
   (Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>
   Vector height a -> Vector width a -> General height width a
Vector height a
x|*- :: Vector height a -> Vector width a -> General height width a
|*-Vector width a
y = PlainArray
  Unpacked Arbitrary Filled Filled Size Big Big height width a
-> General height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (PlainArray
   Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> General height width a)
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big height width a
-> General height width a
forall a b. (a -> b) -> a -> b
$ Vector height a
x Vector height a -> Vector width a -> General height width a
forall height width a.
(C height, C width, Floating a) =>
Vector height a -> Vector width a -> General height width a
Plain.|*- Vector width a
y

{- |
> tensorProduct order x y = singleColumn order x #*# singleRow order y
-}
tensorProduct ::
   (Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>
   Order -> Vector height a -> Vector width a -> General height width a
tensorProduct :: Order
-> Vector height a -> Vector width a -> General height width a
tensorProduct Order
order Vector height a
x Vector width a
y = PlainArray
  Unpacked Arbitrary Filled Filled Size Big Big height width a
-> General height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (PlainArray
   Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> General height width a)
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big height width a
-> General height width a
forall a b. (a -> b) -> a -> b
$ Order
-> Vector height a -> Vector width a -> General height width a
forall height width a.
(C height, C width, Floating a) =>
Order
-> Vector height a -> Vector width a -> General height width a
Plain.tensorProduct Order
order Vector height a
x Vector width a
y

{- |
> outer order x y = tensorProduct order x (Vector.conjugate y)
-}
outer ::
   (Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>
   Order -> Vector height a -> Vector width a -> General height width a
outer :: Order
-> Vector height a -> Vector width a -> General height width a
outer Order
order Vector height a
x Vector width a
y = PlainArray
  Unpacked Arbitrary Filled Filled Size Big Big height width a
-> General height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (PlainArray
   Unpacked Arbitrary Filled Filled Size Big Big height width a
 -> General height width a)
-> PlainArray
     Unpacked Arbitrary Filled Filled Size Big Big height width a
-> General height width a
forall a b. (a -> b) -> a -> b
$ Order
-> Vector height a -> Vector width a -> General height width a
forall height width a.
(C height, C width, Floating a) =>
Order
-> Vector height a -> Vector width a -> General height width a
Plain.outer Order
order Vector height a
x Vector width a
y

kronecker ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C heightA, Shape.C widthA, Shape.C heightB, Shape.C widthB,
    Class.Floating a) =>
   Full meas vert horiz heightA widthA a ->
   Full meas vert horiz heightB widthB a ->
   Full meas vert horiz (heightA,heightB) (widthA,widthB) a
kronecker :: Full meas vert horiz heightA widthA a
-> Full meas vert horiz heightB widthB a
-> Full meas vert horiz (heightA, heightB) (widthA, widthB) a
kronecker = (PlainArray
   Unpacked Arbitrary Filled Filled meas vert horiz heightA widthA a
 -> PlainArray
      Unpacked Arbitrary Filled Filled meas vert horiz heightB widthB a
 -> PlainArray
      Unpacked
      Arbitrary
      Filled
      Filled
      meas
      vert
      horiz
      (heightA, heightB)
      (widthA, widthB)
      a)
-> Full meas vert horiz heightA widthA a
-> Full meas vert horiz heightB widthB a
-> Full meas vert horiz (heightA, heightB) (widthA, widthB) 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 heightA widthA a
-> PlainArray
     Unpacked Arbitrary Filled Filled meas vert horiz heightB widthB a
-> PlainArray
     Unpacked
     Arbitrary
     Filled
     Filled
     meas
     vert
     horiz
     (heightA, heightB)
     (widthA, widthB)
     a
forall meas vert horiz heightA widthA heightB widthB a.
(Measure meas, C vert, C horiz, C heightA, C widthA, C heightB,
 C widthB, Floating a) =>
Full meas vert horiz heightA widthA a
-> Full meas vert horiz heightB widthB a
-> Full meas vert horiz (heightA, heightB) (widthA, widthB) a
Plain.kronecker

sumRank1 ::
   (Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>
   (height,width) ->
   [(a, (Vector height a, Vector width a))] -> General height width a
sumRank1 :: (height, width)
-> [(a, (Vector height a, Vector width a))]
-> General height width a
sumRank1 (height, width)
dims = Array (Full Size Big Big height width) a -> General height width a
forall pack prop lower upper meas vert horiz height width a.
FromPlain pack prop lower upper meas vert horiz height width =>
PlainArray pack prop lower upper meas vert horiz height width a
-> ArrayMatrix pack prop lower upper meas vert horiz height width a
ArrMatrix.lift0 (Array (Full Size Big Big height width) a
 -> General height width a)
-> ([(a, (Vector height a, Vector width a))]
    -> Array (Full Size Big Big height width) a)
-> [(a, (Vector height a, Vector width a))]
-> General height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (height, width)
-> [(a, (Vector height a, Vector width a))]
-> Array (Full Size Big Big height width) a
forall height width a.
(C height, Eq height, C width, Eq width, Floating a) =>
(height, width)
-> [(a, (Vector height a, Vector width a))]
-> General height width a
Plain.sumRank1 (height, width)
dims


infixl 7 #*\, #/\
infixr 7 \*#, \\#

scaleRows, (\*#) ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   Vector height a ->
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
scaleRows :: Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
scaleRows = (Array (Full meas vert horiz height width) a
 -> Array (Full meas vert horiz height width) 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 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 meas vert horiz height width) a
  -> Array (Full meas vert horiz height width) a)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> (Vector height a
    -> Array (Full meas vert horiz height width) a
    -> Array (Full meas vert horiz height width) a)
-> Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector height a
-> Array (Full meas vert horiz height width) a
-> Array (Full meas vert horiz height width) a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, Eq height, C width,
 Floating a) =>
Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Basic.scaleRows
\*# :: Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
(\*#) = Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, Eq height, C width,
 Floating a) =>
Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
scaleRows

scaleColumns ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Vector width a ->
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
scaleColumns :: Vector width a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
scaleColumns = (Array (Full meas vert horiz height width) a
 -> Array (Full meas vert horiz height width) 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 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 meas vert horiz height width) a
  -> Array (Full meas vert horiz height width) a)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> (Vector width a
    -> Array (Full meas vert horiz height width) a
    -> Array (Full meas vert horiz height width) a)
-> Vector width a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector width a
-> Array (Full meas vert horiz height width) a
-> Array (Full meas vert horiz height width) a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width, Eq width,
 Floating a) =>
Vector width a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Basic.scaleColumns

(#*\) ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Full meas vert horiz height width a ->
   Vector width a ->
   Full meas vert horiz height width a
#*\ :: Full meas vert horiz height width a
-> Vector width a -> Full meas vert horiz height width a
(#*\) = (Vector width a
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> Full meas vert horiz height width a
-> Vector width a
-> Full meas vert horiz height width a
forall a b c. (a -> b -> c) -> b -> a -> c
flip Vector width a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width, Eq width,
 Floating a) =>
Vector width a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
scaleColumns

scaleRowsReal ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   Vector height (RealOf a) ->
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
scaleRowsReal :: Vector height (RealOf a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
scaleRowsReal = (Array (Full meas vert horiz height width) a
 -> Array (Full meas vert horiz height width) 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 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 meas vert horiz height width) a
  -> Array (Full meas vert horiz height width) a)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> (Vector height (RealOf a)
    -> Array (Full meas vert horiz height width) a
    -> Array (Full meas vert horiz height width) a)
-> Vector height (RealOf a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector height (RealOf a)
-> Array (Full meas vert horiz height width) a
-> Array (Full meas vert horiz height width) a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, Eq height, C width,
 Floating a) =>
Vector height (RealOf a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Basic.scaleRowsReal

scaleColumnsReal ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Vector width (RealOf a) ->
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
scaleColumnsReal :: Vector width (RealOf a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
scaleColumnsReal = (Array (Full meas vert horiz height width) a
 -> Array (Full meas vert horiz height width) 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 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 meas vert horiz height width) a
  -> Array (Full meas vert horiz height width) a)
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> (Vector width (RealOf a)
    -> Array (Full meas vert horiz height width) a
    -> Array (Full meas vert horiz height width) a)
-> Vector width (RealOf a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector width (RealOf a)
-> Array (Full meas vert horiz height width) a
-> Array (Full meas vert horiz height width) a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width, Eq width,
 Floating a) =>
Vector width (RealOf a)
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Basic.scaleColumnsReal

(\\#) ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   Vector height a ->
   Full meas vert horiz height width a ->
   Full meas vert horiz height width a
\\# :: Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
(\\#) = Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, Eq height, C width,
 Floating a) =>
Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
scaleRows (Vector height a
 -> Full meas vert horiz height width a
 -> Full meas vert horiz height width a)
-> (Vector height a -> Vector height a)
-> Vector height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector height a -> Vector height a
forall sh a. (C sh, Floating a) => Vector sh a -> Vector sh a
Vector.recip

(#/\) ::
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Full meas vert horiz height width a ->
   Vector width a ->
   Full meas vert horiz height width a
#/\ :: Full meas vert horiz height width a
-> Vector width a -> Full meas vert horiz height width a
(#/\) Full meas vert horiz height width a
a Vector width a
x = Vector width a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall meas vert horiz height width a.
(Measure meas, C vert, C horiz, C height, C width, Eq width,
 Floating a) =>
Vector width a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
scaleColumns (Vector width a -> Vector width a
forall sh a. (C sh, Floating a) => Vector sh a -> Vector sh a
Vector.recip Vector width a
x) Full meas vert horiz height width a
a


multiplySquare ::
   (Multiply.MultiplySquare typ xl xu) =>
   (Omni.Strip lower, Omni.Strip upper) =>
   (Extent.Measure meas, Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   Mod.Transposition ->
   Matrix.Quadratic typ xl xu lower upper height a ->
   Full meas vert horiz height width a -> Full meas vert horiz height width a
multiplySquare :: Transposition
-> Quadratic typ xl xu lower upper height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
multiplySquare = Transposition
-> Quadratic typ xl xu lower upper height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
forall typ xl xu lower upper meas vert horiz height width a.
(MultiplySquare typ xl xu, Strip lower, Strip upper, Measure meas,
 C vert, C horiz, C height, Eq height, C width, Floating a) =>
Transposition
-> Quadratic typ xl xu lower upper height a
-> Full meas vert horiz height width a
-> Full meas vert horiz height width a
Multiply.transposableSquare