{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module Numeric.LAPACK.Matrix (
   Type.Matrix,
   Full,
   General, Tall, Wide, Square.Square,
   Triangular.Triangular, Triangular.Upper, Triangular.Lower,
   Triangular.Diagonal, Triangular.Symmetric,
   Hermitian.Hermitian,
   Permutation,

   ShapeInt, shapeInt,
   transpose, adjoint,
   Type.height, Type.width,
   Type.HeightOf, Type.WidthOf,
   Type.Box, Type.indices,
   ArrMatrix.reshape,
   ArrMatrix.mapShape,
   caseTallWide,
   fromScalar, toScalar,
   fromList,
   mapExtent, fromFull,
   asGeneral, asTall, asWide,
   tallFromGeneral, wideFromGeneral,
   generalizeTall, generalizeWide,
   mapHeight, mapWidth,
   identity,
   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,
   MatrixClass.identityFrom,
   MatrixClass.identityFromHeight, MatrixClass.identityFromWidth,
   MatrixClass.takeDiagonal, MatrixClass.trace,

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

   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.##*#), (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.Triangular as Triangular
import qualified Numeric.LAPACK.Matrix.Hermitian as Hermitian
import qualified Numeric.LAPACK.Matrix.Square as Square

import qualified Numeric.LAPACK.Matrix.Extent as Extent
import qualified Numeric.LAPACK.Matrix.Basic as Basic
import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix
import qualified Numeric.LAPACK.Matrix.Type as Type
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.Indexed as Indexed
import qualified Numeric.LAPACK.Matrix.Class as MatrixClass
import qualified Numeric.LAPACK.Matrix.Private as Matrix
import qualified Numeric.LAPACK.Vector as Vector
import Numeric.LAPACK.Matrix.Shape.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 Prelude hiding (map)


type Permutation sh = Type.Matrix (PermMatrix.Permutation sh)

mapExtent ::
   (Extent.C vertA, Extent.C horizA) =>
   (Extent.C vertB, Extent.C horizB) =>
   Extent.Map vertA horizA vertB horizB height width ->
   Full vertA horizA height width a -> Full vertB horizB height width a
mapExtent :: Map vertA horizA vertB horizB height width
-> Full vertA horizA height width a
-> Full vertB horizB height width a
mapExtent = (Array (Full vertA horizA height width) a
 -> Array (Full vertB horizB height width) a)
-> Full vertA horizA height width a
-> Full vertB horizB height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vertA horizA height width) a
  -> Array (Full vertB horizB height width) a)
 -> Full vertA horizA height width a
 -> Full vertB horizB height width a)
-> (Map vertA horizA vertB horizB height width
    -> Array (Full vertA horizA height width) a
    -> Array (Full vertB horizB height width) a)
-> Map vertA horizA vertB horizB height width
-> Full vertA horizA height width a
-> Full vertB horizB height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map vertA horizA vertB horizB height width
-> Array (Full vertA horizA height width) a
-> Array (Full vertB horizB height width) a
forall vertA horizA vertB horizB height width a.
(C vertA, C horizA, C vertB, C horizB) =>
Map vertA horizA vertB horizB height width
-> Full vertA horizA height width a
-> Full vertB horizB height width a
Plain.mapExtent

fromFull ::
   (Extent.C vert, Extent.C horiz) =>
   Full vert horiz height width a -> General height width a
fromFull :: Full vert horiz height width a -> General height width a
fromFull = (Array (Full vert horiz height width) a
 -> Array (General height width) a)
-> Full vert horiz height width a -> General height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full vert horiz height width) a
-> Array (General height width) a
forall vert horiz height width a.
(C vert, C horiz) =>
Full 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 = (Array (General height width) a -> Array (Tall height width) a)
-> General height width a -> Tall height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (General height width) a -> Array (Tall 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 = (Array (General height width) a -> Array (Wide height width) a)
-> General height width a -> Wide height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (General height width) a -> Array (Wide 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.C vert, Extent.C horiz) =>
   Full vert Extent.Small height width a -> Full vert horiz height width a
generalizeTall :: Full vert Small height width a -> Full vert horiz height width a
generalizeTall = Map vert Small vert horiz height width
-> Full vert Small height width a -> Full vert horiz height width a
forall vertA horizA vertB horizB height width a.
(C vertA, C horizA, C vertB, C horizB) =>
Map vertA horizA vertB horizB height width
-> Full vertA horizA height width a
-> Full vertB horizB height width a
mapExtent Map vert Small vert horiz height width
forall vert horiz height width.
(C vert, C horiz) =>
Map vert Small vert horiz height width
Extent.generalizeTall

generalizeWide ::
   (Extent.C vert, Extent.C horiz) =>
   Full Extent.Small horiz height width a -> Full vert horiz height width a
generalizeWide :: Full Small horiz height width a -> Full vert horiz height width a
generalizeWide = Map Small horiz vert horiz height width
-> Full Small horiz height width a
-> Full vert horiz height width a
forall vertA horizA vertB horizB height width a.
(C vertA, C horizA, C vertB, C horizB) =>
Map vertA horizA vertB horizB height width
-> Full vertA horizA height width a
-> Full vertB horizB height width a
mapExtent Map Small horiz vert horiz height width
forall vert horiz height width.
(C vert, C horiz) =>
Map Small horiz vert horiz height width
Extent.generalizeWide


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

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

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



fromScalar :: (Storable a) => a -> General () () a
fromScalar :: a -> General () () a
fromScalar = Full Small Small () () a -> General () () a
forall vert horiz height width a.
(C vert, C horiz) =>
Full vert horiz height width a -> General height width a
fromFull (Full Small Small () () a -> General () () a)
-> (a -> Full Small Small () () a) -> a -> General () () a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Full 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 Big Big () () a
-> Either (Array ((), ()) a) (Array ((), ()) a)
forall vert horiz height width a.
(C vert, C horiz) =>
Full vert horiz height width a
-> Either (Array (height, width) a) (Array (width, height) a)
Matrix.revealOrder (General () () a -> Full Big Big () () a
forall sh a. ArrayMatrix sh a -> Array sh 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 (General height width) a -> General height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height width) a -> General height width a)
-> ([a] -> Array (General height width) a)
-> [a]
-> General height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. height -> width -> [a] -> Array (General 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


identity ::
   (Shape.C sh, Class.Floating a) =>
   sh -> General sh sh a
identity :: sh -> General sh sh a
identity = Array (General sh sh) a -> General sh sh a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General sh sh) a -> General sh sh a)
-> (sh -> Array (General sh sh) a) -> sh -> General sh sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. sh -> Array (General sh sh) a
forall sh a. (C sh, Floating a) => sh -> General sh sh a
Plain.identity

diagonal ::
   (Shape.C sh, Class.Floating a) =>
   Vector sh a -> General sh sh a
diagonal :: Vector sh a -> General sh sh a
diagonal = Array (General sh sh) a -> General sh sh a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General sh sh) a -> General sh sh a)
-> (Vector sh a -> Array (General sh sh) a)
-> Vector sh a
-> General sh sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector sh a -> Array (General sh sh) a
forall sh a. (C sh, Floating a) => Vector sh a -> General sh sh a
Plain.diagonal


