{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE EmptyDataDecls #-}
module Numeric.LAPACK.Matrix.Superscript where
import qualified Numeric.LAPACK.Singular as Singular
import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni
import qualified Numeric.LAPACK.Matrix.Layout as Layout
import qualified Numeric.LAPACK.Matrix.Extent as Extent
import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix
import qualified Numeric.LAPACK.Matrix as Matrix
import Numeric.LAPACK.Matrix.Layout.Private (Filled)
import Numeric.LAPACK.Matrix.Extent (Shape, Small)
import Numeric.LAPACK.Matrix (Matrix)
import qualified Data.Array.Comfort.Shape as Shape
import qualified Numeric.Netlib.Class as Class
infixl 8 #^
class Superscript sup where
data Exponent sup
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a
(#^) ::
(Extent.Measure measA, Extent.C vertA, Extent.C horizA) =>
(Shape.C widthA, Shape.C heightA) =>
(Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>
(Shape.C widthB, Shape.C heightB) =>
(Class.Floating a) =>
Matrix typA xlA xuA lowerA upperA measA vertA horizA heightA widthA a ->
Exponent sup
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a ->
Matrix typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a
data None
instance Superscript None where
data Exponent None
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a where
N ::
Exponent None
typ xl xu lower upper meas vert horiz height width
typ xl xu lower upper meas vert horiz height width a
a#^N = a
data Transpose
instance Superscript Transpose where
data Exponent Transpose
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a where
T ::
(Matrix.Transpose typ,
Matrix.TransposeExtra typ xl, Matrix.TransposeExtra typ xu) =>
Exponent Transpose
typ xl xu lower upper meas vert horiz height width
typ xu xl upper lower meas horiz vert width height a
a#^T = Matrix.transpose a
data Adjoint
instance Superscript Adjoint where
data Exponent Adjoint
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a where
A ::
(Matrix.Transpose typ, Matrix.Complex typ,
Matrix.TransposeExtra typ xl, Matrix.TransposeExtra typ xu) =>
Exponent Adjoint
typ xl xu lower upper meas vert horiz height width
typ xu xl upper lower meas horiz vert width height a
a#^A = Matrix.adjoint a
data Conjugate
instance Superscript Conjugate where
data Exponent Conjugate
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a where
C ::
(Matrix.Complex typ) =>
Exponent Conjugate
typ xl xu lower upper meas vert horiz height width
typ xl xu lower upper meas vert horiz height width a
a#^C = Matrix.conjugate a
data Inverse
instance Superscript Inverse where
data Exponent Inverse
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a where
Inv ::
(Matrix.Inverse typ,
Matrix.InverseExtra typ xl, Matrix.InverseExtra typ xu,
Omni.PowerStrip lower, Omni.PowerStrip upper) =>
Exponent Inverse
typ xl xu lower upper meas Small Small height width
typ xl xu lower upper meas Small Small width height a
a#^Inv = Matrix.inverse a
data PseudoInverse
instance Superscript PseudoInverse where
data Exponent PseudoInverse
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a where
Pseudo ::
(typ ~ ArrMatrix.Array Layout.Unpacked Omni.Arbitrary) =>
Matrix.RealOf a ->
Exponent PseudoInverse
typ () () Filled Filled Shape Small Small sh sh
typ () () Filled Filled Shape Small Small sh sh a
a#^Pseudo rcond = snd $ Singular.pseudoInverseRCond rcond a
data Power
instance Superscript Power where
data Exponent Power
typA xlA xuA lowerA upperA measA vertA horizA heightA widthA
typB xlB xuB lowerB upperB measB vertB horizB heightB widthB a where
Exp ::
(Matrix.Power typ,
Matrix.PowerExtra typ xl, Matrix.PowerExtra typ xu,
Omni.PowerStrip lower, Omni.PowerStrip upper) =>
Integer ->
Exponent Power
typ xl xu lower upper Shape Small Small sh sh
typ xl xu lower upper Shape Small Small sh sh a
a#^Exp n = Matrix.power n a