module Numeric.LAPACK.Matrix.Modifier where

import Numeric.LAPACK.Matrix.Shape.Private
         (Order(RowMajor,ColumnMajor), flipOrder)

import Data.Monoid (Monoid, mempty, mappend)
import Data.Semigroup (Semigroup, (<>))



data Transposition = NonTransposed | Transposed
   deriving (Transposition -> Transposition -> Bool
(Transposition -> Transposition -> Bool)
-> (Transposition -> Transposition -> Bool) -> Eq Transposition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Transposition -> Transposition -> Bool
$c/= :: Transposition -> Transposition -> Bool
== :: Transposition -> Transposition -> Bool
$c== :: Transposition -> Transposition -> Bool
Eq, Int -> Transposition -> ShowS
[Transposition] -> ShowS
Transposition -> String
(Int -> Transposition -> ShowS)
-> (Transposition -> String)
-> ([Transposition] -> ShowS)
-> Show Transposition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Transposition] -> ShowS
$cshowList :: [Transposition] -> ShowS
show :: Transposition -> String
$cshow :: Transposition -> String
showsPrec :: Int -> Transposition -> ShowS
$cshowsPrec :: Int -> Transposition -> ShowS
Show, Int -> Transposition
Transposition -> Int
Transposition -> [Transposition]
Transposition -> Transposition
Transposition -> Transposition -> [Transposition]
Transposition -> Transposition -> Transposition -> [Transposition]
(Transposition -> Transposition)
-> (Transposition -> Transposition)
-> (Int -> Transposition)
-> (Transposition -> Int)
-> (Transposition -> [Transposition])
-> (Transposition -> Transposition -> [Transposition])
-> (Transposition -> Transposition -> [Transposition])
-> (Transposition
    -> Transposition -> Transposition -> [Transposition])
-> Enum Transposition
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Transposition -> Transposition -> Transposition -> [Transposition]
$cenumFromThenTo :: Transposition -> Transposition -> Transposition -> [Transposition]
enumFromTo :: Transposition -> Transposition -> [Transposition]
$cenumFromTo :: Transposition -> Transposition -> [Transposition]
enumFromThen :: Transposition -> Transposition -> [Transposition]
$cenumFromThen :: Transposition -> Transposition -> [Transposition]
enumFrom :: Transposition -> [Transposition]
$cenumFrom :: Transposition -> [Transposition]
fromEnum :: Transposition -> Int
$cfromEnum :: Transposition -> Int
toEnum :: Int -> Transposition
$ctoEnum :: Int -> Transposition
pred :: Transposition -> Transposition
$cpred :: Transposition -> Transposition
succ :: Transposition -> Transposition
$csucc :: Transposition -> Transposition
Enum, Transposition
Transposition -> Transposition -> Bounded Transposition
forall a. a -> a -> Bounded a
maxBound :: Transposition
$cmaxBound :: Transposition
minBound :: Transposition
$cminBound :: Transposition
Bounded)

instance Semigroup Transposition where
   Transposition
x<> :: Transposition -> Transposition -> Transposition
<>Transposition
y = if Transposition
xTransposition -> Transposition -> Bool
forall a. Eq a => a -> a -> Bool
==Transposition
y then Transposition
NonTransposed else Transposition
Transposed

instance Monoid Transposition where
   mempty :: Transposition
mempty = Transposition
NonTransposed
   mappend :: Transposition -> Transposition -> Transposition
mappend = Transposition -> Transposition -> Transposition
forall a. Semigroup a => a -> a -> a
(<>)

transposeOrder :: Transposition -> Order -> Order
transposeOrder :: Transposition -> Order -> Order
transposeOrder Transposition
NonTransposed = Order -> Order
forall a. a -> a
id
transposeOrder Transposition
Transposed = Order -> Order
flipOrder


data Conjugation = NonConjugated | Conjugated
   deriving (Conjugation -> Conjugation -> Bool
(Conjugation -> Conjugation -> Bool)
-> (Conjugation -> Conjugation -> Bool) -> Eq Conjugation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Conjugation -> Conjugation -> Bool
$c/= :: Conjugation -> Conjugation -> Bool
== :: Conjugation -> Conjugation -> Bool
$c== :: Conjugation -> Conjugation -> Bool
Eq, Int -> Conjugation -> ShowS
[Conjugation] -> ShowS
Conjugation -> String
(Int -> Conjugation -> ShowS)
-> (Conjugation -> String)
-> ([Conjugation] -> ShowS)
-> Show Conjugation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Conjugation] -> ShowS
$cshowList :: [Conjugation] -> ShowS
show :: Conjugation -> String
$cshow :: Conjugation -> String
showsPrec :: Int -> Conjugation -> ShowS
$cshowsPrec :: Int -> Conjugation -> ShowS
Show, Int -> Conjugation
Conjugation -> Int
Conjugation -> [Conjugation]
Conjugation -> Conjugation
Conjugation -> Conjugation -> [Conjugation]
Conjugation -> Conjugation -> Conjugation -> [Conjugation]
(Conjugation -> Conjugation)
-> (Conjugation -> Conjugation)
-> (Int -> Conjugation)
-> (Conjugation -> Int)
-> (Conjugation -> [Conjugation])
-> (Conjugation -> Conjugation -> [Conjugation])
-> (Conjugation -> Conjugation -> [Conjugation])
-> (Conjugation -> Conjugation -> Conjugation -> [Conjugation])
-> Enum Conjugation
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Conjugation -> Conjugation -> Conjugation -> [Conjugation]
$cenumFromThenTo :: Conjugation -> Conjugation -> Conjugation -> [Conjugation]
enumFromTo :: Conjugation -> Conjugation -> [Conjugation]
$cenumFromTo :: Conjugation -> Conjugation -> [Conjugation]
enumFromThen :: Conjugation -> Conjugation -> [Conjugation]
$cenumFromThen :: Conjugation -> Conjugation -> [Conjugation]
enumFrom :: Conjugation -> [Conjugation]
$cenumFrom :: Conjugation -> [Conjugation]
fromEnum :: Conjugation -> Int
$cfromEnum :: Conjugation -> Int
toEnum :: Int -> Conjugation
$ctoEnum :: Int -> Conjugation
pred :: Conjugation -> Conjugation
$cpred :: Conjugation -> Conjugation
succ :: Conjugation -> Conjugation
$csucc :: Conjugation -> Conjugation
Enum, Conjugation
Conjugation -> Conjugation -> Bounded Conjugation
forall a. a -> a -> Bounded a
maxBound :: Conjugation
$cmaxBound :: Conjugation
minBound :: Conjugation
$cminBound :: Conjugation
Bounded)