{- |
Square matrices will be classified as 'Tall'.
-}
caseTallWide ::
   (Extent.C vert, Extent.C horiz, Shape.C height, Shape.C width) =>
   Full vert horiz height width a ->
   Either (Tall height width a) (Wide height width a)
caseTallWide :: Full vert horiz height width a
-> Either (Tall height width a) (Wide height width a)
caseTallWide =
   (Array (Tall height width) a -> Tall height width a)
-> (Array (Wide height width) a -> Wide height width a)
-> Either
     (Array (Tall height width) a) (Array (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 Array (Tall height width) a -> Tall height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 Array (Wide height width) a -> Wide height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Either (Array (Tall height width) a) (Array (Wide height width) a)
 -> Either (Tall height width a) (Wide height width a))
-> (Full vert horiz height width a
    -> Either
         (Array (Tall height width) a) (Array (Wide height width) a))
-> Full 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 vert horiz height width a
-> Either
     (Array (Tall height width) a) (Array (Wide height width) a)
forall vert horiz height width a.
(C vert, C horiz, C height, C width) =>
Full vert horiz height width a
-> Either (Tall height width a) (Wide height width a)
Basic.caseTallWide (Full vert horiz height width a
 -> Either
      (Array (Tall height width) a) (Array (Wide height width) a))
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> Either
     (Array (Tall height width) a) (Array (Wide height width) a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector


transpose ::
   (Extent.C vert, Extent.C horiz) =>
   Full vert horiz height width a -> Full horiz vert width height a
transpose :: Full vert horiz height width a -> Full horiz vert width height a
transpose = (Array (Full vert horiz height width) a
 -> Array (Full horiz vert width height) a)
-> Full vert horiz height width a -> Full horiz vert width height a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full vert horiz height width) a
-> Array (Full horiz vert width height) a
forall vert horiz height width a.
(C vert, C horiz) =>
Full vert horiz height width a -> Full horiz vert width height a
Basic.transpose

{- |
conjugate transpose

Problem: @adjoint a \<\> a@ is always square,
but how to convince the type checker to choose the Square type?
Anser: Use @Hermitian.toSquare $ Hermitian.gramian a@ instead.
-}
adjoint ::
   (Extent.C vert, Extent.C horiz, Shape.C height, Shape.C width,
    Class.Floating a) =>
   Full vert horiz height width a -> Full horiz vert width height a
adjoint :: Full vert horiz height width a -> Full horiz vert width height a
adjoint = (Array (Full vert horiz height width) a
 -> Array (Full horiz vert width height) a)
-> Full vert horiz height width a -> Full horiz vert width height a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full vert horiz height width) a
-> Array (Full horiz vert width height) a
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Floating a) =>
Full vert horiz height width a -> Full horiz vert width height a
Basic.adjoint


{- |
The number of rows must be maintained by the height mapping function.
-}
mapHeight ::
   (Shape.C heightA, Shape.C heightB,
    Extent.GeneralTallWide vert horiz,
    Extent.GeneralTallWide horiz vert) =>
   (heightA -> heightB) ->
   Full vert horiz heightA width a ->
   Full vert horiz heightB width a
mapHeight :: (heightA -> heightB)
-> Full vert horiz heightA width a
-> Full vert horiz heightB width a
mapHeight = (Array (Full vert horiz heightA width) a
 -> Array (Full vert horiz heightB width) a)
-> Full vert horiz heightA width a
-> Full vert horiz heightB width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz heightA width) a
  -> Array (Full vert horiz heightB width) a)
 -> Full vert horiz heightA width a
 -> Full vert horiz heightB width a)
-> ((heightA -> heightB)
    -> Array (Full vert horiz heightA width) a
    -> Array (Full vert horiz heightB width) a)
-> (heightA -> heightB)
-> Full vert horiz heightA width a
-> Full vert horiz heightB width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (heightA -> heightB)
-> Array (Full vert horiz heightA width) a
-> Array (Full vert horiz heightB width) a
forall heightA heightB vert horiz width a.
(C heightA, C heightB, GeneralTallWide vert horiz,
 GeneralTallWide horiz vert) =>
(heightA -> heightB)
-> Full vert horiz heightA width a
-> Full vert horiz heightB width a
Plain.mapHeight

{- |
The number of columns must be maintained by the width mapping function.
-}
mapWidth ::
   (Shape.C widthA, Shape.C widthB,
    Extent.GeneralTallWide vert horiz,
    Extent.GeneralTallWide horiz vert) =>
   (widthA -> widthB) ->
   Full vert horiz height widthA a ->
   Full vert horiz height widthB a
mapWidth :: (widthA -> widthB)
-> Full vert horiz height widthA a
-> Full vert horiz height widthB a
mapWidth = (Array (Full vert horiz height widthA) a
 -> Array (Full vert horiz height widthB) a)
-> Full vert horiz height widthA a
-> Full vert horiz height widthB a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height widthA) a
  -> Array (Full vert horiz height widthB) a)
 -> Full vert horiz height widthA a
 -> Full vert horiz height widthB a)
-> ((widthA -> widthB)
    -> Array (Full vert horiz height widthA) a
    -> Array (Full vert horiz height widthB) a)
-> (widthA -> widthB)
-> Full vert horiz height widthA a
-> Full vert horiz height widthB a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (widthA -> widthB)
-> Array (Full vert horiz height widthA) a
-> Array (Full vert horiz height widthB) a
forall widthA widthB vert horiz height a.
(C widthA, C widthB, GeneralTallWide vert horiz,
 GeneralTallWide horiz vert) =>
(widthA -> widthB)
-> Full vert horiz height widthA a
-> Full vert horiz height widthB a
Plain.mapWidth


singleRow :: Order -> Vector width a -> General () width a
singleRow :: Order -> Vector width a -> General () width a
singleRow Order
order = Array (General () width) a -> General () width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General () width) a -> General () width a)
-> (Vector width a -> Array (General () width) a)
-> Vector width a
-> General () width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> Vector width a -> Array (General () 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 (General height ()) a -> General height () a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height ()) a -> General height () a)
-> (Vector height a -> Array (General height ()) a)
-> Vector height a
-> General height () a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Order -> Vector height a -> Array (General 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 sh a. ArrayMatrix sh a -> Array sh 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 sh a. ArrayMatrix sh a -> Array sh 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 (General () height0) a -> Array (General () height1) b)
-> General () height0 a -> General () height1 b
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (General () height0) a -> Array (General () height1) b)
 -> General () height0 a -> General () height1 b)
-> ((Vector height0 a -> Vector height1 b)
    -> Array (General () height0) a -> Array (General () 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 (General () height0) a
-> Array (General () 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 (General height0 ()) a -> Array (General height1 ()) b)
-> General height0 () a -> General height1 () b
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (General height0 ()) a -> Array (General height1 ()) b)
 -> General height0 () a -> General height1 () b)
