{-# LANGUAGE TypeFamilies #-}

module FPNLA.Operations.Parameters(
    -- * Elements
    Elt(..),
    -- * Strategies and contexts
    StratCtx(), 
    
    -- * Result type
    -- | In BLAS it's common that operations in higher levels use operations in the lower levels, so, an operation in level three that by its signature manipulates matrices only, internally uses level two operations that manipulates vectors. In order to avoid the /show . read/ problem, the type of the vector (or any other internal data type) must appear in the signature of an operation.
    -- To solve the problem we use phantom types to pass the internally used types to the Haskell type system.
    ResM(),
    ResV(),
    ResS(),
    blasResultM,
    blasResultV,
    blasResultS,
    getResultDataM,
    getResultDataV,
    getResultDataS,
    
    -- * Miscellaneous
    TransType(..),
    UnitType(..),
    TriangType(..),
    unTransT, 
    unUnitT, 
    unTriangT, 
    elemTrans_m,
    dimTrans_m,
    elemSymm,
    dimTriang,
    elemUnit_m,
    dimUnit_m,
    elemTransUnit_m,
    dimTransUnit_m,
    transTrans_m
    
) where

import FPNLA.Matrix(MatrixVector(..), Vector(..), Matrix(..))
import Data.Complex (Complex, conjugate)
import Data.Tuple (swap)


-- | This class represents the elements that can be used in the BLAS operations.
-- The elements in BLAS are real or complex numbers, so we provide default instances for the Haskell 'Double', 'Float' and 'Complex' types.
class (Eq e, Floating e) => Elt e where
    -- | Returns the conjugate of a number. For real numbers it's the identity function and for complex numbers it's the common 'Complex.conjugate' function.
    getConjugate :: e -> e
    getConjugate = e -> e
forall a. a -> a
id

instance Elt Double
instance Elt Float
instance (RealFloat e) => Elt (Complex e) where
    getConjugate :: Complex e -> Complex e
getConjugate = Complex e -> Complex e
forall a. Num a => Complex a -> Complex a
conjugate

-- | This type family is used to represent the /context/ of an operation.
-- A particular implementation is a combination of an algorithm and a parallelism technique, and we call it a /strategy/. A particular strategy may need particular information to execute. For example, an operation that computes the matrix-matrix multiplication by splitting the matrices in blocks must require the size of the blocks.
-- With this context we allows to pass any additional information that the operation needs to execute as parameters, but maintaining a common signature.
-- The /s/ type parameter is the strategy so, there must exist a Haskell data type to represent a particular strategy.
type family StratCtx s :: *


-- | The 'ResM' data type is used as result of level three BLAS operations and returns a matrix /m/ of elements /e/ and contains the strategy /s/ and vector /v/ as phantom types.
data ResM s (v :: * -> *) m e = ResM { forall s (v :: * -> *) (m :: * -> *) e. ResM s v m e -> m e
unResM :: m e } deriving (Int -> ResM s v m e -> ShowS
[ResM s v m e] -> ShowS
ResM s v m e -> String
(Int -> ResM s v m e -> ShowS)
-> (ResM s v m e -> String)
-> ([ResM s v m e] -> ShowS)
-> Show (ResM s v m e)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall s (v :: * -> *) (m :: * -> *) e.
Show (m e) =>
Int -> ResM s v m e -> ShowS
forall s (v :: * -> *) (m :: * -> *) e.
Show (m e) =>
[ResM s v m e] -> ShowS
forall s (v :: * -> *) (m :: * -> *) e.
Show (m e) =>
ResM s v m e -> String
$cshowsPrec :: forall s (v :: * -> *) (m :: * -> *) e.
Show (m e) =>
Int -> ResM s v m e -> ShowS
showsPrec :: Int -> ResM s v m e -> ShowS
$cshow :: forall s (v :: * -> *) (m :: * -> *) e.
Show (m e) =>
ResM s v m e -> String
show :: ResM s v m e -> String
$cshowList :: forall s (v :: * -> *) (m :: * -> *) e.
Show (m e) =>
[ResM s v m e] -> ShowS
showList :: [ResM s v m e] -> ShowS
Show)
-- | The 'ResV' data type is used as result of level two BLAS operations and returns a vector /v/ of elements /e/ and contains the strategy /s/ as phantom types.
data ResV s v e = ResV { forall s (v :: * -> *) e. ResV s v e -> v e
unResV :: v e } deriving (Int -> ResV s v e -> ShowS
[ResV s v e] -> ShowS
ResV s v e -> String
(Int -> ResV s v e -> ShowS)
-> (ResV s v e -> String)
-> ([ResV s v e] -> ShowS)
-> Show (ResV s v e)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall s (v :: * -> *) e. Show (v e) => Int -> ResV s v e -> ShowS
forall s (v :: * -> *) e. Show (v e) => [ResV s v e] -> ShowS
forall s (v :: * -> *) e. Show (v e) => ResV s v e -> String
$cshowsPrec :: forall s (v :: * -> *) e. Show (v e) => Int -> ResV s v e -> ShowS
showsPrec :: Int -> ResV s v e -> ShowS
$cshow :: forall s (v :: * -> *) e. Show (v e) => ResV s v e -> String
show :: ResV s v e -> String
$cshowList :: forall s (v :: * -> *) e. Show (v e) => [ResV s v e] -> ShowS
showList :: [ResV s v e] -> ShowS
Show)
-- | The 'ResS' data type is used as result of level one BLAS operations and returns an scalar /e/ and contains the strategy /s/ as phantom types.
data ResS s e = ResS { forall s e. ResS s e -> e
unResS :: e } deriving (Int -> ResS s e -> ShowS
[ResS s e] -> ShowS
ResS s e -> String
(Int -> ResS s e -> ShowS)
-> (ResS s e -> String) -> ([ResS s e] -> ShowS) -> Show (ResS s e)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall s e. Show e => Int -> ResS s e -> ShowS
forall s e. Show e => [ResS s e] -> ShowS
forall s e. Show e => ResS s e -> String
$cshowsPrec :: forall s e. Show e => Int -> ResS s e -> ShowS
showsPrec :: Int -> ResS s e -> ShowS
$cshow :: forall s e. Show e => ResS s e -> String
show :: ResS s e -> String
$cshowList :: forall s e. Show e => [ResS s e] -> ShowS
showList :: [ResS s e] -> ShowS
Show)


-- | Wrap a matrix into a 'ResM'.
blasResultM :: (MatrixVector m v e) => m e -> ResM s v m e
blasResultM :: forall (m :: * -> *) (v :: * -> *) e s.
MatrixVector m v e =>
m e -> ResM s v m e
blasResultM = m e -> ResM s v m e
forall s (v :: * -> *) (m :: * -> *) e. m e -> ResM s v m e
ResM
-- | Unwrap a matrix from a 'ResM'.
getResultDataM :: (MatrixVector m v e) => ResM s v m e -> m e
getResultDataM :: forall (m :: * -> *) (v :: * -> *) e s.
MatrixVector m v e =>
ResM s v m e -> m e
getResultDataM = ResM s v m e -> m e
forall s (v :: * -> *) (m :: * -> *) e. ResM s v m e -> m e
unResM

-- | Wrap a vector into a 'ResV'.
blasResultV :: (Vector v e) => v e -> ResV s v e
blasResultV :: forall (v :: * -> *) e s. Vector v e => v e -> ResV s v e
blasResultV = v e -> ResV s v e
forall s (v :: * -> *) e. v e -> ResV s v e
ResV
-- | Unwrap a vector from a 'ResV'.
getResultDataV :: (Vector v e) => ResV s v e -> v e
getResultDataV :: forall (v :: * -> *) e s. Vector v e => ResV s v e -> v e
getResultDataV = ResV s v e -> v e
forall s (v :: * -> *) e. ResV s v e -> v e
unResV

-- | Wrap a scalar into a 'ResS'.
blasResultS :: e -> ResS s e
blasResultS :: forall e s. e -> ResS s e
blasResultS = e -> ResS s e
forall s e. e -> ResS s e
ResS
-- | Unwrap a scalar from a 'ResS'.
getResultDataS :: ResS s e -> e
getResultDataS :: forall s e. ResS s e -> e
getResultDataS = ResS s e -> e
forall s e. ResS s e -> e
unResS


-- | Indicates if a matrix must be considered as normal, transposed or transposed conjugated.
-- This is part of the common flags in the BLAS operation signatures and it's useful to work with a transposed matrix without really computing the transposed matrix.
data TransType m = Trans m | NoTrans m | ConjTrans m deriving (TransType m -> TransType m -> Bool
(TransType m -> TransType m -> Bool)
-> (TransType m -> TransType m -> Bool) -> Eq (TransType m)
forall m. Eq m => TransType m -> TransType m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall m. Eq m => TransType m -> TransType m -> Bool
== :: TransType m -> TransType m -> Bool
$c/= :: forall m. Eq m => TransType m -> TransType m -> Bool
/= :: TransType m -> TransType m -> Bool
Eq, Int -> TransType m -> ShowS
[TransType m] -> ShowS
TransType m -> String
(Int -> TransType m -> ShowS)
-> (TransType m -> String)
-> ([TransType m] -> ShowS)
-> Show (TransType m)
forall m. Show m => Int -> TransType m -> ShowS
forall m. Show m => [TransType m] -> ShowS
forall m. Show m => TransType m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall m. Show m => Int -> TransType m -> ShowS
showsPrec :: Int -> TransType m -> ShowS
$cshow :: forall m. Show m => TransType m -> String
show :: TransType m -> String
$cshowList :: forall m. Show m => [TransType m] -> ShowS
showList :: [TransType m] -> ShowS
Show)
-- | Indicates if a matrix must be considered as unitary or not. An unitary matrix is a matrix that contains ones in the diagonal.
-- This is part of the common flags in the BLAS operation signatures.
data UnitType m = Unit m | NoUnit m deriving (UnitType m -> UnitType m -> Bool
(UnitType m -> UnitType m -> Bool)
-> (UnitType m -> UnitType m -> Bool) -> Eq (UnitType m)
forall m. Eq m => UnitType m -> UnitType m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall m. Eq m => UnitType m -> UnitType m -> Bool
== :: UnitType m -> UnitType m -> Bool
$c/= :: forall m. Eq m => UnitType m -> UnitType m -> Bool
/= :: UnitType m -> UnitType m -> Bool
Eq, Int -> UnitType m -> ShowS
[UnitType m] -> ShowS
UnitType m -> String
(Int -> UnitType m -> ShowS)
-> (UnitType m -> String)
-> ([UnitType m] -> ShowS)
-> Show (UnitType m)
forall m. Show m => Int -> UnitType m -> ShowS
forall m. Show m => [UnitType m] -> ShowS
forall m. Show m => UnitType m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall m. Show m => Int -> UnitType m -> ShowS
showsPrec :: Int -> UnitType m -> ShowS
$cshow :: forall m. Show m => UnitType m -> String
show :: UnitType m -> String
$cshowList :: forall m. Show m => [UnitType m] -> ShowS
showList :: [UnitType m] -> ShowS
Show)
-- | Indicates that a matrix is symmetric and with which triangular part of the matrix the operation is going to work ('Upper' or 'Lower').
-- The operation only will see the indicated part of the matrix and should not try to access the other part.
-- This is part of the common flags in the BLAS operation signatures.
data TriangType m = Lower m | Upper m deriving (TriangType m -> TriangType m -> Bool
(TriangType m -> TriangType m -> Bool)
-> (TriangType m -> TriangType m -> Bool) -> Eq (TriangType m)
forall m. Eq m => TriangType m -> TriangType m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall m. Eq m => TriangType m -> TriangType m -> Bool
== :: TriangType m -> TriangType m -> Bool
$c/= :: forall m. Eq m => TriangType m -> TriangType m -> Bool
/= :: TriangType m -> TriangType m -> Bool
Eq, Int -> TriangType m -> ShowS
[TriangType m] -> ShowS
TriangType m -> String
(Int -> TriangType m -> ShowS)
-> (TriangType m -> String)
-> ([TriangType m] -> ShowS)
-> Show (TriangType m)
forall m. Show m => Int -> TriangType m -> ShowS
forall m. Show m => [TriangType m] -> ShowS
forall m. Show m => TriangType m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall m. Show m => Int -> TriangType m -> ShowS
showsPrec :: Int -> TriangType m -> ShowS
$cshow :: forall m. Show m => TriangType m -> String
show :: TriangType m -> String
$cshowList :: forall m. Show m => [TriangType m] -> ShowS
showList :: [TriangType m] -> ShowS
Show)

-- | Given a data type flagged by a TransType, returns a pair containing the TransType constructor and the data type.
unTransT :: TransType a -> (b -> TransType b, a)
unTransT :: forall a b. TransType a -> (b -> TransType b, a)
unTransT (Trans a
a) = (b -> TransType b
forall m. m -> TransType m
Trans, a
a)
unTransT (NoTrans a
a) = (b -> TransType b
forall m. m -> TransType m
NoTrans, a
a)
unTransT (ConjTrans a
a) = (b -> TransType b
forall m. m -> TransType m
ConjTrans, a
a)

-- | Given a data type flagged by a UnitType, returns a pair containing the UnitType constructor and the data type.
unUnitT :: UnitType a -> (b -> UnitType b, a)
unUnitT :: forall a b. UnitType a -> (b -> UnitType b, a)
unUnitT (Unit a
a) = (b -> UnitType b
forall m. m -> UnitType m
Unit, a
a)
unUnitT (NoUnit a
a) = (b -> UnitType b
forall m. m -> UnitType m
NoUnit, a
a)

-- | Given a data type flagged by a TriangType, returns a pair containing the TriangType constructor and the data type.
unTriangT :: TriangType a -> (b -> TriangType b, a)
unTriangT :: forall a b. TriangType a -> (b -> TriangType b, a)
unTriangT (Lower a
a) = (b -> TriangType b
forall m. m -> TriangType m
Lower, a
a)
unTriangT (Upper a
a) = (b -> TriangType b
forall m. m -> TriangType m
Upper, a
a)


-- | Given an /i,j/ position and a TransType flagged matrix, returns the element in that position without computing the transpose.
elemTrans_m :: (Elt e, Matrix m e) => Int -> Int -> TransType (m e) -> e
elemTrans_m :: forall e (m :: * -> *).
(Elt e, Matrix m e) =>
Int -> Int -> TransType (m e) -> e
elemTrans_m Int
i Int
j (NoTrans m e
m) = Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
i Int
j m e
m
elemTrans_m Int
i Int
j (Trans m e
m) = Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
j Int
i m e
m
elemTrans_m Int
i Int
j (ConjTrans m e
m) = e -> e
forall e. Elt e => e -> e
getConjugate (e -> e) -> e -> e
forall a b. (a -> b) -> a -> b
$ Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
j Int
i m e
m


-- | Given a TransType flagged matrix, returns the dimension of the matrix without computing the transpose.
dimTrans_m :: (Matrix m e) => TransType (m e) -> (Int, Int)
dimTrans_m :: forall (m :: * -> *) e. Matrix m e => TransType (m e) -> (Int, Int)
dimTrans_m (NoTrans m e
m) = m e -> (Int, Int)
forall (m :: * -> *) e. Matrix m e => m e -> (Int, Int)
dim_m m e
m
dimTrans_m (ConjTrans m e
m) = (Int, Int) -> (Int, Int)
forall a b. (a, b) -> (b, a)
swap ((Int, Int) -> (Int, Int)) -> (Int, Int) -> (Int, Int)
forall a b. (a -> b) -> a -> b
$ m e -> (Int, Int)
forall (m :: * -> *) e. Matrix m e => m e -> (Int, Int)
dim_m m e
m
dimTrans_m (Trans m e
m) = (Int, Int) -> (Int, Int)
forall a b. (a, b) -> (b, a)
swap ((Int, Int) -> (Int, Int)) -> (Int, Int) -> (Int, Int)
forall a b. (a -> b) -> a -> b
$ m e -> (Int, Int)
forall (m :: * -> *) e. Matrix m e => m e -> (Int, Int)
dim_m m e
m


-- | Given an /i,j/ position and a TransType flagged matrix, returns the element in that position only accessing the part indicated by the TransType.
elemSymm :: (Elt e, Matrix m e) => Int -> Int -> TriangType (m e) -> e
elemSymm :: forall e (m :: * -> *).
(Elt e, Matrix m e) =>
Int -> Int -> TriangType (m e) -> e
elemSymm Int
i Int
j (Upper m e
m)
    | Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
j = Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
j Int
i m e
m
    | Bool
otherwise = Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
i Int
j m e
m
elemSymm Int
i Int
j (Lower m e
m)
    | Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
j = Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
i Int
j m e
m
    | Bool
otherwise = Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
j Int
i m e
m

-- | Given a TransType flagged matrix, returns the dimension of the matrix.
dimTriang :: (Matrix m e) => TriangType (m e) -> (Int, Int)
dimTriang :: forall (m :: * -> *) e.
Matrix m e =>
TriangType (m e) -> (Int, Int)
dimTriang = m e -> (Int, Int)
forall (m :: * -> *) e. Matrix m e => m e -> (Int, Int)
dim_m (m e -> (Int, Int))
-> (TriangType (m e) -> m e) -> TriangType (m e) -> (Int, Int)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Any -> TriangType Any, m e) -> m e
forall a b. (a, b) -> b
snd ((Any -> TriangType Any, m e) -> m e)
-> (TriangType (m e) -> (Any -> TriangType Any, m e))
-> TriangType (m e)
-> m e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TriangType (m e) -> (Any -> TriangType Any, m e)
forall a b. TriangType a -> (b -> TriangType b, a)
unTriangT