instance Semigroup Conjugation where
   Conjugation
x<> :: Conjugation -> Conjugation -> Conjugation
<>Conjugation
y = if Conjugation
xConjugation -> Conjugation -> Bool
forall a. Eq a => a -> a -> Bool
==Conjugation
y then Conjugation
NonConjugated else Conjugation
Conjugated

instance Monoid Conjugation where
   mempty :: Conjugation
mempty = Conjugation
NonConjugated
   mappend :: Conjugation -> Conjugation -> Conjugation
mappend = Conjugation -> Conjugation -> Conjugation
forall a. Semigroup a => a -> a -> a
(<>)

conjugatedOnRowMajor :: Order -> Conjugation
conjugatedOnRowMajor :: Order -> Conjugation
conjugatedOnRowMajor Order
RowMajor = Conjugation
Conjugated
conjugatedOnRowMajor Order
ColumnMajor = Conjugation
NonConjugated


data Inversion = NonInverted | Inverted
   deriving (Inversion -> Inversion -> Bool
(Inversion -> Inversion -> Bool)
-> (Inversion -> Inversion -> Bool) -> Eq Inversion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Inversion -> Inversion -> Bool
$c/= :: Inversion -> Inversion -> Bool
== :: Inversion -> Inversion -> Bool
$c== :: Inversion -> Inversion -> Bool
Eq, Int -> Inversion -> ShowS
[Inversion] -> ShowS
Inversion -> String
(Int -> Inversion -> ShowS)
-> (Inversion -> String)
-> ([Inversion] -> ShowS)
-> Show Inversion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Inversion] -> ShowS
$cshowList :: [Inversion] -> ShowS
show :: Inversion -> String
$cshow :: Inversion -> String
showsPrec :: Int -> Inversion -> ShowS
$cshowsPrec :: Int -> Inversion -> ShowS
Show, Int -> Inversion
Inversion -> Int
Inversion -> [Inversion]
Inversion -> Inversion
Inversion -> Inversion -> [Inversion]
Inversion -> Inversion -> Inversion -> [Inversion]
(Inversion -> Inversion)
-> (Inversion -> Inversion)
-> (Int -> Inversion)
-> (Inversion -> Int)
-> (Inversion -> [Inversion])
-> (Inversion -> Inversion -> [Inversion])
-> (Inversion -> Inversion -> [Inversion])
-> (Inversion -> Inversion -> Inversion -> [Inversion])
-> Enum Inversion
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Inversion -> Inversion -> Inversion -> [Inversion]
$cenumFromThenTo :: Inversion -> Inversion -> Inversion -> [Inversion]
enumFromTo :: Inversion -> Inversion -> [Inversion]
$cenumFromTo :: Inversion -> Inversion -> [Inversion]
enumFromThen :: Inversion -> Inversion -> [Inversion]
$cenumFromThen :: Inversion -> Inversion -> [Inversion]
enumFrom :: Inversion -> [Inversion]
$cenumFrom :: Inversion -> [Inversion]
fromEnum :: Inversion -> Int
$cfromEnum :: Inversion -> Int
toEnum :: Int -> Inversion
$ctoEnum :: Int -> Inversion
pred :: Inversion -> Inversion
$cpred :: Inversion -> Inversion
succ :: Inversion -> Inversion
$csucc :: Inversion -> Inversion
Enum, Inversion
Inversion -> Inversion -> Bounded Inversion
forall a. a -> a -> Bounded a
maxBound :: Inversion
$cmaxBound :: Inversion
minBound :: Inversion
$cminBound :: Inversion
Bounded)

instance Semigroup Inversion where
   Inversion
x<> :: Inversion -> Inversion -> Inversion
<>Inversion
y = if Inversion
xInversion -> Inversion -> Bool
forall a. Eq a => a -> a -> Bool
==Inversion
y then Inversion
NonInverted else Inversion
Inverted

instance Monoid Inversion where
   mempty :: Inversion
mempty = Inversion
NonInverted
   mappend :: Inversion -> Inversion -> Inversion
mappend = Inversion -> Inversion -> Inversion
forall a. Semigroup a => a -> a -> a
(<>)