-> ((Vector height0 a -> Vector height1 b)
    -> Array (General height0 ()) a -> Array (General 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 (General height0 ()) a
-> Array (General 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 shA a shB b.
(ArrayMatrix shA a -> ArrayMatrix shB b)
-> Array shA a -> Array shB 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 shA a shB b.
(ArrayMatrix shA a -> ArrayMatrix shB b)
-> Array shA a -> Array shB 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 (General ShapeInt width) a -> General ShapeInt width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General ShapeInt width) a -> General ShapeInt width a)
-> (T [] (Vector width a) -> Array (General 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 (General 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 (General height width) a -> General height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height width) a -> General height width a)
-> (Array height (Vector width a)
    -> Array (General 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 (General 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 (General (Shape f) width) a -> General (Shape f) width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General (Shape f) width) a -> General (Shape f) width a)
-> (f (Vector width a) -> Array (General (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 (General (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 (General (Shape f) width) a -> General (Shape f) width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General (Shape f) width) a -> General (Shape f) width a)
-> (f (Vector width a) -> Array (General (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 (General (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 (General ShapeInt width) a -> General ShapeInt width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General ShapeInt width) a -> General ShapeInt width a)
-> ([Vector width a] -> Array (General 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 (General 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 (General height ShapeInt) a -> General height ShapeInt a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height ShapeInt) a -> General height ShapeInt a)
-> (T [] (Vector height a) -> Array (General 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 (General 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 (General height width) a -> General height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height width) a -> General height width a)
-> (Array width (Vector height a)
    -> Array (General 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 (General 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 (General height (Shape f)) a -> General height (Shape f) a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height (Shape f)) a -> General height (Shape f) a)
-> (f (Vector height a) -> Array (General 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 (General 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 (General height (Shape f)) a -> General height (Shape f) a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height (Shape f)) a -> General height (Shape f) a)
-> (f (Vector height a) -> Array (General 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 (General 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 (General height ShapeInt) a -> General height ShapeInt a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height ShapeInt) a -> General height ShapeInt a)
-> ([Vector height a] -> Array (General 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 (General 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.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full vert horiz height width a -> [Vector width a]
toRows :: Full vert horiz height width a -> [Vector width a]
toRows = Full vert horiz height width a -> [Vector width a]
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Floating a) =>
Full vert horiz height width a -> [Vector width a]
Plain.toRows (Full vert horiz height width a -> [Vector width a])
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> [Vector width a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

toColumns ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full vert horiz height width a -> [Vector height a]
toColumns :: Full vert horiz height width a -> [Vector height a]
toColumns = Full vert horiz height width a -> [Vector height a]
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Floating a) =>
Full vert horiz height width a -> [Vector height a]
Plain.toColumns (Full vert horiz height width a -> [Vector height a])
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> [Vector height a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

toRowArray ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full vert horiz height width a -> BoxedArray.Array height (Vector width a)
toRowArray :: Full vert horiz height width a -> Array height (Vector width a)
toRowArray = Full vert horiz height width a -> Array height (Vector width a)
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Floating a) =>
Full vert horiz height width a -> Array height (Vector width a)
Plain.toRowArray (Full vert horiz height width a -> Array height (Vector width a))
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> Array height (Vector width a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

toColumnArray ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full vert horiz height width a -> BoxedArray.Array width (Vector height a)
toColumnArray :: Full vert horiz height width a -> Array width (Vector height a)
toColumnArray = Full vert horiz height width a -> Array width (Vector height a)
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Floating a) =>
Full vert horiz height width a -> Array width (Vector height a)
Plain.toColumnArray (Full vert horiz height width a -> Array width (Vector height a))
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> Array width (Vector height a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

toRowContainer ::
   (Extent.C vert, Extent.C horiz,
    Container.C f, Shape.C width, Class.Floating a) =>
   Full vert horiz (Container.Shape f) width a -> f (Vector width a)
toRowContainer :: Full vert horiz (Shape f) width a -> f (Vector width a)
toRowContainer = Full vert horiz (Shape f) width a -> f (Vector width a)
forall vert horiz (f :: * -> *) width a.
(C vert, C horiz, C f, C width, Floating a) =>
Full vert horiz (Shape f) width a -> f (Vector width a)
Plain.toRowContainer (Full vert horiz (Shape f) width a -> f (Vector width a))
-> (Full vert horiz (Shape f) width a
    -> Full vert horiz (Shape f) width a)
-> Full vert horiz (Shape f) width a
-> f (Vector width a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz (Shape f) width a
-> Full vert horiz (Shape f) width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

toColumnContainer ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Container.C f, Class.Floating a) =>
   Full vert horiz height (Container.Shape f) a -> f (Vector height a)
toColumnContainer :: Full vert horiz height (Shape f) a -> f (Vector height a)
toColumnContainer = Full vert horiz height (Shape f) a -> f (Vector height a)
forall vert horiz height (f :: * -> *) a.
(C vert, C horiz, C height, C f, Floating a) =>
Full vert horiz height (Shape f) a -> f (Vector height a)
Plain.toColumnContainer (Full vert horiz height (Shape f) a -> f (Vector height a))
-> (Full vert horiz height (Shape f) a
    -> Full vert horiz height (Shape f) a)
-> Full vert horiz height (Shape f) a
-> f (Vector height a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height (Shape f) a
-> Full vert horiz height (Shape f) a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector



{-
The parameter order is swapped with respect to 'takeRowArray'
but it is the order that is used most oftenly.
-}
takeRow ::
   (Extent.C vert, Extent.C horiz,
    Shape.Indexed height, Shape.C width, Shape.Index height ~ ix,
    Class.Floating a) =>
   Full vert horiz height width a -> ix -> Vector width a
takeRow :: Full vert horiz height width a -> ix -> Vector width a
takeRow = Full vert horiz height width a -> ix -> Vector width a
forall vert horiz height width ix a.
(C vert, C horiz, Indexed height, C width, Index height ~ ix,
 Floating a) =>
Full vert horiz height width a -> ix -> Vector width a
Plain.takeRow (Full vert horiz height width a -> ix -> Vector width a)
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> ix
-> Vector width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

takeColumn ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.Indexed width, Shape.Index width ~ ix,
    Class.Floating a) =>
   Full vert horiz height width a -> ix -> Vector height a
takeColumn :: Full vert horiz height width a -> ix -> Vector height a
takeColumn = Full vert horiz height width a -> ix -> Vector height a
forall vert horiz height width ix a.
(C vert, C horiz, C height, Indexed width, Index width ~ ix,
 Floating a) =>
Full vert horiz height width a -> ix -> Vector height a
Plain.takeColumn (Full vert horiz height width a -> ix -> Vector height a)
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> ix
-> Vector height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector


takeTop ::
   (Extent.C vert, Shape.C height0, Shape.C height1, Shape.C width,
    Class.Floating a) =>
   Full vert Extent.Big (height0:+:height1) width a ->
   Full vert Extent.Big height0 width a
takeTop :: Full vert Big (height0 :+: height1) width a
-> Full vert Big height0 width a
takeTop = (Array (Full vert Big (height0 :+: height1) width) a
 -> Array (Full vert Big height0 width) a)
-> Full vert Big (height0 :+: height1) width a
-> Full vert Big height0 width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full vert Big (height0 :+: height1) width) a
-> Array (Full vert Big height0 width) a
forall vert height0 height1 width a.
(C vert, C height0, C height1, C width, Floating a) =>
Full vert Big (height0 :+: height1) width a
-> Full vert Big height0 width a
Basic.takeTop

takeBottom ::
   (Extent.C vert, Shape.C height0, Shape.C height1, Shape.C width,
    Class.Floating a) =>
   Full vert Extent.Big (height0:+:height1) width a ->
   Full vert Extent.Big height1 width a
takeBottom :: Full vert Big (height0 :+: height1) width a
-> Full vert Big height1 width a
takeBottom = (Array (Full vert Big (height0 :+: height1) width) a
 -> Array (Full vert Big height1 width) a)
-> Full vert Big (height0 :+: height1) width a
-> Full vert Big height1 width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full vert Big (height0 :+: height1) width) a
-> Array (Full vert Big height1 width) a
forall vert height0 height1 width a.
(C vert, C height0, C height1, C width, Floating a) =>
Full vert Big (height0 :+: height1) width a
-> Full 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.Big vert height (width0:+:width1) a ->
   Full Extent.Big vert height width0 a
takeLeft :: Full Big vert height (width0 :+: width1) a
-> Full Big vert height width0 a
takeLeft = (Array (Full Big vert height (width0 :+: width1)) a
 -> Array (Full Big vert height width0) a)
-> Full Big vert height (width0 :+: width1) a
-> Full Big vert height width0 a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full Big vert height (width0 :+: width1)) a
-> Array (Full Big vert height width0) a
forall vert height width0 width1 a.
(C vert, C height, C width0, C width1, Floating a) =>
Full Big vert height (width0 :+: width1) a
-> Full 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.Big vert height (width0:+:width1) a ->
   Full Extent.Big vert height width1 a
takeRight :: Full Big vert height (width0 :+: width1) a
-> Full Big vert height width1 a
takeRight = (Array (Full Big vert height (width0 :+: width1)) a
 -> Array (Full Big vert height width1) a)
-> Full Big vert height (width0 :+: width1) a
-> Full Big vert height width1 a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full Big vert height (width0 :+: width1)) a
-> Array (Full Big vert height width1) a
forall vert height width0 width1 a.
(C vert, C height, C width0, C width1, Floating a) =>
Full Big vert height (width0 :+: width1) a
-> Full Big vert height width1 a
Basic.takeRight

takeRows, dropRows ::
   (Extent.C vert, Shape.C width, Class.Floating a) =>
   Int ->
   Full vert Extent.Big ShapeInt width a ->
   Full vert Extent.Big ShapeInt width a
takeRows :: Int
-> Full vert Big ShapeInt width a -> Full vert Big ShapeInt width a
takeRows = (Array (Full vert Big ShapeInt width) a
 -> Array (Full vert Big ShapeInt width) a)
-> Full vert Big ShapeInt width a -> Full vert Big ShapeInt width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert Big ShapeInt width) a
  -> Array (Full vert Big ShapeInt width) a)
 -> Full vert Big ShapeInt width a
 -> Full vert Big ShapeInt width a)
-> (Int
    -> Array (Full vert Big ShapeInt width) a
    -> Array (Full vert Big ShapeInt width) a)
-> Int
-> Full vert Big ShapeInt width a
-> Full vert Big ShapeInt width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full vert Big ShapeInt width) a
-> Array (Full vert Big ShapeInt width) a
forall vert width a.
(C vert, C width, Floating a) =>
Int
-> Full vert Big ShapeInt width a -> Full vert Big ShapeInt width a
Basic.takeRows
dropRows :: Int
-> Full vert Big ShapeInt width a -> Full vert Big ShapeInt width a
dropRows = (Array (Full vert Big ShapeInt width) a
 -> Array (Full vert Big ShapeInt width) a)
-> Full vert Big ShapeInt width a -> Full vert Big ShapeInt width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert Big ShapeInt width) a
  -> Array (Full vert Big ShapeInt width) a)
 -> Full vert Big ShapeInt width a
 -> Full vert Big ShapeInt width a)
-> (Int
    -> Array (Full vert Big ShapeInt width) a
    -> Array (Full vert Big ShapeInt width) a)
-> Int
-> Full vert Big ShapeInt width a
-> Full vert Big ShapeInt width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full vert Big ShapeInt width) a
-> Array (Full vert Big ShapeInt width) a
forall vert width a.
(C vert, C width, Floating a) =>
Int
-> Full vert Big ShapeInt width a -> Full vert Big ShapeInt width a
Basic.dropRows

takeColumns, dropColumns ::
   (Extent.C horiz, Shape.C height, Class.Floating a) =>
   Int ->
   Full Extent.Big horiz height ShapeInt a ->
   Full Extent.Big horiz height ShapeInt a
takeColumns :: Int
-> Full Big horiz height ShapeInt a
-> Full Big horiz height ShapeInt a
takeColumns = (Array (Full Big horiz height ShapeInt) a
 -> Array (Full Big horiz height ShapeInt) a)
-> Full Big horiz height ShapeInt a
-> Full Big horiz height ShapeInt a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full Big horiz height ShapeInt) a
  -> Array (Full Big horiz height ShapeInt) a)
 -> Full Big horiz height ShapeInt a
 -> Full Big horiz height ShapeInt a)
-> (Int
    -> Array (Full Big horiz height ShapeInt) a
    -> Array (Full Big horiz height ShapeInt) a)
-> Int
-> Full Big horiz height ShapeInt a
-> Full Big horiz height ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full Big horiz height ShapeInt) a
-> Array (Full Big horiz height ShapeInt) a
forall horiz height a.
(C horiz, C height, Floating a) =>
Int
-> Full Big horiz height ShapeInt a
-> Full Big horiz height ShapeInt a
Basic.takeColumns
dropColumns :: Int
-> Full Big horiz height ShapeInt a
-> Full Big horiz height ShapeInt a
dropColumns = (Array (Full Big horiz height ShapeInt) a
 -> Array (Full Big horiz height ShapeInt) a)
-> Full Big horiz height ShapeInt a
-> Full Big horiz height ShapeInt a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full Big horiz height ShapeInt) a
  -> Array (Full Big horiz height ShapeInt) a)
 -> Full Big horiz height ShapeInt a
 -> Full Big horiz height ShapeInt a)