-- | Given an /i,j/ position and a UnitType flagged matrix, returns the element in that position. If the matrix is flagged as Unit and /i == j/ (the element is in the diagonal) returns one.
elemUnit_m :: (Elt e, Matrix m e) => Int -> Int -> UnitType (m e) -> e
elemUnit_m :: forall e (m :: * -> *).
(Elt e, Matrix m e) =>
Int -> Int -> UnitType (m e) -> e
elemUnit_m Int
i Int
j (Unit m e
m)
    | Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
j = e
1
    | Bool
otherwise = Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
i Int
j m e
m
elemUnit_m Int
i Int
j (NoUnit m e
m) = Int -> Int -> m e -> e
forall (m :: * -> *) e. Matrix m e => Int -> Int -> m e -> e
elem_m Int
i Int
j m e
m

-- | Given a UnitType flagged matrix, returns the dimension of the matrix.
dimUnit_m :: (Matrix m e) => UnitType (m e) -> (Int, Int)
dimUnit_m :: forall (m :: * -> *) e. Matrix m e => UnitType (m e) -> (Int, Int)
dimUnit_m (Unit m e
m) = m e -> (Int, Int)
forall (m :: * -> *) e. Matrix m e => m e -> (Int, Int)
dim_m m e
m
dimUnit_m (NoUnit m e
m) = m e -> (Int, Int)
forall (m :: * -> *) e. Matrix m e => m e -> (Int, Int)
dim_m m e
m