-> (Int
    -> Array (Full Big horiz height ShapeInt) a
    -> Array (Full Big horiz height ShapeInt) a)
-> Int
-> Full Big horiz height ShapeInt a
-> Full Big horiz height ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full Big horiz height ShapeInt) a
-> Array (Full Big horiz height ShapeInt) a
forall horiz height a.
(C horiz, C height, Floating a) =>
Int
-> Full Big horiz height ShapeInt a
-> Full 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.C vert, Extent.C horiz, Class.Floating a) =>
   Int ->
   Full vert horiz ShapeInt ShapeInt a ->
   Full vert horiz ShapeInt ShapeInt a
takeEqually :: Int
-> Full vert horiz ShapeInt ShapeInt a
-> Full vert horiz ShapeInt ShapeInt a
takeEqually = (Array (Full vert horiz ShapeInt ShapeInt) a
 -> Array (Full vert horiz ShapeInt ShapeInt) a)
-> Full vert horiz ShapeInt ShapeInt a
-> Full vert horiz ShapeInt ShapeInt a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz ShapeInt ShapeInt) a
  -> Array (Full vert horiz ShapeInt ShapeInt) a)
 -> Full vert horiz ShapeInt ShapeInt a
 -> Full vert horiz ShapeInt ShapeInt a)
-> (Int
    -> Array (Full vert horiz ShapeInt ShapeInt) a
    -> Array (Full vert horiz ShapeInt ShapeInt) a)
-> Int
-> Full vert horiz ShapeInt ShapeInt a
-> Full vert horiz ShapeInt ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full vert horiz ShapeInt ShapeInt) a
-> Array (Full vert horiz ShapeInt ShapeInt) a
forall vert horiz a.
(C vert, C horiz, Floating a) =>
Int
-> Full vert horiz ShapeInt ShapeInt a
-> Full 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.C vert, Extent.C horiz, Class.Floating a) =>
   Int ->
   Full vert horiz ShapeInt ShapeInt a ->
   Full vert horiz ShapeInt ShapeInt a
dropEqually :: Int
-> Full vert horiz ShapeInt ShapeInt a
-> Full vert horiz ShapeInt ShapeInt a
dropEqually = (Array (Full vert horiz ShapeInt ShapeInt) a
 -> Array (Full vert horiz ShapeInt ShapeInt) a)
-> Full vert horiz ShapeInt ShapeInt a
-> Full vert horiz ShapeInt ShapeInt a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz ShapeInt ShapeInt) a
  -> Array (Full vert horiz ShapeInt ShapeInt) a)
 -> Full vert horiz ShapeInt ShapeInt a
 -> Full vert horiz ShapeInt ShapeInt a)
-> (Int
    -> Array (Full vert horiz ShapeInt ShapeInt) a
    -> Array (Full vert horiz ShapeInt ShapeInt) a)
-> Int
-> Full vert horiz ShapeInt ShapeInt a
-> Full vert horiz ShapeInt ShapeInt a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Array (Full vert horiz ShapeInt ShapeInt) a
-> Array (Full vert horiz ShapeInt ShapeInt) a
forall vert horiz a.
(C vert, C horiz, Floating a) =>
Int
-> Full vert horiz ShapeInt ShapeInt a
-> Full vert horiz ShapeInt ShapeInt a
Plain.dropEqually


swapRows ::
   (Extent.C vert, Extent.C horiz,
    Shape.Indexed height, Shape.C width, Class.Floating a) =>
   Shape.Index height -> Shape.Index height ->
   Full vert horiz height width a -> Full vert horiz height width a
swapRows :: Index height
-> Index height
-> Full vert horiz height width a
-> Full vert horiz height width a
swapRows Index height
i Index height
j = (Array (Full vert horiz height width) a
 -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a -> Full vert horiz height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height width) a
  -> Array (Full vert horiz height width) a)
 -> Full vert horiz height width a
 -> Full vert horiz height width a)
-> (Array (Full vert horiz height width) a
    -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a
-> Full vert horiz height width a
forall a b. (a -> b) -> a -> b
$ Index height
-> Index height
-> Array (Full vert horiz height width) a
-> Array (Full vert horiz height width) a
forall vert horiz height width a.
(C vert, C horiz, Indexed height, C width, Floating a) =>
Index height
-> Index height
-> Full vert horiz height width a
-> Full vert horiz height width a
Plain.swapRows Index height
i Index height
j

swapColumns ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.Indexed width, Class.Floating a) =>
   Shape.Index width -> Shape.Index width ->
   Full vert horiz height width a -> Full vert horiz height width a
swapColumns :: Index width
-> Index width
-> Full vert horiz height width a
-> Full vert horiz height width a
swapColumns Index width
i Index width
j =  (Array (Full vert horiz height width) a
 -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a -> Full vert horiz height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height width) a
  -> Array (Full vert horiz height width) a)
 -> Full vert horiz height width a
 -> Full vert horiz height width a)
-> (Array (Full vert horiz height width) a
    -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a
-> Full vert horiz height width a
forall a b. (a -> b) -> a -> b
$ Index width
-> Index width
-> Array (Full vert horiz height width) a
-> Array (Full vert horiz height width) a
forall vert horiz height width a.
(C vert, C horiz, C height, Indexed width, Floating a) =>
Index width
-> Index width
-> Full vert horiz height width a
-> Full vert horiz height width a
Plain.swapColumns Index width
i Index width
j


reverseRows ::
   (Extent.C vert, Extent.C horiz, Shape.C width, Class.Floating a) =>
   Full vert horiz ShapeInt width a -> Full vert horiz ShapeInt width a
reverseRows :: Full vert horiz ShapeInt width a
-> Full vert horiz ShapeInt width a
reverseRows = (Array (Full vert horiz ShapeInt width) a
 -> Array (Full vert horiz ShapeInt width) a)
-> Full vert horiz ShapeInt width a
-> Full vert horiz ShapeInt width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full vert horiz ShapeInt width) a
-> Array (Full vert horiz ShapeInt width) a
forall vert horiz width a.
(C vert, C horiz, C width, Floating a) =>
Full vert horiz ShapeInt width a
-> Full vert horiz ShapeInt width a
Plain.reverseRows

reverseColumns ::
   (Extent.C vert, Extent.C horiz, Shape.C height, Class.Floating a) =>
   Full vert horiz height ShapeInt a -> Full vert horiz height ShapeInt a
reverseColumns :: Full vert horiz height ShapeInt a
-> Full vert horiz height ShapeInt a
reverseColumns = (Array (Full vert horiz height ShapeInt) a
 -> Array (Full vert horiz height ShapeInt) a)
-> Full vert horiz height ShapeInt a
-> Full vert horiz height ShapeInt a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 Array (Full vert horiz height ShapeInt) a
-> Array (Full vert horiz height ShapeInt) a
forall vert horiz height a.
(C vert, C horiz, C height, Floating a) =>
Full vert horiz height ShapeInt a
-> Full vert horiz height ShapeInt 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 (General height width) a -> Array (General sh width) a)
-> General height width a -> General sh width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (General height width) a -> Array (General sh width) a)
 -> General height width a -> General sh width a)
-> (Array sh (Index height)
    -> Array (General height width) a -> Array (General 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 (General height width) a -> Array (General 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 (General height width) a -> Array (General height sh) a)
-> General height width a -> General height sh a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (General height width) a -> Array (General height sh) a)
 -> General height width a -> General height sh a)