-- | Given an /i,j/ position and a TransType-UnitType flagged matrix, returns the element in that position without computing the transpose.
elemTransUnit_m :: (Elt e, Matrix m e) => Int -> Int -> TransType (UnitType (m e)) -> e
elemTransUnit_m :: forall e (m :: * -> *).
(Elt e, Matrix m e) =>
Int -> Int -> TransType (UnitType (m e)) -> e
elemTransUnit_m Int
i Int
j (NoTrans UnitType (m e)
pmA) = Int -> Int -> UnitType (m e) -> e
forall e (m :: * -> *).
(Elt e, Matrix m e) =>
Int -> Int -> UnitType (m e) -> e
elemUnit_m Int
i Int
j UnitType (m e)
pmA
elemTransUnit_m Int
i Int
j (Trans UnitType (m e)
pmA) = Int -> Int -> UnitType (m e) -> e
forall e (m :: * -> *).
(Elt e, Matrix m e) =>
Int -> Int -> UnitType (m e) -> e
elemUnit_m Int
j Int
i UnitType (m e)
pmA
elemTransUnit_m Int
i Int
j (ConjTrans UnitType (m e)
pmA) = e -> e
forall e. Elt e => e -> e
getConjugate (e -> e) -> e -> e
forall a b. (a -> b) -> a -> b
$ Int -> Int -> UnitType (m e) -> e
forall e (m :: * -> *).
(Elt e, Matrix m e) =>
Int -> Int -> UnitType (m e) -> e
elemUnit_m Int
j Int
i UnitType (m e)
pmA