-> (Array sh (Index width)
    -> Array (General height width) a -> Array (General 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 (General height width) a -> Array (General 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 (General height width) a -> General height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height width) a -> General height width a)
-> (Array (height, width) a -> Array (General 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 (General 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.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full vert horiz height width a -> Array (height,width) a
toRowMajor :: Full vert horiz height width a -> Array (height, width) a
toRowMajor = Full vert horiz height width a -> Array (height, width) a
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Floating a) =>
Full vert horiz height width a -> Array (height, width) a
Plain.toRowMajor (Full vert horiz height width a -> Array (height, width) a)
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> Array (height, width) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh 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 vertA Extent.Big height widthA a ->
   Full vertB Extent.Big height widthB a ->
   Full vertC Extent.Big height (widthA:+:widthB) a
||| :: Full vertA Big height widthA a
-> Full vertB Big height widthB a
-> Full vertC Big height (widthA :+: widthB) a
(|||) = OrderBias
-> AppendMode vertA vertB vertC height widthA widthB
-> Full vertA Big height widthA a
-> Full vertB Big height widthB a
-> Full 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 vertA Big height widthA a
-> Full vertB Big height widthB a
-> Full 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.Big horizA heightA width a ->
   Full Extent.Big horizB heightB width a ->
   Full Extent.Big horizC (heightA:+:heightB) width a
=== :: Full Big horizA heightA width a
-> Full Big horizB heightB width a
-> Full Big horizC (heightA :+: heightB) width a
(===) = OrderBias
-> AppendMode horizA horizB horizC width heightA heightB
-> Full Big horizA heightA width a
-> Full Big horizB heightB width a
-> Full 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 Big horizA heightA width a
-> Full Big horizB heightB width a
-> Full 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 vertA Extent.Big height widthA a ->
   Full vertB Extent.Big height widthB a ->
   Full vertC Extent.Big height (widthA:+:widthB) a
beside :: OrderBias
-> AppendMode vertA vertB vertC height widthA widthB
-> Full vertA Big height widthA a
-> Full vertB Big height widthB a
-> Full vertC Big height (widthA :+: widthB) a
beside OrderBias
orderBias = (Array (Full vertA Big height widthA) a
 -> Array (Full vertB Big height widthB) a
 -> Array (Full vertC Big height (widthA :+: widthB)) a)
-> Full vertA Big height widthA a
-> Full vertB Big height widthB a
-> Full vertC Big height (widthA :+: widthB) a
forall shA a shB b shC c.
(Array shA a -> Array shB b -> Array shC c)
-> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c
ArrMatrix.lift2 ((Array (Full vertA Big height widthA) a
  -> Array (Full vertB Big height widthB) a
  -> Array (Full vertC Big height (widthA :+: widthB)) a)
 -> Full vertA Big height widthA a
 -> Full vertB Big height widthB a
 -> Full vertC Big height (widthA :+: widthB) a)
-> (AppendMode vertA vertB vertC height widthA widthB
    -> Array (Full vertA Big height widthA) a
    -> Array (Full vertB Big height widthB) a
    -> Array (Full vertC Big height (widthA :+: widthB)) a)
-> AppendMode vertA vertB vertC height widthA widthB
-> Full vertA Big height widthA a
-> Full vertB Big height widthB a
-> Full 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 vertA Big height widthA) a
-> Array (Full vertB Big height widthB) a
-> Array (Full 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 vertA Big height widthA a
-> Full vertB Big height widthB a
-> Full 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.Big horizA heightA width a ->
   Full Extent.Big horizB heightB width a ->
   Full Extent.Big horizC (heightA:+:heightB) width a
above :: OrderBias
-> AppendMode horizA horizB horizC width heightA heightB
-> Full Big horizA heightA width a
-> Full Big horizB heightB width a
-> Full Big horizC (heightA :+: heightB) width a
above OrderBias
orderBias = (Array (Full Big horizA heightA width) a
 -> Array (Full Big horizB heightB width) a
 -> Array (Full Big horizC (heightA :+: heightB) width) a)
-> Full Big horizA heightA width a
-> Full Big horizB heightB width a
-> Full Big horizC (heightA :+: heightB) width a
forall shA a shB b shC c.
(Array shA a -> Array shB b -> Array shC c)
-> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c
ArrMatrix.lift2 ((Array (Full Big horizA heightA width) a
  -> Array (Full Big horizB heightB width) a
  -> Array (Full Big horizC (heightA :+: heightB) width) a)
 -> Full Big horizA heightA width a
 -> Full Big horizB heightB width a
 -> Full Big horizC (heightA :+: heightB) width a)
-> (AppendMode horizA horizB horizC width heightA heightB
    -> Array (Full Big horizA heightA width) a
    -> Array (Full Big horizB heightB width) a
    -> Array (Full Big horizC (heightA :+: heightB) width) a)
-> AppendMode horizA horizB horizC width heightA heightB
-> Full Big horizA heightA width a
-> Full Big horizB heightB width a
-> Full 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 Big horizA heightA width) a
-> Array (Full Big horizB heightB width) a
-> Array (Full 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 Big horizA heightA width a
-> Full Big horizB heightB width a
-> Full 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.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 vert horiz heightA widthA a -> General heightA widthB a ->
   General heightB widthA a -> Full vert horiz heightB widthB a ->
   Full vert horiz (heightA:+:heightB) (widthA:+:widthB) a
stack :: Full vert horiz heightA widthA a
-> General heightA widthB a
-> General heightB widthA a
-> Full vert horiz heightB widthB a
-> Full vert horiz (heightA :+: heightB) (widthA :+: widthB) a
stack = (Array (Full vert horiz heightA widthA) a
 -> Array (General heightA widthB) a
 -> Array (General heightB widthA) a
 -> Array (Full vert horiz heightB widthB) a
 -> Array
      (Full vert horiz (heightA :+: heightB) (widthA :+: widthB)) a)
-> Full vert horiz heightA widthA a
-> General heightA widthB a
-> General heightB widthA a
-> Full vert horiz heightB widthB a
-> Full vert horiz (heightA :+: heightB) (widthA :+: widthB) a
forall shA a shB b shC c shD d shE e.
(Array shA a
 -> Array shB b -> Array shC c -> Array shD d -> Array shE e)
-> ArrayMatrix shA a
-> ArrayMatrix shB b
-> ArrayMatrix shC c
-> ArrayMatrix shD d
-> ArrayMatrix shE e
ArrMatrix.lift4 Array (Full vert horiz heightA widthA) a
-> Array (General heightA widthB) a
-> Array (General heightB widthA) a
-> Array (Full vert horiz heightB widthB) a
-> Array
     (Full vert horiz (heightA :+: heightB) (widthA :+: widthB)) a
forall vert horiz heightA heightB widthA widthB a.
(C vert, C horiz, C heightA, Eq heightA, C heightB, Eq heightB,
 C widthA, Eq widthA, C widthB, Eq widthB, Floating a) =>
Full vert horiz heightA widthA a
-> General heightA widthB a
-> General heightB widthA a
-> Full vert horiz heightB widthB a
-> Full vert horiz (heightA :+: heightB) (widthA :+: widthB) a
Basic.stack



rowSums ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full vert horiz height width a -> Vector height a
rowSums :: Full vert horiz height width a -> Vector height a
rowSums = Full vert horiz height width a -> Vector height a
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Floating a) =>
Full vert horiz height width a -> Vector height a
Plain.rowSums (Full vert horiz height width a -> Vector height a)
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> Vector height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

columnSums ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Class.Floating a) =>
   Full vert horiz height width a -> Vector width a
columnSums :: Full vert horiz height width a -> Vector width a
columnSums = Full vert horiz height width a -> Vector width a
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Floating a) =>
Full vert horiz height width a -> Vector width a
Plain.columnSums (Full vert horiz height width a -> Vector width a)
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> Vector width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector


rowArgAbsMaximums ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.InvIndexed width, Shape.Index width ~ ix, Storable ix,
    Class.Floating a) =>
   Full vert horiz height width a -> (Vector height ix, Vector height a)
rowArgAbsMaximums :: Full vert horiz height width a
-> (Vector height ix, Vector height a)
rowArgAbsMaximums = Full vert horiz height width a
-> (Vector height ix, Vector height a)
forall vert horiz height width ix a.
(C vert, C horiz, C height, InvIndexed width, Index width ~ ix,
 Storable ix, Floating a) =>
Full vert horiz height width a
-> (Vector height ix, Vector height a)
Plain.rowArgAbsMaximums (Full vert horiz height width a
 -> (Vector height ix, Vector height a))
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> (Vector height ix, Vector height a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

columnArgAbsMaximums ::
   (Extent.C vert, Extent.C horiz,
    Shape.InvIndexed height, Shape.C width,
    Shape.Index height ~ ix, Storable ix,
    Class.Floating a) =>
   Full vert horiz height width a -> (Vector width ix, Vector width a)
columnArgAbsMaximums :: Full vert horiz height width a -> (Vector width ix, Vector width a)
columnArgAbsMaximums = Full vert horiz height width a -> (Vector width ix, Vector width a)
forall vert horiz height width ix a.
(C vert, C horiz, InvIndexed height, C width, Index height ~ ix,
 Storable ix, Floating a) =>
Full vert horiz height width a -> (Vector width ix, Vector width a)
Plain.columnArgAbsMaximums (Full vert horiz height width a
 -> (Vector width ix, Vector width a))
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> (Vector width ix, Vector width a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector


map ::
   (Extent.C vert, Extent.C horiz, Shape.C height, Shape.C width,
    Storable a, Storable b) =>
   (a -> b) ->
   Full vert horiz height width a -> Full vert horiz height width b
map :: (a -> b)
-> Full vert horiz height width a -> Full vert horiz height width b
map = (Array (Full vert horiz height width) a
 -> Array (Full vert horiz height width) b)
-> Full vert horiz height width a -> Full vert horiz height width b
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height width) a
  -> Array (Full vert horiz height width) b)
 -> Full vert horiz height width a
 -> Full vert horiz height width b)
-> ((a -> b)
    -> Array (Full vert horiz height width) a
    -> Array (Full vert horiz height width) b)
-> (a -> b)
-> Full vert horiz height width a
-> Full vert horiz height width b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b)
-> Array (Full vert horiz height width) a
-> Array (Full 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 = Array (General height width) a -> General height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height width) a -> General height width a)
-> Array (General height width) a -> General height width a
forall a b. (a -> b) -> a -> b
$ Vector height a
x Vector height a -> Vector width a -> Array (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 = Array (General height width) a -> General height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height width) a -> General height width a)
-> Array (General height width) a -> General height width a
forall a b. (a -> b) -> a -> b
$ Order
-> Vector height a
-> Vector width a
-> Array (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 = Array (General height width) a -> General height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height width) a -> General height width a)
-> Array (General height width) a -> General height width a
forall a b. (a -> b) -> a -> b
$ Order
-> Vector height a
-> Vector width a
-> Array (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.C vert, Extent.C horiz,
    Shape.C heightA, Shape.C widthA, Shape.C heightB, Shape.C widthB,
    Class.Floating a) =>
   Full vert horiz heightA widthA a ->
   Full vert horiz heightB widthB a ->
   Full vert horiz (heightA,heightB) (widthA,widthB) a
kronecker :: Full vert horiz heightA widthA a
-> Full vert horiz heightB widthB a
-> Full vert horiz (heightA, heightB) (widthA, widthB) a
kronecker = (Array (Full vert horiz heightA widthA) a
 -> Array (Full vert horiz heightB widthB) a
 -> Array (Full vert horiz (heightA, heightB) (widthA, widthB)) a)
-> Full vert horiz heightA widthA a
-> Full vert horiz heightB widthB a
-> Full vert horiz (heightA, heightB) (widthA, widthB) a
forall shA a shB b shC c.
(Array shA a -> Array shB b -> Array shC c)
-> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c
ArrMatrix.lift2 Array (Full vert horiz heightA widthA) a
-> Array (Full vert horiz heightB widthB) a
-> Array (Full vert horiz (heightA, heightB) (widthA, widthB)) a
forall vert horiz heightA widthA heightB widthB a.
(C vert, C horiz, C heightA, C widthA, C heightB, C widthB,
 Floating a) =>
Full vert horiz heightA widthA a
-> Full vert horiz heightB widthB a
-> Full 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 (General height width) a -> General height width a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (General height width) a -> General height width a)
-> ([(a, (Vector height a, Vector width a))]
    -> Array (General 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 (General 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.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   Vector height a ->
   Full vert horiz height width a ->
   Full vert horiz height width a
scaleRows :: Vector height a
-> Full vert horiz height width a -> Full vert horiz height width a
scaleRows = (Array (Full vert horiz height width) a
 -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a -> Full vert horiz height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height width) a
  -> Array (Full vert horiz height width) a)
 -> Full vert horiz height width a
 -> Full vert horiz height width a)
-> (Vector height a
    -> Array (Full vert horiz height width) a
    -> Array (Full vert horiz height width) a)
-> Vector height a
-> Full vert horiz height width a
-> Full vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector height a
-> Array (Full vert horiz height width) a
-> Array (Full vert horiz height width) a
forall vert horiz height width a.
(C vert, C horiz, C height, Eq height, C width, Floating a) =>
Vector height a
-> Full vert horiz height width a -> Full vert horiz height width a
Basic.scaleRows
\*# :: Vector height a
-> Full vert horiz height width a -> Full vert horiz height width a
(\*#) = Vector height a
-> Full vert horiz height width a -> Full vert horiz height width a
forall vert horiz height width a.
(C vert, C horiz, C height, Eq height, C width, Floating a) =>
Vector height a
-> Full vert horiz height width a -> Full vert horiz height width a
scaleRows

scaleColumns ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Vector width a ->
   Full vert horiz height width a ->
   Full vert horiz height width a
scaleColumns :: Vector width a
-> Full vert horiz height width a -> Full vert horiz height width a
scaleColumns = (Array (Full vert horiz height width) a
 -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a -> Full vert horiz height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height width) a
  -> Array (Full vert horiz height width) a)
 -> Full vert horiz height width a
 -> Full vert horiz height width a)