-- | Given a TransType-UnitType flagged matrix, returns the dimension of the matrix.
dimTransUnit_m :: Matrix m e => TransType (UnitType (m e)) -> (Int, Int)
dimTransUnit_m :: forall (m :: * -> *) e.
Matrix m e =>
TransType (UnitType (m e)) -> (Int, Int)
dimTransUnit_m = UnitType (m e) -> (Int, Int)
forall (m :: * -> *) e. Matrix m e => UnitType (m e) -> (Int, Int)
dimUnit_m (UnitType (m e) -> (Int, Int))
-> (TransType (UnitType (m e)) -> UnitType (m e))
-> TransType (UnitType (m e))
-> (Int, Int)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Any -> TransType Any, UnitType (m e)) -> UnitType (m e)
forall a b. (a, b) -> b
snd ((Any -> TransType Any, UnitType (m e)) -> UnitType (m e))
-> (TransType (UnitType (m e))
    -> (Any -> TransType Any, UnitType (m e)))
-> TransType (UnitType (m e))
-> UnitType (m e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TransType (UnitType (m e))
-> (Any -> TransType Any, UnitType (m e))
forall a b. TransType a -> (b -> TransType b, a)
unTransT

-- | Given a TransType flagged matrix, computes and returns its transpose.
transTrans_m :: (Elt e, Matrix m e) => TransType (m e) -> m e
transTrans_m :: forall e (m :: * -> *).
(Elt e, Matrix m e) =>
TransType (m e) -> m e
transTrans_m (NoTrans m e
m) = m e
m
transTrans_m (ConjTrans m e
m) = (e -> e) -> m e -> m e
forall (m :: * -> *) e. Matrix m e => (e -> e) -> m e -> m e
map_m e -> e
forall e. Elt e => e -> e
getConjugate (m e -> m e) -> m e -> m e
forall a b. (a -> b) -> a -> b
$ m e -> m e
forall (m :: * -> *) e. Matrix m e => m e -> m e
transpose_m m e
m
transTrans_m (Trans m e
m) = m e -> m e
forall (m :: * -> *) e. Matrix m e => m e -> m e
transpose_m m e
m