-> (Vector width a
    -> Array (Full vert horiz height width) a
    -> Array (Full vert horiz height width) a)
-> Vector width a
-> Full vert horiz height width a
-> Full vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector width a
-> Array (Full vert horiz height width) a
-> Array (Full vert horiz height width) a
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Eq width, Floating a) =>
Vector width a
-> Full vert horiz height width a -> Full vert horiz height width a
Basic.scaleColumns

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

scaleRowsReal ::
   (Extent.C vert, Extent.C horiz, Shape.C height, Eq height, Shape.C width,
    Class.Floating a) =>
   Vector height (RealOf a) ->
   Full vert horiz height width a ->
   Full vert horiz height width a
scaleRowsReal :: Vector height (RealOf a)
-> Full vert horiz height width a -> Full vert horiz height width a
scaleRowsReal = (Array (Full vert horiz height width) a
 -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a -> Full vert horiz height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height width) a
  -> Array (Full vert horiz height width) a)
 -> Full vert horiz height width a
 -> Full vert horiz height width a)
-> (Vector height (RealOf a)
    -> Array (Full vert horiz height width) a
    -> Array (Full vert horiz height width) a)
-> Vector height (RealOf a)
-> Full vert horiz height width a
-> Full vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector height (RealOf a)
-> Array (Full vert horiz height width) a
-> Array (Full vert horiz height width) a
forall vert horiz height width a.
(C vert, C horiz, C height, Eq height, C width, Floating a) =>
Vector height (RealOf a)
-> Full vert horiz height width a -> Full vert horiz height width a
Basic.scaleRowsReal

scaleColumnsReal ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Vector width (RealOf a) ->
   Full vert horiz height width a ->
   Full vert horiz height width a
scaleColumnsReal :: Vector width (RealOf a)
-> Full vert horiz height width a -> Full vert horiz height width a
scaleColumnsReal = (Array (Full vert horiz height width) a
 -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a -> Full vert horiz height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height width) a
  -> Array (Full vert horiz height width) a)
 -> Full vert horiz height width a
 -> Full vert horiz height width a)
-> (Vector width (RealOf a)
    -> Array (Full vert horiz height width) a
    -> Array (Full vert horiz height width) a)
-> Vector width (RealOf a)
-> Full vert horiz height width a
-> Full vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector width (RealOf a)
-> Array (Full vert horiz height width) a
-> Array (Full vert horiz height width) a
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Eq width, Floating a) =>
Vector width (RealOf a)
-> Full vert horiz height width a -> Full vert horiz height width a
Basic.scaleColumnsReal

(\\#) ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   Vector height a ->
   Full vert horiz height width a ->
   Full vert horiz height width a
\\# :: Vector height a
-> Full vert horiz height width a -> Full vert horiz height width a
(\\#) = Vector height a
-> Full vert horiz height width a -> Full vert horiz height width a
forall vert horiz height width a.
(C vert, C horiz, C height, Eq height, C width, Floating a) =>
Vector height a
-> Full vert horiz height width a -> Full vert horiz height width a
scaleRows (Vector height a
 -> Full vert horiz height width a
 -> Full vert horiz height width a)
-> (Vector height a -> Vector height a)
-> Vector height a
-> Full vert horiz height width a
-> Full 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.C vert, Extent.C horiz,
    Shape.C height, Shape.C width, Eq width, Class.Floating a) =>
   Full vert horiz height width a ->
   Vector width a ->
   Full vert horiz height width a
#/\ :: Full vert horiz height width a
-> Vector width a -> Full vert horiz height width a
(#/\) Full vert horiz height width a
a Vector width a
x = Vector width a
-> Full vert horiz height width a -> Full vert horiz height width a
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Eq width, Floating a) =>
Vector width a
-> Full vert horiz height width a -> Full 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 vert horiz height width a
a


multiplySquare ::
   (Multiply.MultiplySquare typ,
    Type.HeightOf typ ~ height, Eq height, Shape.C width,
    Extent.C vert, Extent.C horiz, Class.Floating a) =>
   Mod.Transposition -> Type.Matrix typ a ->
   Full vert horiz height width a -> Full vert horiz height width a
multiplySquare :: Transposition
-> Matrix typ a
-> Full vert horiz height width a
-> Full vert horiz height width a
multiplySquare = Transposition
-> Matrix typ a
-> Full vert horiz height width a
-> Full vert horiz height width a
forall typ height width vert horiz a.
(MultiplySquare typ, HeightOf typ ~ height, Eq height, C width,
 C vert, C horiz, Floating a) =>
Transposition
-> Matrix typ a
-> Full vert horiz height width a
-> Full vert horiz height width a
Multiply.transposableSquare

multiplyVector ::
   (Extent.C vert, Extent.C horiz, Shape.C height, Shape.C width, Eq width,
    Class.Floating a) =>
   Full vert horiz height width a -> Vector width a -> Vector height a
multiplyVector :: Full vert horiz height width a -> Vector width a -> Vector height a
multiplyVector = Full vert horiz height width a -> Vector width a -> Vector height a
forall vert horiz height width a.
(C vert, C horiz, C height, C width, Eq width, Floating a) =>
Full vert horiz height width a -> Vector width a -> Vector height a
Basic.multiplyVector (Full vert horiz height width a
 -> Vector width a -> Vector height a)
-> (Full vert horiz height width a
    -> Full vert horiz height width a)
-> Full vert horiz height width a
-> Vector width a
-> Vector height a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Full vert horiz height width a -> Full vert horiz height width a
forall sh a. ArrayMatrix sh a -> Array sh a
ArrMatrix.toVector

multiply ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height,
    Shape.C fuse, Eq fuse,
    Shape.C width,
    Class.Floating a) =>
   Full vert horiz height fuse a ->
   Full vert horiz fuse width a ->
   Full vert horiz height width a
multiply :: Full vert horiz height fuse a
-> Full vert horiz fuse width a -> Full vert horiz height width a
multiply = (Array (Full vert horiz height fuse) a
 -> Array (Full vert horiz fuse width) a
 -> Array (Full vert horiz height width) a)
-> Full vert horiz height fuse a
-> Full vert horiz fuse width a
-> Full vert horiz height width a
forall shA a shB b shC c.
(Array shA a -> Array shB b -> Array shC c)
-> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c
ArrMatrix.lift2 Array (Full vert horiz height fuse) a
-> Array (Full vert horiz fuse width) a
-> Array (Full vert horiz height width) a
forall vert horiz height fuse width a.
(C vert, C horiz, C height, C fuse, Eq fuse, C width,
 Floating a) =>
Full vert horiz height fuse a
-> Full vert horiz fuse width a -> Full vert horiz height width a
Basic.multiply