{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving, GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DataKinds #-}
module OAlg.Entity.Matrix.Definition
(
Matrix(..), rows, cols, mtxxs
, mtxRowCol, mtxColRow
, mtxMap, mtxDensity
, mtxGroupRow, mtxGroupDim
, mtxJoin, mtxJoinDim
, matrix, matrixTtl, matrixBlc
, diagonal, diagonal'
, mtxMapS, mtxMapCov, mtxMapCnt
, isoCoMatrixOp
, xMatrix, xMatrixTtl
, xodZ, xodZZ
) where
import Control.Monad
import Data.Typeable
import Data.Foldable
import Data.List (map,repeat,zip,span)
import OAlg.Prelude
import OAlg.Category.Dualisable
import OAlg.Category.SDuality
import OAlg.Data.Singleton
import OAlg.Data.Canonical
import OAlg.Data.HomCo
import OAlg.Data.Constructable
import OAlg.Structure.Exception
import OAlg.Structure.Oriented
import OAlg.Structure.Multiplicative
import OAlg.Structure.Fibred
import OAlg.Structure.FibredOriented
import OAlg.Structure.Additive
import OAlg.Structure.Vectorial
import OAlg.Structure.Distributive
import OAlg.Structure.Algebraic
import OAlg.Structure.Exponential
import OAlg.Structure.Number
import OAlg.Entity.Diagram
import OAlg.Entity.Product
import OAlg.Entity.Sequence hiding (span)
import OAlg.Hom.Definition
import OAlg.Hom.Oriented
import OAlg.Hom.Multiplicative
import OAlg.Hom.Fibred
import OAlg.Hom.FibredOriented
import OAlg.Hom.Additive
import OAlg.Hom.Distributive
import OAlg.Entity.Matrix.Dim
import OAlg.Entity.Matrix.Entries
import OAlg.Limes.Cone.Conic
import OAlg.Limes.Perspective
import OAlg.Limes.Definition.Proposition
data Matrix x = Matrix (Dim' x) (Dim' x) (Entries N N x)
rows :: Matrix x -> Dim' x
rows :: forall x. Matrix x -> Dim' x
rows (Matrix Dim' x
r Dim' x
_ Entries N N x
_) = Dim' x
r
cols :: Matrix x -> Dim' x
cols :: forall x. Matrix x -> Dim' x
cols (Matrix Dim' x
_ Dim' x
c Entries N N x
_) = Dim' x
c
mtxxs :: Matrix x -> Entries N N x
mtxxs :: forall x. Matrix x -> Entries N N x
mtxxs (Matrix Dim' x
_ Dim' x
_ Entries N N x
xs) = Entries N N x
xs
mtxDensity :: Matrix x -> Maybe Q
mtxDensity :: forall x. Matrix x -> Maybe Q
mtxDensity Matrix x
m = case (Dim x (Point x) -> N
forall x. LengthN x => x -> N
lengthN (Dim x (Point x) -> N) -> Dim x (Point x) -> N
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Matrix x -> Dim x (Point x)
forall x. Matrix x -> Dim' x
rows Matrix x
m) N -> N -> N
forall c. Multiplicative c => c -> c -> c
* (Dim x (Point x) -> N
forall x. LengthN x => x -> N
lengthN (Dim x (Point x) -> N) -> Dim x (Point x) -> N
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Matrix x -> Dim x (Point x)
forall x. Matrix x -> Dim' x
cols Matrix x
m) of
N
0 -> Maybe Q
forall a. Maybe a
Nothing
N
d -> Q -> Maybe Q
forall a. a -> Maybe a
Just (Q -> Maybe Q) -> Q -> Maybe Q
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ ((N -> Z
forall a b. Embeddable a b => a -> b
inj (N -> Z) -> N -> Z
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Entries N N x -> N
forall x. LengthN x => x -> N
lengthN (Entries N N x -> N) -> Entries N N x -> N
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Matrix x -> Entries N N x
forall x. Matrix x -> Entries N N x
mtxxs Matrix x
m) Z -> N -> Q
% N
d)
deriving instance Oriented x => Show (Matrix x)
deriving instance Oriented x => Eq (Matrix x)
deriving instance (Oriented x, Ord x, OrdPoint x) => Ord (Matrix x)
instance (Additive x, FibredOriented x) => Validable (Matrix x) where
valid :: Matrix x -> Statement
valid m :: Matrix x
m@(Matrix Dim x (Point x)
rw Dim x (Point x)
cl (Entries (PSequence [(x, (N, N))]
xijs))) = String -> Label
Label (TypeRep -> String
forall a. Show a => a -> String
show (TypeRep -> String) -> TypeRep -> String
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Matrix x -> TypeRep
forall a. Typeable a => a -> TypeRep
typeOf Matrix x
m) Label -> Statement -> Statement
:<=>:
[Statement] -> Statement
And [ String -> Label
Label String
"1" Label -> Statement -> Statement
:<=>: String -> Label
Label String
"rw" Label -> Statement -> Statement
:<=>: Dim x (Point x) -> Statement
forall a. Validable a => a -> Statement
valid Dim x (Point x)
rw
, String -> Label
Label String
"1" Label -> Statement -> Statement
:<=>: String -> Label
Label String
"cl" Label -> Statement -> Statement
:<=>:Dim x (Point x) -> Statement
forall a. Validable a => a -> Statement
valid Dim x (Point x)
cl
, case [(x, (N, N))]
xijs of
[] -> Statement
SValid
((x, (N, N))
xij:[(x, (N, N))]
xijs) -> Dim x (Point x)
-> Dim x (Point x) -> (x, (N, N)) -> [(x, (N, N))] -> Statement
forall {a} {s :: * -> *} {i} {s :: * -> *} {i}.
(Additive a, Oriented a, Sequence s i (Point a),
Sequence s i (Point a), Show i, Show i, Validable i,
Validable i) =>
s (Point a)
-> s (Point a) -> (a, (i, i)) -> [(a, (i, i))] -> Statement
vld Dim x (Point x)
rw Dim x (Point x)
cl (x, (N, N))
xij [(x, (N, N))]
xijs
] where
vld :: s (Point a)
-> s (Point a) -> (a, (i, i)) -> [(a, (i, i))] -> Statement
vld s (Point a)
rw s (Point a)
cl (a, (i, i))
xij [] = s (Point a) -> s (Point a) -> (a, (i, i)) -> Statement
forall {q} {s :: * -> *} {i} {s :: * -> *} {i}.
(Additive q, Oriented q, Sequence s i (Point q),
Sequence s i (Point q), Show i, Show i, Validable i,
Validable i) =>
s (Point q) -> s (Point q) -> (q, (i, i)) -> Statement
vldEntries s (Point a)
rw s (Point a)
cl (a, (i, i))
xij
vld s (Point a)
rw s (Point a)
cl (a, (i, i))
xij ((a, (i, i))
xlk:[(a, (i, i))]
xijs) = [Statement] -> Statement
And [ s (Point a) -> s (Point a) -> (a, (i, i)) -> Statement
forall {q} {s :: * -> *} {i} {s :: * -> *} {i}.
(Additive q, Oriented q, Sequence s i (Point q),
Sequence s i (Point q), Show i, Show i, Validable i,
Validable i) =>
s (Point q) -> s (Point q) -> (q, (i, i)) -> Statement
vldEntries s (Point a)
rw s (Point a)
cl (a, (i, i))
xij
, String -> Label
Label String
"2" Label -> Statement -> Statement
:<=>: let ij :: (i, i)
ij = (a, (i, i)) -> (i, i)
forall a b. (a, b) -> b
snd (a, (i, i))
xij
lk :: (i, i)
lk = (a, (i, i)) -> (i, i)
forall a b. (a, b) -> b
snd (a, (i, i))
xlk
in ((i, i)
ij (i, i) -> (i, i) -> Bool
forall a. Ord a => a -> a -> Bool
< (i, i)
lk) Bool -> Message -> Statement
:?>[Parameter] -> Message
Params [String
"(ij,kl)"String -> String -> Parameter
:=((i, i), (i, i)) -> String
forall a. Show a => a -> String
show ((i, i)
ij,(i, i)
lk)]
, s (Point a)
-> s (Point a) -> (a, (i, i)) -> [(a, (i, i))] -> Statement
vld s (Point a)
rw s (Point a)
cl (a, (i, i))
xlk [(a, (i, i))]
xijs
]
vldEntries :: s (Point q) -> s (Point q) -> (q, (i, i)) -> Statement
vldEntries s (Point q)
rw s (Point q)
cl xij :: (q, (i, i))
xij@(q
x,(i
i,i
j))
= [Statement] -> Statement
And [ String -> Label
Label String
"2" Label -> Statement -> Statement
:<=>: (q, (i, i)) -> Statement
forall a. Validable a => a -> Statement
valid (q, (i, i))
xij
, String -> Label
Label String
"3.1" Label -> Statement -> Statement
:<=>: (Bool -> Bool
forall b. Boolean b => b -> b
not (q -> Bool
forall a. Additive a => a -> Bool
isZero q
x)) Bool -> Message -> Statement
:?> [Parameter] -> Message
Params [String
"xij"String -> String -> Parameter
:=(q, (i, i)) -> String
forall a. Show a => a -> String
show (q, (i, i))
xij]
, String -> Label
Label String
"3.2" Label -> Statement -> Statement
:<=>: (q -> Orientation (Point q)
forall q. Oriented q => q -> Orientation (Point q)
orientation q
x Orientation (Point q) -> Orientation (Point q) -> Bool
forall a. Eq a => a -> a -> Bool
== (s (Point q)
cl s (Point q) -> i -> Point q
forall (s :: * -> *) i x. Sequence s i x => s x -> i -> x
? i
j) Point q -> Point q -> Orientation (Point q)
forall p. p -> p -> Orientation p
:> (s (Point q)
rw s (Point q) -> i -> Point q
forall (s :: * -> *) i x. Sequence s i x => s x -> i -> x
? i
i))
Bool -> Message -> Statement
:?> [Parameter] -> Message
Params [String
"xij"String -> String -> Parameter
:=(q, (i, i)) -> String
forall a. Show a => a -> String
show (q, (i, i))
xij]
]
mtxColRow :: Matrix x -> Col N (Row N x)
mtxColRow :: forall x. Matrix x -> Col N (Row N x)
mtxColRow (Matrix Dim' x
_ Dim' x
_ Entries N N x
xs) = Entries N N x -> Col N (Row N x)
forall i j x. Eq i => Entries i j x -> Col i (Row j x)
etscr Entries N N x
xs
mtxRowCol :: Matrix x -> Row N (Col N x)
mtxRowCol :: forall x. Matrix x -> Row N (Col N x)
mtxRowCol (Matrix Dim' x
_ Dim' x
_ Entries N N x
xs) = Entries N N x -> Row N (Col N x)
forall i j x. (Ord i, Ord j) => Entries i j x -> Row j (Col i x)
etsrc Entries N N x
xs
type instance Point (Matrix x) = Dim' x
instance Oriented x => ShowPoint (Matrix x)
instance Oriented x => EqPoint (Matrix x)
instance Oriented x => ValidablePoint (Matrix x)
instance (Typeable x, TypeablePoint x) => TypeablePoint (Matrix x)
instance (Additive x, FibredOriented x) => Oriented (Matrix x) where
orientation :: Matrix x -> Orientation (Point (Matrix x))
orientation (Matrix Dim' x
rw Dim' x
cl Entries N N x
_) = Dim' x
cl Dim' x -> Dim' x -> Orientation (Dim' x)
forall p. p -> p -> Orientation p
:> Dim' x
rw
type instance Root (Matrix x) = Orientation (Dim' x)
instance Oriented x => ShowRoot (Matrix x)
instance Oriented x => EqRoot (Matrix x)
instance Oriented x => ValidableRoot (Matrix x)
instance (Typeable x, TypeablePoint x) => TypeableRoot (Matrix x)
instance (Additive x, FibredOriented x) => Fibred (Matrix x)
instance (Additive x, FibredOriented x) => FibredOriented (Matrix x)
instance (Additive x, FibredOriented x) => Additive (Matrix x) where
zero :: Root (Matrix x) -> Matrix x
zero (Dim x (Point x)
cl:>Dim x (Point x)
rw) = Dim x (Point x) -> Dim x (Point x) -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim x (Point x)
rw Dim x (Point x)
cl Entries N N x
forall i j x. Entries i j x
etsEmpty
Matrix Dim x (Point x)
rw Dim x (Point x)
cl Entries N N x
xs + :: Matrix x -> Matrix x -> Matrix x
+ Matrix Dim x (Point x)
rw' Dim x (Point x)
cl' Entries N N x
ys
| Dim x (Point x)
rw Dim x (Point x) -> Dim x (Point x) -> Bool
forall a. Eq a => a -> a -> Bool
== Dim x (Point x)
rw' Bool -> Bool -> Bool
forall a. Logical a => a -> a -> a
&& Dim x (Point x)
cl Dim x (Point x) -> Dim x (Point x) -> Bool
forall a. Eq a => a -> a -> Bool
== Dim x (Point x)
cl' = Dim x (Point x) -> Dim x (Point x) -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim x (Point x)
rw Dim x (Point x)
cl (Entries N N x -> Entries N N x -> Entries N N x
forall x i j.
(Additive x, Ord i, Ord j) =>
Entries i j x -> Entries i j x -> Entries i j x
etsAdd Entries N N x
xs Entries N N x
ys)
| Bool
otherwise = ArithmeticException -> Matrix x
forall a e. Exception e => e -> a
throw (ArithmeticException -> Matrix x)
-> ArithmeticException -> Matrix x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ ArithmeticException
NotAddable
ntimes :: N -> Matrix x -> Matrix x
ntimes N
n (Matrix Dim x (Point x)
rw Dim x (Point x)
cl Entries N N x
xs)
= Dim x (Point x) -> Dim x (Point x) -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim x (Point x)
rw Dim x (Point x)
cl (Entries N N x -> Entries N N x
forall x i j. Additive x => Entries i j x -> Entries i j x
etsElimZeros (Entries N N x -> Entries N N x) -> Entries N N x -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (x -> x) -> Entries N N x -> Entries N N x
forall a b. (a -> b) -> Entries N N a -> Entries N N b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (N -> x -> x
forall a. Additive a => N -> a -> a
ntimes N
n) Entries N N x
xs)
instance (Abelian x, FibredOriented x) => Abelian (Matrix x) where
negate :: Matrix x -> Matrix x
negate (Matrix Dim' x
rw Dim' x
cl Entries N N x
xs) = Dim' x -> Dim' x -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' x
rw Dim' x
cl ((x -> x) -> Entries N N x -> Entries N N x
forall a b. (a -> b) -> Entries N N a -> Entries N N b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap x -> x
forall a. Abelian a => a -> a
negate Entries N N x
xs)
ztimes :: Z -> Matrix x -> Matrix x
ztimes Z
z (Matrix Dim' x
rw Dim' x
cl Entries N N x
xs)
= Dim' x -> Dim' x -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' x
rw Dim' x
cl (Entries N N x -> Entries N N x
forall x i j. Additive x => Entries i j x -> Entries i j x
etsElimZeros (Entries N N x -> Entries N N x) -> Entries N N x -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (x -> x) -> Entries N N x -> Entries N N x
forall a b. (a -> b) -> Entries N N a -> Entries N N b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Z -> x -> x
forall a. Abelian a => Z -> a -> a
ztimes Z
z) Entries N N x
xs)
instance (Vectorial x, FibredOriented x) => Vectorial (Matrix x) where
type Scalar (Matrix x) = Scalar x
Scalar (Matrix x)
r ! :: Scalar (Matrix x) -> Matrix x -> Matrix x
! Matrix Dim' x
rw Dim' x
cl Entries N N x
xs = Dim' x -> Dim' x -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' x
rw Dim' x
cl (Entries N N x -> Matrix x) -> Entries N N x -> Matrix x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Entries N N x -> Entries N N x
forall x i j. Additive x => Entries i j x -> Entries i j x
etsElimZeros (Entries N N x -> Entries N N x) -> Entries N N x -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (x -> x) -> Entries N N x -> Entries N N x
forall a b. (a -> b) -> Entries N N a -> Entries N N b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Scalar x
Scalar (Matrix x)
rScalar x -> x -> x
forall v. Vectorial v => Scalar v -> v -> v
!) Entries N N x
xs
instance Distributive x => Multiplicative (Matrix x) where
one :: Point (Matrix x) -> Matrix x
one Point (Matrix x)
d = Dim' x -> Dim' x -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Point (Matrix x)
Dim' x
d Point (Matrix x)
Dim' x
d Entries N N x
ones where
ones :: Entries N N x
ones = Entries N N x -> Entries N N x
forall x i j. Additive x => Entries i j x -> Entries i j x
etsElimZeros (Entries N N x -> Entries N N x) -> Entries N N x -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ PSequence (N, N) x -> Entries N N x
forall i j x. PSequence (i, j) x -> Entries i j x
Entries (PSequence (N, N) x -> Entries N N x)
-> PSequence (N, N) x -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ [(x, (N, N))] -> PSequence (N, N) x
forall i x. [(x, i)] -> PSequence i x
PSequence ([(x, (N, N))] -> PSequence (N, N) x)
-> [(x, (N, N))] -> PSequence (N, N) x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ ((Point x, N) -> (x, (N, N))) -> [(Point x, N)] -> [(x, (N, N))]
forall a b. (a -> b) -> [a] -> [b]
map (\(Point x
p,N
i) -> (Point x -> x
forall c. Multiplicative c => Point c -> c
one Point x
p,(N
i,N
i))) ([(Point x, N)] -> [(x, (N, N))])
-> [(Point x, N)] -> [(x, (N, N))]
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Dim' x -> [(Point x, N)]
forall p x. (p ~ Point x) => Dim x p -> [(p, N)]
dimxs Point (Matrix x)
Dim' x
d
Matrix Dim' x
i Dim' x
k Entries N N x
xs * :: Matrix x -> Matrix x -> Matrix x
* Matrix Dim' x
k' Dim' x
j Entries N N x
ys
| Dim' x
k Dim' x -> Dim' x -> Bool
forall a. Eq a => a -> a -> Bool
== Dim' x
k' = Dim' x -> Dim' x -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' x
i Dim' x
j (Col N (Row N x) -> Entries N N x
forall i j x. Col i (Row j x) -> Entries i j x
crets (Col N (Row N x) -> Entries N N x)
-> Col N (Row N x) -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Col N (Row N x) -> Row N (Col N x) -> Col N (Row N x)
forall x k i j.
(Distributive x, Ord k) =>
Col i (Row k x) -> Row j (Col k x) -> Col i (Row j x)
etsMlt (Entries N N x -> Col N (Row N x)
forall i j x. Eq i => Entries i j x -> Col i (Row j x)
etscr Entries N N x
xs) (Entries N N x -> Row N (Col N x)
forall i j x. (Ord i, Ord j) => Entries i j x -> Row j (Col i x)
etsrc Entries N N x
ys))
| Bool
otherwise = ArithmeticException -> Matrix x
forall a e. Exception e => e -> a
throw ArithmeticException
NotMultiplicable
npower :: Matrix x -> N -> Matrix x
npower Matrix x
m N
1 = Matrix x
m
npower Matrix x
m N
_ | Bool -> Bool
forall b. Boolean b => b -> b
not (Matrix x -> Bool
forall q. Oriented q => q -> Bool
isEndo Matrix x
m) = ArithmeticException -> Matrix x
forall a e. Exception e => e -> a
throw ArithmeticException
NotExponential
npower Matrix x
m N
0 = Point (Matrix x) -> Matrix x
forall c. Multiplicative c => Point c -> c
one (Matrix x -> Dim' x
forall x. Matrix x -> Dim' x
rows Matrix x
m)
npower (Matrix Dim' x
r Dim' x
_ Entries N N x
xs) N
n = Dim' x -> Dim' x -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' x
r Dim' x
r (Col N (Row N x) -> Entries N N x
forall i j x. Col i (Row j x) -> Entries i j x
crets Col N (Row N x)
xs') where
xs' :: Col N (Row N x)
xs' = (Col N (Row N x) -> Row N (Col N x) -> Col N (Row N x))
-> Col N (Row N x) -> [Row N (Col N x)] -> Col N (Row N x)
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Col N (Row N x) -> Row N (Col N x) -> Col N (Row N x)
forall x k i j.
(Distributive x, Ord k) =>
Col i (Row k x) -> Row j (Col k x) -> Col i (Row j x)
etsMlt (Entries N N x -> Col N (Row N x)
forall i j x. Eq i => Entries i j x -> Col i (Row j x)
etscr Entries N N x
xs) ([Row N (Col N x)] -> Col N (Row N x))
-> [Row N (Col N x)] -> Col N (Row N x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ N -> [Row N (Col N x)] -> [Row N (Col N x)]
forall a. N -> [a] -> [a]
takeN (N -> N
forall a. Enum a => a -> a
pred N
n) ([Row N (Col N x)] -> [Row N (Col N x)])
-> [Row N (Col N x)] -> [Row N (Col N x)]
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Row N (Col N x) -> [Row N (Col N x)]
forall a. a -> [a]
repeat (Row N (Col N x) -> [Row N (Col N x)])
-> Row N (Col N x) -> [Row N (Col N x)]
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (Entries N N x -> Row N (Col N x)
forall i j x. (Ord i, Ord j) => Entries i j x -> Row j (Col i x)
etsrc Entries N N x
xs)
instance Distributive x => Distributive (Matrix x)
instance TransformableG Matrix Dst Dst where tauG :: forall x. Struct Dst x -> Struct Dst (Matrix x)
tauG Struct Dst x
Struct = Struct Dst (Matrix x)
forall s x. Structure s x => Struct s x
Struct
instance TransformableGRefl Matrix Dst
instance Algebraic x => Algebraic (Matrix x)
instance (Distributive x, TransposableDistributive x) => Transposable (Matrix x) where
transpose :: Matrix x -> Matrix x
transpose (Matrix Dim' x
r Dim' x
c Entries N N x
xs) = Dim' x -> Dim' x -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' x
c Dim' x
r (Entries N N x -> Entries N N x
forall x. Transposable x => x -> x
transpose Entries N N x
xs)
instance (Distributive x, TransposableDistributive x) => TransposableOriented (Matrix x)
instance (Distributive x, TransposableDistributive x)
=> TransposableMultiplicative (Matrix x)
instance (Distributive x, TransposableDistributive x) => TransposableDistributive (Matrix x)
matrix :: (Additive x, p ~ Point x)
=> Dim x p -> Dim x p -> [(x,N,N)] -> Matrix x
matrix :: forall x p.
(Additive x, p ~ Point x) =>
Dim x p -> Dim x p -> [(x, N, N)] -> Matrix x
matrix Dim x p
rw Dim x p
cl [(x, N, N)]
xijs = Dim' x -> Dim' x -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim x p
Dim' x
rw Dim x p
Dim' x
cl Entries N N x
xijs' where
xijs' :: Entries N N x
xijs' = Entries N N x -> Entries N N x
forall x i j. Additive x => Entries i j x -> Entries i j x
etsElimZeros (Entries N N x -> Entries N N x) -> Entries N N x -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ PSequence (N, N) x -> Entries N N x
forall i j x. PSequence (i, j) x -> Entries i j x
Entries (PSequence (N, N) x -> Entries N N x)
-> PSequence (N, N) x -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (x -> x -> x) -> [(x, (N, N))] -> PSequence (N, N) x
forall i x. Ord i => (x -> x -> x) -> [(x, i)] -> PSequence i x
psequence x -> x -> x
forall a. Additive a => a -> a -> a
(+) ([(x, (N, N))] -> PSequence (N, N) x)
-> [(x, (N, N))] -> PSequence (N, N) x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ ((x, N, N) -> (x, (N, N))) -> [(x, N, N)] -> [(x, (N, N))]
forall a b. (a -> b) -> [a] -> [b]
map (\(x
x,N
i,N
j) -> (x
x,(N
i,N
j))) [(x, N, N)]
xijs
matrixTtl :: (Additive x, FibredOriented x, Total x) => N -> N -> [(x,N,N)] -> Matrix x
matrixTtl :: forall x.
(Additive x, FibredOriented x, Total x) =>
N -> N -> [(x, N, N)] -> Matrix x
matrixTtl N
rws N
cls = Dim x (Point x) -> Dim x (Point x) -> [(x, N, N)] -> Matrix x
forall x p.
(Additive x, p ~ Point x) =>
Dim x p -> Dim x p -> [(x, N, N)] -> Matrix x
matrix Dim x (Point x)
rw Dim x (Point x)
cl where
rw :: Dim x (Point x)
rw = Point x -> Dim x (Point x)
forall p x. (Entity p, p ~ Point x) => p -> Dim x p
dim Point x
forall s. Singleton s => s
unit Dim x (Point x) -> Exponent (Dim x (Point x)) -> Dim x (Point x)
forall f. Exponential f => f -> Exponent f -> f
^ N
Exponent (Dim x (Point x))
rws
cl :: Dim x (Point x)
cl = Point x -> Dim x (Point x)
forall p x. (Entity p, p ~ Point x) => p -> Dim x p
dim Point x
forall s. Singleton s => s
unit Dim x (Point x) -> Exponent (Dim x (Point x)) -> Dim x (Point x)
forall f. Exponential f => f -> Exponent f -> f
^ N
Exponent (Dim x (Point x))
cls
matrixBlc :: (Additive x, FibredOriented x)
=> [Dim' x] -> [Dim' x] -> [(Matrix x,N,N)] -> Matrix (Matrix x)
matrixBlc :: forall x.
(Additive x, FibredOriented x) =>
[Dim' x] -> [Dim' x] -> [(Matrix x, N, N)] -> Matrix (Matrix x)
matrixBlc [Dim x (Point x)]
rws [Dim x (Point x)]
cls = Dim (Matrix x) (Dim x (Point x))
-> Dim (Matrix x) (Dim x (Point x))
-> [(Matrix x, N, N)]
-> Matrix (Matrix x)
forall x p.
(Additive x, p ~ Point x) =>
Dim x p -> Dim x p -> [(x, N, N)] -> Matrix x
matrix Dim (Matrix x) (Dim x (Point x))
rw Dim (Matrix x) (Dim x (Point x))
cl where
rw :: Dim (Matrix x) (Dim x (Point x))
rw = [Dim x (Point x)] -> Dim (Matrix x) (Dim x (Point x))
forall p x. (Entity p, p ~ Point x) => [p] -> Dim x p
productDim [Dim x (Point x)]
rws
cl :: Dim (Matrix x) (Dim x (Point x))
cl = [Dim x (Point x)] -> Dim (Matrix x) (Dim x (Point x))
forall p x. (Entity p, p ~ Point x) => [p] -> Dim x p
productDim [Dim x (Point x)]
cls
diagonal' :: Additive x => N -> Dim' x -> Dim' x -> [x] -> Matrix x
diagonal' :: forall x. Additive x => N -> Dim' x -> Dim' x -> [x] -> Matrix x
diagonal' N
r Dim' x
n Dim' x
m [x]
xs = Dim' x -> Dim' x -> [(x, N, N)] -> Matrix x
forall x p.
(Additive x, p ~ Point x) =>
Dim x p -> Dim x p -> [(x, N, N)] -> Matrix x
matrix Dim' x
n Dim' x
m [(x, N, N)]
xs' where
xs' :: [(x, N, N)]
xs' = ((x, N) -> (x, N, N)) -> [(x, N)] -> [(x, N, N)]
forall a b. (a -> b) -> [a] -> [b]
map (\(x
x,N
i) -> (x
x,N
i,N
i)) ([x]
xs [x] -> [N] -> [(x, N)]
forall a b. [a] -> [b] -> [(a, b)]
`zip` [N
r..])
diagonal :: Additive x => Dim' x -> Dim' x -> [x] -> Matrix x
diagonal :: forall x. Additive x => Dim' x -> Dim' x -> [x] -> Matrix x
diagonal = N -> Dim x (Point x) -> Dim x (Point x) -> [x] -> Matrix x
forall x. Additive x => N -> Dim' x -> Dim' x -> [x] -> Matrix x
diagonal' N
0
mtxJoinDim :: Oriented x => Dim' (Matrix x) -> Dim' x
mtxJoinDim :: forall x. Oriented x => Dim' (Matrix x) -> Dim' x
mtxJoinDim (Dim CSequence (Point (Matrix x))
dm) = CSequence (Point x) -> Dim x (Point x)
forall x. CSequence (Point x) -> Dim x (Point x)
Dim
(CSequence (Point x) -> Dim x (Point x))
-> CSequence (Point x) -> Dim x (Point x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Form (CSequence (Point x)) -> CSequence (Point x)
ProductForm N (U (Point x)) -> CSequence (Point x)
forall x. Constructable x => Form x -> x
make
(ProductForm N (U (Point x)) -> CSequence (Point x))
-> ProductForm N (U (Point x)) -> CSequence (Point x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (U (CSequence (Point x)) -> ProductForm N (U (Point x)))
-> ProductForm N (U (CSequence (Point x)))
-> ProductForm N (U (Point x))
forall y x r.
Singleton (Point y) =>
(x -> ProductForm r y) -> ProductForm r x -> ProductForm r y
prfMapTotal U (CSequence (Point x)) -> ProductForm N (U (Point x))
forall x. U (ProductSymbol x) -> ProductForm N (U x)
f
(ProductForm N (U (CSequence (Point x)))
-> ProductForm N (U (Point x)))
-> ProductForm N (U (CSequence (Point x)))
-> ProductForm N (U (Point x))
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (U (Dim x (Point x)) -> ProductForm N (U (CSequence (Point x))))
-> ProductForm N (U (Dim x (Point x)))
-> ProductForm N (U (CSequence (Point x)))
forall y x r.
Singleton (Point y) =>
(x -> ProductForm r y) -> ProductForm r x -> ProductForm r y
prfMapTotal U (Dim x (Point x)) -> ProductForm N (U (CSequence (Point x)))
forall x. U (Dim' x) -> ProductForm N (U (ProductSymbol (Point x)))
g
(ProductForm N (U (Dim x (Point x)))
-> ProductForm N (U (CSequence (Point x))))
-> ProductForm N (U (Dim x (Point x)))
-> ProductForm N (U (CSequence (Point x)))
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ CSequence (Dim x (Point x)) -> Form (CSequence (Dim x (Point x)))
forall x. Exposable x => x -> Form x
form CSequence (Point (Matrix x))
CSequence (Dim x (Point x))
dm
where f :: U (ProductSymbol x) -> ProductForm N (U x)
f :: forall x. U (ProductSymbol x) -> ProductForm N (U x)
f (U ProductSymbol x
xs) = ProductSymbol x -> Form (ProductSymbol x)
forall x. Exposable x => x -> Form x
form ProductSymbol x
xs
g :: U (Dim' x) -> ProductForm N (U (ProductSymbol (Point x)))
g :: forall x. U (Dim' x) -> ProductForm N (U (ProductSymbol (Point x)))
g (U (Dim CSequence (Point x)
xs)) = U (CSequence (Point x)) -> ProductForm N (U (CSequence (Point x)))
forall r a. a -> ProductForm r a
P (U (CSequence (Point x))
-> ProductForm N (U (CSequence (Point x))))
-> U (CSequence (Point x))
-> ProductForm N (U (CSequence (Point x)))
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ CSequence (Point x) -> U (CSequence (Point x))
forall x. x -> U x
U CSequence (Point x)
xs
mtxJoin :: Oriented x => Matrix (Matrix x) -> Matrix x
mtxJoin :: forall x. Oriented x => Matrix (Matrix x) -> Matrix x
mtxJoin (Matrix Dim' (Matrix x)
rw Dim' (Matrix x)
cl Entries N N (Matrix x)
ets) = Dim x (Point x) -> Dim x (Point x) -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim x (Point x)
rw' Dim x (Point x)
cl' Entries N N x
ets' where
rw' :: Dim x (Point x)
rw' = Dim' (Matrix x) -> Dim x (Point x)
forall x. Oriented x => Dim' (Matrix x) -> Dim' x
mtxJoinDim Dim' (Matrix x)
rw
cl' :: Dim x (Point x)
cl' = Dim' (Matrix x) -> Dim x (Point x)
forall x. Oriented x => Dim' (Matrix x) -> Dim' x
mtxJoinDim Dim' (Matrix x)
cl
ets' :: Entries N N x
ets' = ProductSymbol N
-> ProductSymbol N -> Entries N N (Entries N N x) -> Entries N N x
forall i j x.
(i ~ N, j ~ N) =>
ProductSymbol i
-> ProductSymbol j -> Entries i j (Entries i j x) -> Entries i j x
etsJoin ProductSymbol N
di ProductSymbol N
dj (Entries N N (Entries N N x) -> Entries N N x)
-> Entries N N (Entries N N x) -> Entries N N x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (Matrix x -> Entries N N x)
-> Entries N N (Matrix x) -> Entries N N (Entries N N x)
forall a b. (a -> b) -> Entries N N a -> Entries N N b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Matrix x -> Entries N N x
forall x. Matrix x -> Entries N N x
mtxxs Entries N N (Matrix x)
ets
di :: ProductSymbol N
di = (Dim x (Point x) -> N)
-> ProductSymbol (Dim x (Point x)) -> ProductSymbol N
forall y x.
Entity y =>
(x -> y) -> ProductSymbol x -> ProductSymbol y
psyMap Dim x (Point x) -> N
forall x. LengthN x => x -> N
lengthN (ProductSymbol (Dim x (Point x)) -> ProductSymbol N)
-> ProductSymbol (Dim x (Point x)) -> ProductSymbol N
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Dim (Matrix x) (Dim x (Point x)) -> ProductSymbol (Dim x (Point x))
forall x p. Dim x p -> ProductSymbol p
fromDim Dim' (Matrix x)
Dim (Matrix x) (Dim x (Point x))
rw
dj :: ProductSymbol N
dj = (Dim x (Point x) -> N)
-> ProductSymbol (Dim x (Point x)) -> ProductSymbol N
forall y x.
Entity y =>
(x -> y) -> ProductSymbol x -> ProductSymbol y
psyMap Dim x (Point x) -> N
forall x. LengthN x => x -> N
lengthN (ProductSymbol (Dim x (Point x)) -> ProductSymbol N)
-> ProductSymbol (Dim x (Point x)) -> ProductSymbol N
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Dim (Matrix x) (Dim x (Point x)) -> ProductSymbol (Dim x (Point x))
forall x p. Dim x p -> ProductSymbol p
fromDim Dim' (Matrix x)
Dim (Matrix x) (Dim x (Point x))
cl
mtxGroupDim :: Distributive x => Dim' x -> Dim' (Matrix x)
mtxGroupDim :: forall x. Distributive x => Dim' x -> Dim' (Matrix x)
mtxGroupDim Dim x (Point x)
d = [Point (Matrix x)] -> Dim (Matrix x) (Point (Matrix x))
[Dim x (Point x)] -> Dim (Matrix x) (Dim x (Point x))
forall p x. (Entity p, p ~ Point x) => [p] -> Dim x p
productDim ([Dim x (Point x)] -> Dim (Matrix x) (Dim x (Point x)))
-> [Dim x (Point x)] -> Dim (Matrix x) (Dim x (Point x))
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ ((Point x, N) -> Dim x (Point x))
-> [(Point x, N)] -> [Dim x (Point x)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Point x
p,N
n) -> Point x -> Dim x (Point x)
forall p x. (Entity p, p ~ Point x) => p -> Dim x p
dim Point x
p Dim x (Point x) -> Exponent (Dim x (Point x)) -> Dim x (Point x)
forall f. Exponential f => f -> Exponent f -> f
^ N
Exponent (Dim x (Point x))
n) ([(Point x, N)] -> [Dim x (Point x)])
-> [(Point x, N)] -> [Dim x (Point x)]
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Word N (Point x) -> [(Point x, N)]
forall r a. Word r a -> [(a, r)]
fromWord (Word N (Point x) -> [(Point x, N)])
-> Word N (Point x) -> [(Point x, N)]
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Dim x (Point x) -> Word N (Point x)
forall p x. (Entity p, p ~ Point x) => Dim x p -> Word N p
dimwrd Dim x (Point x)
d
mtxGroupRow :: Distributive x => Matrix x -> Matrix (Matrix x)
mtxGroupRow :: forall x. Distributive x => Matrix x -> Matrix (Matrix x)
mtxGroupRow (Matrix Dim x (Point x)
r Dim x (Point x)
c Entries N N x
xs) = Dim' (Matrix x)
-> Dim' (Matrix x) -> Entries N N (Matrix x) -> Matrix (Matrix x)
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' (Matrix x)
r' Dim' (Matrix x)
Dim (Matrix x) (Dim x (Point x))
c' Entries N N (Matrix x)
xs' where
r' :: Dim' (Matrix x)
r' = Dim x (Point x) -> Dim' (Matrix x)
forall x. Distributive x => Dim' x -> Dim' (Matrix x)
mtxGroupDim Dim x (Point x)
r
c' :: Dim (Matrix x) (Dim x (Point x))
c' = Dim x (Point x) -> Dim (Matrix x) (Dim x (Point x))
forall p x. (Entity p, p ~ Point x) => p -> Dim x p
dim Dim x (Point x)
c
wrd :: [(Point x, N)]
wrd = Word N (Point x) -> [(Point x, N)]
forall r a. Word r a -> [(a, r)]
fromWord (Dim x (Point x) -> Word N (Point x)
forall p x. (Entity p, p ~ Point x) => Dim x p -> Word N p
dimwrd Dim x (Point x)
r)
xs' :: Entries N N (Matrix x)
xs' = PSequence (N, N) (Matrix x) -> Entries N N (Matrix x)
forall i j x. PSequence (i, j) x -> Entries i j x
Entries (PSequence (N, N) (Matrix x) -> Entries N N (Matrix x))
-> PSequence (N, N) (Matrix x) -> Entries N N (Matrix x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ [(Matrix x, (N, N))] -> PSequence (N, N) (Matrix x)
forall i x. [(x, i)] -> PSequence i x
PSequence ([(Matrix x, (N, N))] -> PSequence (N, N) (Matrix x))
-> [(Matrix x, (N, N))] -> PSequence (N, N) (Matrix x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Dim x (Point x)
-> N
-> [((Point x, N), N)]
-> [(Row N x, N)]
-> [(Matrix x, (N, N))]
forall x.
Oriented x =>
Dim' x
-> N
-> [((Point x, N), N)]
-> [(Row N x, N)]
-> [(Matrix x, (N, N))]
split Dim x (Point x)
c N
0 ([(Point x, N)]
wrd [(Point x, N)] -> [N] -> [((Point x, N), N)]
forall a b. [a] -> [b] -> [(a, b)]
`zip` [N
0..]) (Col N (Row N x) -> [(Row N x, N)]
forall i x. Col i x -> [(x, i)]
colxs (Col N (Row N x) -> [(Row N x, N)])
-> Col N (Row N x) -> [(Row N x, N)]
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Entries N N x -> Col N (Row N x)
forall i j x. Eq i => Entries i j x -> Col i (Row j x)
etscr Entries N N x
xs)
split :: Oriented x
=> Dim' x -> N -> [((Point x,N),N)] -> [(Row N x,N)]
-> [(Matrix x,(N,N))]
split :: forall x.
Oriented x =>
Dim' x
-> N
-> [((Point x, N), N)]
-> [(Row N x, N)]
-> [(Matrix x, (N, N))]
split Dim x (Point x)
_ N
_ [((Point x, N), N)]
_ [] = []
split Dim x (Point x)
c N
i [] [(Row N x, N)]
rws = String -> [(Matrix x, (N, N))]
forall a. HasCallStack => String -> a
error (String -> [(Matrix x, (N, N))]) -> String -> [(Matrix x, (N, N))]
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (Dim x (Point x), N, [(Row N x, N)]) -> String
forall a. Show a => a -> String
show (Dim x (Point x)
c,N
i,[(Row N x, N)]
rws)
split Dim x (Point x)
c N
i (((Point x
d,N
l),N
i''):[((Point x, N), N)]
ds') rws :: [(Row N x, N)]
rws@((Row N x
_,N
i'):[(Row N x, N)]
_)
| N
i N -> N -> Bool
forall a. Ord a => a -> a -> Bool
<= N
i' Bool -> Bool -> Bool
forall a. Logical a => a -> a -> a
&& N
i' N -> N -> Bool
forall a. Ord a => a -> a -> Bool
< N
il = (Dim x (Point x) -> Dim x (Point x) -> Entries N N x -> Matrix x
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim x (Point x)
d' Dim x (Point x)
c (Col N (Row N x) -> Entries N N x
forall i j x. Col i (Row j x) -> Entries i j x
crets Col N (Row N x)
xs),(N
i'',N
0)) (Matrix x, (N, N)) -> [(Matrix x, (N, N))] -> [(Matrix x, (N, N))]
forall a. a -> [a] -> [a]
: Dim x (Point x)
-> N
-> [((Point x, N), N)]
-> [(Row N x, N)]
-> [(Matrix x, (N, N))]
forall x.
Oriented x =>
Dim' x
-> N
-> [((Point x, N), N)]
-> [(Row N x, N)]
-> [(Matrix x, (N, N))]
split Dim x (Point x)
c N
il [((Point x, N), N)]
ds' [(Row N x, N)]
rws'
| Bool
otherwise = Dim x (Point x)
-> N
-> [((Point x, N), N)]
-> [(Row N x, N)]
-> [(Matrix x, (N, N))]
forall x.
Oriented x =>
Dim' x
-> N
-> [((Point x, N), N)]
-> [(Row N x, N)]
-> [(Matrix x, (N, N))]
split Dim x (Point x)
c N
il [((Point x, N), N)]
ds' [(Row N x, N)]
rws
where il :: N
il = N
iN -> N -> N
forall a. Additive a => a -> a -> a
+N
l
d' :: Dim x (Point x)
d' = Point x -> Dim x (Point x)
forall p x. (Entity p, p ~ Point x) => p -> Dim x p
dim Point x
d Dim x (Point x) -> Exponent (Dim x (Point x)) -> Dim x (Point x)
forall f. Exponential f => f -> Exponent f -> f
^ N
Exponent (Dim x (Point x))
l
([(Row N x, N)]
xs',[(Row N x, N)]
rws') = ((Row N x, N) -> Bool)
-> [(Row N x, N)] -> ([(Row N x, N)], [(Row N x, N)])
forall a. (a -> Bool) -> [a] -> ([a], [a])
span ((N -> N -> Bool
forall a. Ord a => a -> a -> Bool
<N
il) (N -> Bool) -> ((Row N x, N) -> N) -> (Row N x, N) -> Bool
forall y z x. (y -> z) -> (x -> y) -> x -> z
forall (c :: * -> * -> *) y z x.
Category c =>
c y z -> c x y -> c x z
. (Row N x, N) -> N
forall a b. (a, b) -> b
snd) [(Row N x, N)]
rws
xs :: Col N (Row N x)
xs = PSequence N (Row N x) -> Col N (Row N x)
forall i x. PSequence i x -> Col i x
Col (PSequence N (Row N x) -> Col N (Row N x))
-> PSequence N (Row N x) -> Col N (Row N x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ [(Row N x, N)] -> PSequence N (Row N x)
forall i x. [(x, i)] -> PSequence i x
PSequence ([(Row N x, N)] -> PSequence N (Row N x))
-> [(Row N x, N)] -> PSequence N (Row N x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ ((Row N x, N) -> (Row N x, N)) -> [(Row N x, N)] -> [(Row N x, N)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Row N x
rw,N
i') -> (Row N x
rw,N
i'N -> N -> N
>-N
i)) [(Row N x, N)]
xs'
mtxMapCovStruct :: HomDistributiveDisjunctive h
=> Struct Dst y
-> Variant2 Covariant h x y -> Matrix x -> Matrix y
mtxMapCovStruct :: forall (h :: * -> * -> *) y x.
HomDistributiveDisjunctive h =>
Struct Dst y -> Variant2 'Covariant h x y -> Matrix x -> Matrix y
mtxMapCovStruct Struct Dst y
Struct Variant2 'Covariant h x y
h (Matrix Dim' x
rw Dim' x
cl Entries N N x
xs) = Dim' y -> Dim' y -> Entries N N y -> Matrix y
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' y
rw' Dim' y
cl' Entries N N y
ys where
rw' :: Dim' y
rw' = (Point x -> Point y) -> Dim' x -> Dim' y
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Variant2 'Covariant h x y -> Point x -> Point y
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap Variant2 'Covariant h x y
h) Dim' x
rw
cl' :: Dim' y
cl' = (Point x -> Point y) -> Dim' x -> Dim' y
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Variant2 'Covariant h x y -> Point x -> Point y
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap Variant2 'Covariant h x y
h) Dim' x
cl
ys :: Entries N N y
ys = Variant2 'Covariant h x y -> Entries N N x -> Entries N N y
forall (h :: * -> * -> *) x y i j.
HomDistributiveDisjunctive h =>
Variant2 'Covariant h x y -> Entries i j x -> Entries i j y
etsMapCov Variant2 'Covariant h x y
h Entries N N x
xs
mtxMapCov :: HomDistributiveDisjunctive h => Variant2 Covariant h x y -> Matrix x -> Matrix y
mtxMapCov :: forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Covariant h x y -> Matrix x -> Matrix y
mtxMapCov Variant2 'Covariant h x y
h = Struct Dst y -> Variant2 'Covariant h x y -> Matrix x -> Matrix y
forall (h :: * -> * -> *) y x.
HomDistributiveDisjunctive h =>
Struct Dst y -> Variant2 'Covariant h x y -> Matrix x -> Matrix y
mtxMapCovStruct (Struct (ObjectClass h) y -> Struct Dst y
forall x. Struct (ObjectClass h) x -> Struct Dst x
forall s t x. Transformable s t => Struct s x -> Struct t x
tau (Struct (ObjectClass h) y -> Struct Dst y)
-> Struct (ObjectClass h) y -> Struct Dst y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Variant2 'Covariant h x y
-> Struct (ObjectClass (Variant2 'Covariant h)) y
forall x y.
Variant2 'Covariant h x y
-> Struct (ObjectClass (Variant2 'Covariant h)) y
forall (m :: * -> * -> *) x y.
Morphism m =>
m x y -> Struct (ObjectClass m) y
range Variant2 'Covariant h x y
h) Variant2 'Covariant h x y
h
mtxMap :: HomDistributive h => h x y -> Matrix x -> Matrix y
mtxMap :: forall (h :: * -> * -> *) x y.
HomDistributive h =>
h x y -> Matrix x -> Matrix y
mtxMap h x y
h = Variant2 'Covariant (HomDisj Dst Op h) x y -> Matrix x -> Matrix y
forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Covariant h x y -> Matrix x -> Matrix y
mtxMapCov (h x y -> Variant2 'Covariant (HomDisj Dst Op h) x y
forall (h :: * -> * -> *) x y.
HomDistributive h =>
h x y -> Variant2 'Covariant (HomDisj Dst Op h) x y
homDisjOpDst h x y
h)
mtxMapCntStruct :: HomDistributiveDisjunctive h
=> Struct Dst y
-> Variant2 Contravariant h x y -> Matrix x -> Matrix y
mtxMapCntStruct :: forall (h :: * -> * -> *) y x.
HomDistributiveDisjunctive h =>
Struct Dst y
-> Variant2 'Contravariant h x y -> Matrix x -> Matrix y
mtxMapCntStruct Struct Dst y
Struct Variant2 'Contravariant h x y
h (Matrix Dim' x
rw Dim' x
cl Entries N N x
xs) = Dim' y -> Dim' y -> Entries N N y -> Matrix y
forall x. Dim' x -> Dim' x -> Entries N N x -> Matrix x
Matrix Dim' y
cl' Dim' y
rw' Entries N N y
ys where
cl' :: Dim' y
cl' = (Point x -> Point y) -> Dim' x -> Dim' y
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Variant2 'Contravariant h x y -> Point x -> Point y
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap Variant2 'Contravariant h x y
h) Dim' x
cl
rw' :: Dim' y
rw' = (Point x -> Point y) -> Dim' x -> Dim' y
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Variant2 'Contravariant h x y -> Point x -> Point y
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap Variant2 'Contravariant h x y
h) Dim' x
rw
ys :: Entries N N y
ys = Variant2 'Contravariant h x y -> Entries N N x -> Entries N N y
forall (h :: * -> * -> *) i j x y.
(HomDistributiveDisjunctive h, Ord i, Ord j) =>
Variant2 'Contravariant h x y -> Entries i j x -> Entries j i y
etsMapCnt Variant2 'Contravariant h x y
h Entries N N x
xs
mtxMapCnt :: HomDistributiveDisjunctive h
=> Variant2 Contravariant h x y -> Matrix x -> Matrix y
mtxMapCnt :: forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Contravariant h x y -> Matrix x -> Matrix y
mtxMapCnt Variant2 'Contravariant h x y
h = Struct Dst y
-> Variant2 'Contravariant h x y -> Matrix x -> Matrix y
forall (h :: * -> * -> *) y x.
HomDistributiveDisjunctive h =>
Struct Dst y
-> Variant2 'Contravariant h x y -> Matrix x -> Matrix y
mtxMapCntStruct (Struct (ObjectClass h) y -> Struct Dst y
forall x. Struct (ObjectClass h) x -> Struct Dst x
forall s t x. Transformable s t => Struct s x -> Struct t x
tau (Struct (ObjectClass h) y -> Struct Dst y)
-> Struct (ObjectClass h) y -> Struct Dst y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Variant2 'Contravariant h x y
-> Struct (ObjectClass (Variant2 'Contravariant h)) y
forall x y.
Variant2 'Contravariant h x y
-> Struct (ObjectClass (Variant2 'Contravariant h)) y
forall (m :: * -> * -> *) x y.
Morphism m =>
m x y -> Struct (ObjectClass m) y
range Variant2 'Contravariant h x y
h) Variant2 'Contravariant h x y
h
type instance Dual1 Matrix = Matrix
mtxMapS :: HomDistributiveDisjunctive h
=> h x y -> SDualBi Matrix x -> SDualBi Matrix y
mtxMapS :: forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
h x y -> SDualBi Matrix x -> SDualBi Matrix y
mtxMapS = (Variant2 'Covariant h x y -> Matrix x -> Matrix y)
-> (Variant2 'Covariant h x y -> Dual1 Matrix x -> Dual1 Matrix y)
-> (Variant2 'Contravariant h x y -> Matrix x -> Dual1 Matrix y)
-> (Variant2 'Contravariant h x y -> Dual1 Matrix x -> Matrix y)
-> h x y
-> SDualBi Matrix x
-> SDualBi Matrix y
forall (h :: * -> * -> *) x y (d :: * -> *).
Disjunctive2 h =>
(Variant2 'Covariant h x y -> d x -> d y)
-> (Variant2 'Covariant h x y -> Dual1 d x -> Dual1 d y)
-> (Variant2 'Contravariant h x y -> d x -> Dual1 d y)
-> (Variant2 'Contravariant h x y -> Dual1 d x -> d y)
-> h x y
-> SDualBi d x
-> SDualBi d y
vmapBi Variant2 'Covariant h x y -> Matrix x -> Matrix y
forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Covariant h x y -> Matrix x -> Matrix y
mtxMapCov Variant2 'Covariant h x y -> Dual1 Matrix x -> Dual1 Matrix y
Variant2 'Covariant h x y -> Matrix x -> Matrix y
forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Covariant h x y -> Matrix x -> Matrix y
mtxMapCov Variant2 'Contravariant h x y -> Matrix x -> Dual1 Matrix y
Variant2 'Contravariant h x y -> Matrix x -> Matrix y
forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Contravariant h x y -> Matrix x -> Matrix y
mtxMapCnt Variant2 'Contravariant h x y -> Dual1 Matrix x -> Matrix y
Variant2 'Contravariant h x y -> Matrix x -> Matrix y
forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Contravariant h x y -> Matrix x -> Matrix y
mtxMapCnt
instance HomDistributiveDisjunctive h => ApplicativeG (SDualBi Matrix) h (->) where
amapG :: forall x y. h x y -> SDualBi Matrix x -> SDualBi Matrix y
amapG = h x y -> SDualBi Matrix x -> SDualBi Matrix y
forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
h x y -> SDualBi Matrix x -> SDualBi Matrix y
mtxMapS
instance
( HomDistributiveDisjunctive h
, FunctorialOriented h
) => FunctorialG (SDualBi Matrix) h (->)
coMatrixGCovStruct ::
( TransformableDst s
, TransformableGRefl o s
, DualisableDistributive s o
)
=> Struct s (Matrix x) -> Struct s x -> o (Matrix x) -> Matrix (o x)
coMatrixGCovStruct :: forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o) =>
Struct s (Matrix x) -> Struct s x -> o (Matrix x) -> Matrix (o x)
coMatrixGCovStruct Struct s (Matrix x)
sm Struct s x
s = Variant2 'Contravariant (IsoO s o) x (o x)
-> Matrix x -> Matrix (o x)
forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Contravariant h x y -> Matrix x -> Matrix y
mtxMapCnt (Struct s x -> Variant2 'Contravariant (IsoO s o) x (o x)
forall (o :: * -> *) r x.
TransformableGRefl o r =>
Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO Struct s x
s) (Matrix x -> Matrix (o x))
-> (o (Matrix x) -> Matrix x) -> o (Matrix x) -> Matrix (o x)
forall y z x. (y -> z) -> (x -> y) -> x -> z
forall (c :: * -> * -> *) y z x.
Category c =>
c y z -> c x y -> c x z
. Inv2 (HomDisj s o (HomEmpty s)) (o (Matrix x)) (Matrix x)
-> o (Matrix x) -> Matrix x
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
amap (Inv2 (HomDisj s o (HomEmpty s)) (Matrix x) (o (Matrix x))
-> Inv2 (HomDisj s o (HomEmpty s)) (o (Matrix x)) (Matrix x)
forall (c :: * -> * -> *) x y. Inv2 c x y -> Inv2 c y x
inv2 Inv2 (HomDisj s o (HomEmpty s)) (Matrix x) (o (Matrix x))
t) where Contravariant2 Inv2 (HomDisj s o (HomEmpty s)) (Matrix x) (o (Matrix x))
t = Struct s (Matrix x)
-> Variant2 'Contravariant (IsoO s o) (Matrix x) (o (Matrix x))
forall (o :: * -> *) r x.
TransformableGRefl o r =>
Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO Struct s (Matrix x)
sm
coMatrixGCov ::
( TransformableDst s
, TransformableGRefl o s
, DualisableDistributive s o
, TransformableG Matrix s s
)
=> Struct s x -> o (Matrix x) -> Matrix (o x)
coMatrixGCov :: forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o, TransformableG Matrix s s) =>
Struct s x -> o (Matrix x) -> Matrix (o x)
coMatrixGCov Struct s x
s = Struct s (Matrix x) -> Struct s x -> o (Matrix x) -> Matrix (o x)
forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o) =>
Struct s (Matrix x) -> Struct s x -> o (Matrix x) -> Matrix (o x)
coMatrixGCovStruct (Struct s x -> Struct s (Matrix x)
forall x. Struct s x -> Struct s (Matrix x)
forall (t :: * -> *) u v x.
TransformableG t u v =>
Struct u x -> Struct v (t x)
tauG Struct s x
s) Struct s x
s
coMatrixCov :: Struct Dst x -> Op (Matrix x) -> Matrix (Op x)
coMatrixCov :: forall x. Struct Dst x -> Op (Matrix x) -> Matrix (Op x)
coMatrixCov = Struct Dst x -> Op (Matrix x) -> Matrix (Op x)
forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o, TransformableG Matrix s s) =>
Struct s x -> o (Matrix x) -> Matrix (o x)
coMatrixGCov
coMatrixGInvCovStruct ::
( TransformableDst s
, TransformableGRefl o s
, DualisableDistributive s o
)
=> Struct s (Matrix x) -> Struct s x -> Matrix (o x) -> o (Matrix x)
coMatrixGInvCovStruct :: forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o) =>
Struct s (Matrix x) -> Struct s x -> Matrix (o x) -> o (Matrix x)
coMatrixGInvCovStruct Struct s (Matrix x)
sm Struct s x
s = Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
-> Matrix x -> o (Matrix x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
amap Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
tm (Matrix x -> o (Matrix x))
-> (Matrix (o x) -> Matrix x) -> Matrix (o x) -> o (Matrix x)
forall y z x. (y -> z) -> (x -> y) -> x -> z
forall (c :: * -> * -> *) y z x.
Category c =>
c y z -> c x y -> c x z
. Variant2 'Contravariant (Inv2 (HomDisjEmpty s o)) (o x) x
-> Matrix (o x) -> Matrix x
forall (h :: * -> * -> *) x y.
HomDistributiveDisjunctive h =>
Variant2 'Contravariant h x y -> Matrix x -> Matrix y
mtxMapCnt (Inv2 (HomDisjEmpty s o) (o x) x
-> Variant2 'Contravariant (Inv2 (HomDisjEmpty s o)) (o x) x
forall {k} {k1} (h :: k -> k1 -> *) (x :: k) (y :: k1).
h x y -> Variant2 'Contravariant h x y
Contravariant2 (Inv2 (HomDisjEmpty s o) x (o x) -> Inv2 (HomDisjEmpty s o) (o x) x
forall (c :: * -> * -> *) x y. Inv2 c x y -> Inv2 c y x
inv2 Inv2 (HomDisjEmpty s o) x (o x)
ts))
where Contravariant2 Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
tm = Struct s (Matrix x)
-> Variant2
'Contravariant (Inv2 (HomDisjEmpty s o)) (Matrix x) (o (Matrix x))
forall (o :: * -> *) r x.
TransformableGRefl o r =>
Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO Struct s (Matrix x)
sm
Contravariant2 Inv2 (HomDisjEmpty s o) x (o x)
ts = Struct s x
-> Variant2 'Contravariant (Inv2 (HomDisjEmpty s o)) x (o x)
forall (o :: * -> *) r x.
TransformableGRefl o r =>
Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO Struct s x
s
coMatrixGInvCov ::
( TransformableDst s
, TransformableGRefl o s
, DualisableDistributive s o
, TransformableG Matrix s s
)
=> Struct s x -> Matrix (o x) -> o (Matrix x)
coMatrixGInvCov :: forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o, TransformableG Matrix s s) =>
Struct s x -> Matrix (o x) -> o (Matrix x)
coMatrixGInvCov Struct s x
s = Struct s (Matrix x) -> Struct s x -> Matrix (o x) -> o (Matrix x)
forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o) =>
Struct s (Matrix x) -> Struct s x -> Matrix (o x) -> o (Matrix x)
coMatrixGInvCovStruct (Struct s x -> Struct s (Matrix x)
forall x. Struct s x -> Struct s (Matrix x)
forall (t :: * -> *) u v x.
TransformableG t u v =>
Struct u x -> Struct v (t x)
tauG Struct s x
s) Struct s x
s
coMatrixInvCov :: Struct Dst x -> Matrix (Op x) -> Op (Matrix x)
coMatrixInvCov :: forall x. Struct Dst x -> Matrix (Op x) -> Op (Matrix x)
coMatrixInvCov = Struct Dst x -> Matrix (Op x) -> Op (Matrix x)
forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o, TransformableG Matrix s s) =>
Struct s x -> Matrix (o x) -> o (Matrix x)
coMatrixGInvCov
coMatrixGPntStruct ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> Struct Dst (o x) -> Struct s x -> Pnt (Matrix x) -> Pnt (Matrix (o x))
coMatrixGPntStruct :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s x -> Pnt (Matrix x) -> Pnt (Matrix (o x))
coMatrixGPntStruct so :: Struct Dst (o x)
so@Struct Dst (o x)
Struct Struct s x
s (Pnt Point (Matrix x)
d) = Point (Matrix (o x)) -> Pnt (Matrix (o x))
Dim' (o x) -> Pnt (Matrix (o x))
forall x. Point x -> Pnt x
Pnt (Dim' (o x) -> Pnt (Matrix (o x)))
-> Dim' (o x) -> Pnt (Matrix (o x))
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (Point x -> Point (o x)) -> Dim x (Point x) -> Dim' (o x)
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Inv2 (HomDisjEmpty s o) x (o x) -> Point x -> Point (o x)
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap Inv2 (HomDisjEmpty s o) x (o x)
t) Point (Matrix x)
Dim x (Point x)
d where
Contravariant2 Inv2 (HomDisjEmpty s o) x (o x)
t = Proxy o
-> Struct s x
-> Variant2 'Contravariant (Inv2 (HomDisjEmpty s o)) x (o x)
forall (o :: * -> *) r (q :: (* -> *) -> *) x.
TransformableGRefl o r =>
q o -> Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO' (Struct Dst (o x) -> Proxy o
forall (o :: * -> *) x. Struct Dst (o x) -> Proxy o
q Struct Dst (o x)
so) Struct s x
s
q :: Struct Dst (o x) -> Proxy o
q :: forall (o :: * -> *) x. Struct Dst (o x) -> Proxy o
q Struct Dst (o x)
_ = Proxy o
forall {k} (t :: k). Proxy t
Proxy
coMatrixGPnt ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> Struct s x -> Pnt (Matrix x) -> Pnt (Matrix (o x))
coMatrixGPnt :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct s x -> Pnt (Matrix x) -> Pnt (Matrix (o x))
coMatrixGPnt Struct s x
s = Struct Dst (o x)
-> Struct s x -> Pnt (Matrix x) -> Pnt (Matrix (o x))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s x -> Pnt (Matrix x) -> Pnt (Matrix (o x))
coMatrixGPntStruct (Struct s (o x) -> Struct Dst (o x)
forall x. Struct s x -> Struct Dst x
forall s t x. Transformable s t => Struct s x -> Struct t x
tau (Struct s (o x) -> Struct Dst (o x))
-> Struct s (o x) -> Struct Dst (o x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Struct s x -> Struct s (o x)
forall (o :: * -> *) s x.
Transformable1 o s =>
Struct s x -> Struct s (o x)
tauO Struct s x
s) Struct s x
s
coMatrixGCovPntStruct ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> Struct Dst (o x) -> Struct s (Matrix x) -> Struct s x -> Pnt (o (Matrix x)) -> Pnt (Matrix (o x))
coMatrixGCovPntStruct :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s (Matrix x)
-> Struct s x
-> Pnt (o (Matrix x))
-> Pnt (Matrix (o x))
coMatrixGCovPntStruct Struct Dst (o x)
so Struct s (Matrix x)
sm Struct s x
s = Struct Dst (o x)
-> Struct s x -> Pnt (Matrix x) -> Pnt (Matrix (o x))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s x -> Pnt (Matrix x) -> Pnt (Matrix (o x))
coMatrixGPntStruct Struct Dst (o x)
so Struct s x
s (Pnt (Matrix x) -> Pnt (Matrix (o x)))
-> (Pnt (o (Matrix x)) -> Pnt (Matrix x))
-> Pnt (o (Matrix x))
-> Pnt (Matrix (o x))
forall y z x. (y -> z) -> (x -> y) -> x -> z
forall (c :: * -> * -> *) y z x.
Category c =>
c y z -> c x y -> c x z
. Inv2 (HomDisjEmpty s o) (o (Matrix x)) (Matrix x)
-> Pnt (o (Matrix x)) -> Pnt (Matrix x)
forall x y. Inv2 (HomDisjEmpty s o) x y -> Pnt x -> Pnt y
forall (t :: * -> *) (a :: * -> * -> *) (b :: * -> * -> *) x y.
ApplicativeG t a b =>
a x y -> b (t x) (t y)
amapG (Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
-> Inv2 (HomDisjEmpty s o) (o (Matrix x)) (Matrix x)
forall (c :: * -> * -> *) x y. Inv2 c x y -> Inv2 c y x
inv2 Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
t) where
Contravariant2 Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
t = Proxy o
-> Struct s (Matrix x)
-> Variant2
'Contravariant (Inv2 (HomDisjEmpty s o)) (Matrix x) (o (Matrix x))
forall (o :: * -> *) r (q :: (* -> *) -> *) x.
TransformableGRefl o r =>
q o -> Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO' (Struct Dst (o x) -> Proxy o
forall (o :: * -> *) x. Struct Dst (o x) -> Proxy o
q Struct Dst (o x)
so) Struct s (Matrix x)
sm
q :: Struct Dst (o x) -> Proxy o
q :: forall (o :: * -> *) x. Struct Dst (o x) -> Proxy o
q Struct Dst (o x)
_ = Proxy o
forall {k} (t :: k). Proxy t
Proxy
coMatrixGCovPnt ::
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableG Matrix s s
)
=> Struct s x -> Pnt (o (Matrix x)) -> Pnt (Matrix (o x))
coMatrixGCovPnt :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o,
TransformableG Matrix s s) =>
Struct s x -> Pnt (o (Matrix x)) -> Pnt (Matrix (o x))
coMatrixGCovPnt Struct s x
s = Struct Dst (o x)
-> Struct s (Matrix x)
-> Struct s x
-> Pnt (o (Matrix x))
-> Pnt (Matrix (o x))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s (Matrix x)
-> Struct s x
-> Pnt (o (Matrix x))
-> Pnt (Matrix (o x))
coMatrixGCovPntStruct (Struct s (o x) -> Struct Dst (o x)
forall x. Struct s x -> Struct Dst x
forall s t x. Transformable s t => Struct s x -> Struct t x
tau (Struct s (o x) -> Struct Dst (o x))
-> Struct s (o x) -> Struct Dst (o x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Struct s x -> Struct s (o x)
forall (o :: * -> *) s x.
Transformable1 o s =>
Struct s x -> Struct s (o x)
tauO Struct s x
s) (Struct s x -> Struct s (Matrix x)
forall x. Struct s x -> Struct s (Matrix x)
forall (t :: * -> *) u v x.
TransformableG t u v =>
Struct u x -> Struct v (t x)
tauG Struct s x
s) Struct s x
s
coMatrixGInvPntStruct ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> q o -> Struct Dst x -> Struct s x -> Pnt (Matrix (o x)) -> Pnt (Matrix x)
coMatrixGInvPntStruct :: forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x
-> Struct s x
-> Pnt (Matrix (o x))
-> Pnt (Matrix x)
coMatrixGInvPntStruct q o
q Struct Dst x
Struct Struct s x
s (Pnt Point (Matrix (o x))
d) = Point (Matrix x) -> Pnt (Matrix x)
Dim' x -> Pnt (Matrix x)
forall x. Point x -> Pnt x
Pnt (Dim' x -> Pnt (Matrix x)) -> Dim' x -> Pnt (Matrix x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (Point (o x) -> Point x) -> Dim (o x) (Point (o x)) -> Dim' x
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Inv2 (HomDisjEmpty s o) (o x) x -> Point (o x) -> Point x
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap (Inv2 (HomDisjEmpty s o) x (o x) -> Inv2 (HomDisjEmpty s o) (o x) x
forall (c :: * -> * -> *) x y. Inv2 c x y -> Inv2 c y x
inv2 Inv2 (HomDisjEmpty s o) x (o x)
t)) Point (Matrix (o x))
Dim (o x) (Point (o x))
d where
Contravariant2 Inv2 (HomDisjEmpty s o) x (o x)
t = q o
-> Struct s x
-> Variant2 'Contravariant (Inv2 (HomDisjEmpty s o)) x (o x)
forall (o :: * -> *) r (q :: (* -> *) -> *) x.
TransformableGRefl o r =>
q o -> Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO' q o
q Struct s x
s
coMatrixGInvPnt ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> Struct s x -> Pnt (Matrix (o x)) -> Pnt (Matrix x)
coMatrixGInvPnt :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct s x -> Pnt (Matrix (o x)) -> Pnt (Matrix x)
coMatrixGInvPnt Struct s x
s Pnt (Matrix (o x))
pmo = Proxy o
-> Struct Dst x
-> Struct s x
-> Pnt (Matrix (o x))
-> Pnt (Matrix x)
forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x
-> Struct s x
-> Pnt (Matrix (o x))
-> Pnt (Matrix x)
coMatrixGInvPntStruct (Pnt (Matrix (o x)) -> Proxy o
forall (o :: * -> *) x. Pnt (Matrix (o x)) -> Proxy o
q Pnt (Matrix (o x))
pmo) (Struct s x -> Struct Dst x
forall x. Struct s x -> Struct Dst x
forall s t x. Transformable s t => Struct s x -> Struct t x
tau Struct s x
s) Struct s x
s Pnt (Matrix (o x))
pmo where
q :: Pnt (Matrix (o x)) -> Proxy o
q :: forall (o :: * -> *) x. Pnt (Matrix (o x)) -> Proxy o
q Pnt (Matrix (o x))
_ = Proxy o
forall {k} (t :: k). Proxy t
Proxy
coMatrixGInvCovPntStruct ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> q o -> Struct Dst x -> Struct s (Matrix x)
-> Struct s x -> Pnt (Matrix (o x)) -> Pnt (o (Matrix x))
coMatrixGInvCovPntStruct :: forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x
-> Struct s (Matrix x)
-> Struct s x
-> Pnt (Matrix (o x))
-> Pnt (o (Matrix x))
coMatrixGInvCovPntStruct q o
q Struct Dst x
sDst Struct s (Matrix x)
sm Struct s x
s = Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
-> Pnt (Matrix x) -> Pnt (o (Matrix x))
forall x y. Inv2 (HomDisjEmpty s o) x y -> Pnt x -> Pnt y
forall (t :: * -> *) (a :: * -> * -> *) (b :: * -> * -> *) x y.
ApplicativeG t a b =>
a x y -> b (t x) (t y)
amapG Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
t (Pnt (Matrix x) -> Pnt (o (Matrix x)))
-> (Pnt (Matrix (o x)) -> Pnt (Matrix x))
-> Pnt (Matrix (o x))
-> Pnt (o (Matrix x))
forall y z x. (y -> z) -> (x -> y) -> x -> z
forall (c :: * -> * -> *) y z x.
Category c =>
c y z -> c x y -> c x z
. q o
-> Struct Dst x
-> Struct s x
-> Pnt (Matrix (o x))
-> Pnt (Matrix x)
forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x
-> Struct s x
-> Pnt (Matrix (o x))
-> Pnt (Matrix x)
coMatrixGInvPntStruct q o
q Struct Dst x
sDst Struct s x
s where
Contravariant2 Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
t = q o
-> Struct s (Matrix x)
-> Variant2
'Contravariant (Inv2 (HomDisjEmpty s o)) (Matrix x) (o (Matrix x))
forall (o :: * -> *) r (q :: (* -> *) -> *) x.
TransformableGRefl o r =>
q o -> Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO' q o
q Struct s (Matrix x)
sm
coMatrixGInvCovPnt ::
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableG Matrix s s
)
=> Struct s x -> Pnt (Matrix (o x)) -> Pnt (o (Matrix x))
coMatrixGInvCovPnt :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o,
TransformableG Matrix s s) =>
Struct s x -> Pnt (Matrix (o x)) -> Pnt (o (Matrix x))
coMatrixGInvCovPnt Struct s x
s Pnt (Matrix (o x))
pmo = Proxy o
-> Struct Dst x
-> Struct s (Matrix x)
-> Struct s x
-> Pnt (Matrix (o x))
-> Pnt (o (Matrix x))
forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x
-> Struct s (Matrix x)
-> Struct s x
-> Pnt (Matrix (o x))
-> Pnt (o (Matrix x))
coMatrixGInvCovPntStruct (Pnt (Matrix (o x)) -> Proxy o
forall (o :: * -> *) x. Pnt (Matrix (o x)) -> Proxy o
q Pnt (Matrix (o x))
pmo) (Struct s x -> Struct Dst x
forall x. Struct s x -> Struct Dst x
forall s t x. Transformable s t => Struct s x -> Struct t x
tau Struct s x
s) (Struct s x -> Struct s (Matrix x)
forall x. Struct s x -> Struct s (Matrix x)
forall (t :: * -> *) u v x.
TransformableG t u v =>
Struct u x -> Struct v (t x)
tauG Struct s x
s) Struct s x
s Pnt (Matrix (o x))
pmo where
q :: Pnt (Matrix (o x)) -> Proxy o
q :: forall (o :: * -> *) x. Pnt (Matrix (o x)) -> Proxy o
q Pnt (Matrix (o x))
_ = Proxy o
forall {k} (t :: k). Proxy t
Proxy
coMatrixGRtStruct ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> Struct Dst (o x) -> Struct s x -> Rt (Matrix x) -> Rt (Matrix (o x))
coMatrixGRtStruct :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s x -> Rt (Matrix x) -> Rt (Matrix (o x))
coMatrixGRtStruct so :: Struct Dst (o x)
so@Struct Dst (o x)
Struct Struct s x
s (Rt (Dim x (Point x)
cls:>Dim x (Point x)
rws)) = Root (Matrix (o x)) -> Rt (Matrix (o x))
forall x. Root x -> Rt x
Rt (Dim (o x) (Point (o x))
rws'Dim (o x) (Point (o x))
-> Dim (o x) (Point (o x)) -> Orientation (Dim (o x) (Point (o x)))
forall p. p -> p -> Orientation p
:>Dim (o x) (Point (o x))
cls') where
rws' :: Dim (o x) (Point (o x))
rws' = (Point x -> Point (o x))
-> Dim x (Point x) -> Dim (o x) (Point (o x))
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Inv2 (HomDisjEmpty s o) x (o x) -> Point x -> Point (o x)
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap Inv2 (HomDisjEmpty s o) x (o x)
t) Dim x (Point x)
rws
cls' :: Dim (o x) (Point (o x))
cls' = (Point x -> Point (o x))
-> Dim x (Point x) -> Dim (o x) (Point (o x))
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Inv2 (HomDisjEmpty s o) x (o x) -> Point x -> Point (o x)
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap Inv2 (HomDisjEmpty s o) x (o x)
t) Dim x (Point x)
cls
Contravariant2 Inv2 (HomDisjEmpty s o) x (o x)
t = Proxy o
-> Struct s x
-> Variant2 'Contravariant (Inv2 (HomDisjEmpty s o)) x (o x)
forall (o :: * -> *) r (q :: (* -> *) -> *) x.
TransformableGRefl o r =>
q o -> Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO' (Struct Dst (o x) -> Proxy o
forall (o :: * -> *) x. Struct Dst (o x) -> Proxy o
q Struct Dst (o x)
so) Struct s x
s
q :: Struct Dst (o x) -> Proxy o
q :: forall (o :: * -> *) x. Struct Dst (o x) -> Proxy o
q Struct Dst (o x)
_ = Proxy o
forall {k} (t :: k). Proxy t
Proxy
coMatrixGCovRtStruct ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> Struct Dst (o x) -> Struct s (Matrix x) -> Struct s x -> Rt (o (Matrix x)) -> Rt (Matrix (o x))
coMatrixGCovRtStruct :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s (Matrix x)
-> Struct s x
-> Rt (o (Matrix x))
-> Rt (Matrix (o x))
coMatrixGCovRtStruct Struct Dst (o x)
so Struct s (Matrix x)
sm Struct s x
s = Struct Dst (o x)
-> Struct s x -> Rt (Matrix x) -> Rt (Matrix (o x))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s x -> Rt (Matrix x) -> Rt (Matrix (o x))
coMatrixGRtStruct Struct Dst (o x)
so Struct s x
s (Rt (Matrix x) -> Rt (Matrix (o x)))
-> (Rt (o (Matrix x)) -> Rt (Matrix x))
-> Rt (o (Matrix x))
-> Rt (Matrix (o x))
forall y z x. (y -> z) -> (x -> y) -> x -> z
forall (c :: * -> * -> *) y z x.
Category c =>
c y z -> c x y -> c x z
. Inv2 (HomDisjEmpty s o) (o (Matrix x)) (Matrix x)
-> Rt (o (Matrix x)) -> Rt (Matrix x)
forall x y. Inv2 (HomDisjEmpty s o) x y -> Rt x -> Rt y
forall (t :: * -> *) (a :: * -> * -> *) (b :: * -> * -> *) x y.
ApplicativeG t a b =>
a x y -> b (t x) (t y)
amapG (Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
-> Inv2 (HomDisjEmpty s o) (o (Matrix x)) (Matrix x)
forall (c :: * -> * -> *) x y. Inv2 c x y -> Inv2 c y x
inv2 Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
t) where
Contravariant2 Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
t = Proxy o
-> Struct s (Matrix x)
-> Variant2
'Contravariant (Inv2 (HomDisjEmpty s o)) (Matrix x) (o (Matrix x))
forall (o :: * -> *) r (q :: (* -> *) -> *) x.
TransformableGRefl o r =>
q o -> Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO' (Struct Dst (o x) -> Proxy o
forall (o :: * -> *) x. Struct Dst (o x) -> Proxy o
q Struct Dst (o x)
so) Struct s (Matrix x)
sm
q :: Struct Dst (o x) -> Proxy o
q :: forall (o :: * -> *) x. Struct Dst (o x) -> Proxy o
q Struct Dst (o x)
_ = Proxy o
forall {k} (t :: k). Proxy t
Proxy
coMatrixGCovRt ::
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableG Matrix s s
)
=> Struct s x -> Rt (o (Matrix x)) -> Rt (Matrix (o x))
coMatrixGCovRt :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o,
TransformableG Matrix s s) =>
Struct s x -> Rt (o (Matrix x)) -> Rt (Matrix (o x))
coMatrixGCovRt Struct s x
s = Struct Dst (o x)
-> Struct s (Matrix x)
-> Struct s x
-> Rt (o (Matrix x))
-> Rt (Matrix (o x))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o) =>
Struct Dst (o x)
-> Struct s (Matrix x)
-> Struct s x
-> Rt (o (Matrix x))
-> Rt (Matrix (o x))
coMatrixGCovRtStruct (Struct s (o x) -> Struct Dst (o x)
forall x. Struct s x -> Struct Dst x
forall s t x. Transformable s t => Struct s x -> Struct t x
tau (Struct s (o x) -> Struct Dst (o x))
-> Struct s (o x) -> Struct Dst (o x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Struct s x -> Struct s (o x)
forall (o :: * -> *) s x.
Transformable1 o s =>
Struct s x -> Struct s (o x)
tauO Struct s x
s) (Struct s x -> Struct s (Matrix x)
forall x. Struct s x -> Struct s (Matrix x)
forall (t :: * -> *) u v x.
TransformableG t u v =>
Struct u x -> Struct v (t x)
tauG Struct s x
s) Struct s x
s
coMatrixGInvRtStruct ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> q o -> Struct Dst x -> Struct s x -> Rt (Matrix (o x)) -> Rt (Matrix x)
coMatrixGInvRtStruct :: forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x -> Struct s x -> Rt (Matrix (o x)) -> Rt (Matrix x)
coMatrixGInvRtStruct q o
q Struct Dst x
Struct Struct s x
s (Rt (Dim (o x) (Point (o x))
cls':>Dim (o x) (Point (o x))
rws')) = Root (Matrix x) -> Rt (Matrix x)
forall x. Root x -> Rt x
Rt (Dim x (Point x)
rwsDim x (Point x) -> Dim x (Point x) -> Orientation (Dim x (Point x))
forall p. p -> p -> Orientation p
:>Dim x (Point x)
cls) where
rws :: Dim x (Point x)
rws = (Point (o x) -> Point x)
-> Dim (o x) (Point (o x)) -> Dim x (Point x)
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Inv2 (HomDisjEmpty s o) (o x) x -> Point (o x) -> Point x
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap (Inv2 (HomDisjEmpty s o) x (o x) -> Inv2 (HomDisjEmpty s o) (o x) x
forall (c :: * -> * -> *) x y. Inv2 c x y -> Inv2 c y x
inv2 Inv2 (HomDisjEmpty s o) x (o x)
t)) Dim (o x) (Point (o x))
rws'
cls :: Dim x (Point x)
cls = (Point (o x) -> Point x)
-> Dim (o x) (Point (o x)) -> Dim x (Point x)
forall q y p x.
(Entity q, q ~ Point y) =>
(p -> q) -> Dim x p -> Dim y q
dimMap (Inv2 (HomDisjEmpty s o) (o x) x -> Point (o x) -> Point x
forall (h :: * -> * -> *) x y.
ApplicativePoint h =>
h x y -> Point x -> Point y
pmap (Inv2 (HomDisjEmpty s o) x (o x) -> Inv2 (HomDisjEmpty s o) (o x) x
forall (c :: * -> * -> *) x y. Inv2 c x y -> Inv2 c y x
inv2 Inv2 (HomDisjEmpty s o) x (o x)
t)) Dim (o x) (Point (o x))
cls'
Contravariant2 Inv2 (HomDisjEmpty s o) x (o x)
t = q o
-> Struct s x
-> Variant2 'Contravariant (Inv2 (HomDisjEmpty s o)) x (o x)
forall (o :: * -> *) r (q :: (* -> *) -> *) x.
TransformableGRefl o r =>
q o -> Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO' q o
q Struct s x
s
coMatrixGInvCovRtStruct ::
( TransformableGRefl o s
, DualisableDistributive s o
)
=> q o -> Struct Dst x -> Struct s (Matrix x)
-> Struct s x -> Rt (Matrix (o x)) -> Rt (o (Matrix x))
coMatrixGInvCovRtStruct :: forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x
-> Struct s (Matrix x)
-> Struct s x
-> Rt (Matrix (o x))
-> Rt (o (Matrix x))
coMatrixGInvCovRtStruct q o
q Struct Dst x
sDst Struct s (Matrix x)
sm Struct s x
s = Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
-> Rt (Matrix x) -> Rt (o (Matrix x))
forall x y. Inv2 (HomDisjEmpty s o) x y -> Rt x -> Rt y
forall (t :: * -> *) (a :: * -> * -> *) (b :: * -> * -> *) x y.
ApplicativeG t a b =>
a x y -> b (t x) (t y)
amapG Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
t (Rt (Matrix x) -> Rt (o (Matrix x)))
-> (Rt (Matrix (o x)) -> Rt (Matrix x))
-> Rt (Matrix (o x))
-> Rt (o (Matrix x))
forall y z x. (y -> z) -> (x -> y) -> x -> z
forall (c :: * -> * -> *) y z x.
Category c =>
c y z -> c x y -> c x z
. q o
-> Struct Dst x -> Struct s x -> Rt (Matrix (o x)) -> Rt (Matrix x)
forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x -> Struct s x -> Rt (Matrix (o x)) -> Rt (Matrix x)
coMatrixGInvRtStruct q o
q Struct Dst x
sDst Struct s x
s where
Contravariant2 Inv2 (HomDisjEmpty s o) (Matrix x) (o (Matrix x))
t = q o
-> Struct s (Matrix x)
-> Variant2
'Contravariant (Inv2 (HomDisjEmpty s o)) (Matrix x) (o (Matrix x))
forall (o :: * -> *) r (q :: (* -> *) -> *) x.
TransformableGRefl o r =>
q o -> Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO' q o
q Struct s (Matrix x)
sm
coMatrixGInvCovRt ::
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableG Matrix s s
)
=> Struct s x -> Rt (Matrix (o x)) -> Rt (o (Matrix x))
coMatrixGInvCovRt :: forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o,
TransformableG Matrix s s) =>
Struct s x -> Rt (Matrix (o x)) -> Rt (o (Matrix x))
coMatrixGInvCovRt Struct s x
s Rt (Matrix (o x))
rmo = Proxy o
-> Struct Dst x
-> Struct s (Matrix x)
-> Struct s x
-> Rt (Matrix (o x))
-> Rt (o (Matrix x))
forall (o :: * -> *) s (q :: (* -> *) -> *) x.
(TransformableGRefl o s, DualisableDistributive s o) =>
q o
-> Struct Dst x
-> Struct s (Matrix x)
-> Struct s x
-> Rt (Matrix (o x))
-> Rt (o (Matrix x))
coMatrixGInvCovRtStruct (Rt (Matrix (o x)) -> Proxy o
forall (o :: * -> *) x. Rt (Matrix (o x)) -> Proxy o
q Rt (Matrix (o x))
rmo) (Struct s x -> Struct Dst x
forall x. Struct s x -> Struct Dst x
forall s t x. Transformable s t => Struct s x -> Struct t x
tau Struct s x
s) (Struct s x -> Struct s (Matrix x)
forall x. Struct s x -> Struct s (Matrix x)
forall (t :: * -> *) u v x.
TransformableG t u v =>
Struct u x -> Struct v (t x)
tauG Struct s x
s) Struct s x
s Rt (Matrix (o x))
rmo where
q :: Rt (Matrix (o x)) -> Proxy o
q :: forall (o :: * -> *) x. Rt (Matrix (o x)) -> Proxy o
q Rt (Matrix (o x))
_ = Proxy o
forall {k} (t :: k). Proxy t
Proxy
instance
( TransformableDst s
, TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> ApplicativeG Id (MorCo Matrix s o) (->) where
amapG :: forall x y. MorCo Matrix s o x y -> Id x -> Id y
amapG t :: MorCo Matrix s o x y
t@MorCo Matrix s o x y
ToCo = (x -> y) -> Id x -> Id y
forall x y. (x -> y) -> Id x -> Id y
toIdG (Struct s x1 -> x -> y
Struct s x1 -> o (Matrix x1) -> Matrix (o x1)
forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o, TransformableG Matrix s s) =>
Struct s x -> o (Matrix x) -> Matrix (o x)
coMatrixGCov (Struct s x1 -> x -> y) -> Struct s x1 -> x -> y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ MorCo Matrix s o (o (Matrix x1)) y -> Struct s x1
forall (m :: * -> *) s (o :: * -> *) (i :: * -> *) (j :: * -> *) x
y.
MorCo m s o (i (j x)) y -> Struct s x
mcoStruct MorCo Matrix s o x y
MorCo Matrix s o (o (Matrix x1)) y
t)
amapG f :: MorCo Matrix s o x y
f@MorCo Matrix s o x y
FromCo = (x -> y) -> Id x -> Id y
forall x y. (x -> y) -> Id x -> Id y
toIdG (Struct s x1 -> x -> y
Struct s x1 -> Matrix (o x1) -> o (Matrix x1)
forall s (o :: * -> *) x.
(TransformableDst s, TransformableGRefl o s,
DualisableDistributive s o, TransformableG Matrix s s) =>
Struct s x -> Matrix (o x) -> o (Matrix x)
coMatrixGInvCov (Struct s x1 -> x -> y) -> Struct s x1 -> x -> y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ MorCo Matrix s o (Matrix (o x1)) y -> Struct s x1
forall (m :: * -> *) s (o :: * -> *) (i :: * -> *) (j :: * -> *) x
y.
MorCo m s o (i (j x)) y -> Struct s x
mcoStruct MorCo Matrix s o x y
MorCo Matrix s o (Matrix (o x1)) y
f)
instance
( TransformableDst s
, TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> ApplicativeMorCo Id Matrix s o (->)
instance
( TransformableDst s
, TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> FunctorialHomCo Id Matrix s o (->)
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> ApplicativeG Pnt (MorCo Matrix s o) (->) where
amapG :: forall x y. MorCo Matrix s o x y -> Pnt x -> Pnt y
amapG t :: MorCo Matrix s o x y
t@MorCo Matrix s o x y
ToCo = Struct s x1 -> Pnt x -> Pnt y
Struct s x1 -> Pnt (o (Matrix x1)) -> Pnt (Matrix (o x1))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o,
TransformableG Matrix s s) =>
Struct s x -> Pnt (o (Matrix x)) -> Pnt (Matrix (o x))
coMatrixGCovPnt (Struct s x1 -> Pnt x -> Pnt y) -> Struct s x1 -> Pnt x -> Pnt y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ MorCo Matrix s o (o (Matrix x1)) y -> Struct s x1
forall (m :: * -> *) s (o :: * -> *) (i :: * -> *) (j :: * -> *) x
y.
MorCo m s o (i (j x)) y -> Struct s x
mcoStruct MorCo Matrix s o x y
MorCo Matrix s o (o (Matrix x1)) y
t
amapG f :: MorCo Matrix s o x y
f@MorCo Matrix s o x y
FromCo = Struct s x1 -> Pnt x -> Pnt y
Struct s x1 -> Pnt (Matrix (o x1)) -> Pnt (o (Matrix x1))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o,
TransformableG Matrix s s) =>
Struct s x -> Pnt (Matrix (o x)) -> Pnt (o (Matrix x))
coMatrixGInvCovPnt (Struct s x1 -> Pnt x -> Pnt y) -> Struct s x1 -> Pnt x -> Pnt y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ MorCo Matrix s o (Matrix (o x1)) y -> Struct s x1
forall (m :: * -> *) s (o :: * -> *) (i :: * -> *) (j :: * -> *) x
y.
MorCo m s o (i (j x)) y -> Struct s x
mcoStruct MorCo Matrix s o x y
MorCo Matrix s o (Matrix (o x1)) y
f
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> ApplicativeMorCo Pnt Matrix s o (->)
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> FunctorialHomCo Pnt Matrix s o (->)
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
, TransformableDst s
)
=> FunctorialOriented (HomCo Matrix s o)
instance
( DualisableDistributive s o
, TransformableGRefl o s
, TransformableGRefl Matrix s
, TransformableDst s
)
=> HomOrientedDisjunctive (HomCo Matrix s o)
instance
( DualisableDistributive s o
, TransformableGRefl o s
, TransformableGRefl Matrix s
, TransformableDst s
)
=> HomMultiplicativeDisjunctive (HomCo Matrix s o)
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> ApplicativeG Rt (MorCo Matrix s o) (->) where
amapG :: forall x y. MorCo Matrix s o x y -> Rt x -> Rt y
amapG t :: MorCo Matrix s o x y
t@MorCo Matrix s o x y
ToCo = Struct s x1 -> Rt x -> Rt y
Struct s x1 -> Rt (o (Matrix x1)) -> Rt (Matrix (o x1))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o,
TransformableG Matrix s s) =>
Struct s x -> Rt (o (Matrix x)) -> Rt (Matrix (o x))
coMatrixGCovRt (Struct s x1 -> Rt x -> Rt y) -> Struct s x1 -> Rt x -> Rt y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ MorCo Matrix s o (o (Matrix x1)) y -> Struct s x1
forall (m :: * -> *) s (o :: * -> *) (i :: * -> *) (j :: * -> *) x
y.
MorCo m s o (i (j x)) y -> Struct s x
mcoStruct MorCo Matrix s o x y
MorCo Matrix s o (o (Matrix x1)) y
t
amapG f :: MorCo Matrix s o x y
f@MorCo Matrix s o x y
FromCo = Struct s x1 -> Rt x -> Rt y
Struct s x1 -> Rt (Matrix (o x1)) -> Rt (o (Matrix x1))
forall (o :: * -> *) s x.
(TransformableGRefl o s, DualisableDistributive s o,
TransformableG Matrix s s) =>
Struct s x -> Rt (Matrix (o x)) -> Rt (o (Matrix x))
coMatrixGInvCovRt (Struct s x1 -> Rt x -> Rt y) -> Struct s x1 -> Rt x -> Rt y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ MorCo Matrix s o (Matrix (o x1)) y -> Struct s x1
forall (m :: * -> *) s (o :: * -> *) (i :: * -> *) (j :: * -> *) x
y.
MorCo m s o (i (j x)) y -> Struct s x
mcoStruct MorCo Matrix s o x y
MorCo Matrix s o (Matrix (o x1)) y
f
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> ApplicativeMorCo Rt Matrix s o (->)
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
)
=> FunctorialHomCo Rt Matrix s o (->)
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
, TransformableDst s
)
=> FunctorialFibred (HomCo Matrix s o)
instance
( TransformableGRefl o s
, DualisableDistributive s o
, TransformableGRefl Matrix s
, TransformableDst s
)
=> HomFibred (HomCo Matrix s o)
instance
( DualisableDistributive s o
, TransformableGRefl o s
, TransformableGRefl Matrix s
, TransformableDst s
)
=> HomFibredOrientedDisjunctive (HomCo Matrix s o)
instance
( DualisableDistributive s o
, TransformableGRefl o s
, TransformableGRefl Matrix s
, TransformableDst s
)
=> HomAdditive (HomCo Matrix s o)
instance
( DualisableDistributive s o
, TransformableGRefl o s
, TransformableGRefl Matrix s
, TransformableDst s
)
=> HomDistributiveDisjunctive (HomCo Matrix s o)
isoCoMatrixOp :: Distributive x
=> Variant2 Contravariant (IsoCo Matrix Dst Op) (Matrix x) (Matrix (Op x))
isoCoMatrixOp :: forall x.
Distributive x =>
Variant2
'Contravariant (IsoCo Matrix Dst Op) (Matrix x) (Matrix (Op x))
isoCoMatrixOp = Struct Dst x
-> Variant2
'Contravariant (IsoCo Matrix Dst Op) (Matrix x) (Matrix (Op x))
forall (m :: * -> *) s (o :: * -> *) x.
(TransformableG m s s, TransformableG o s s) =>
Struct s x -> Variant2 'Contravariant (IsoCo m s o) (m x) (m (o x))
isoCo Struct Dst x
forall s x. Structure s x => Struct s x
Struct
xMatrix :: Additive x
=> Q -> XOrtOrientation x -> X (Orientation (Point (Matrix x)))
-> XOrtOrientation (Matrix x)
xMatrix :: forall x.
Additive x =>
Q
-> XOrtOrientation x
-> X (Orientation (Point (Matrix x)))
-> XOrtOrientation (Matrix x)
xMatrix Q
qMax XOrtOrientation x
xx X (Orientation (Point (Matrix x)))
xoDim = X (Orientation (Point (Matrix x)))
-> (Orientation (Point (Matrix x)) -> X (Matrix x))
-> XOrtOrientation (Matrix x)
forall q.
X (Orientation (Point q))
-> (Orientation (Point q) -> X q) -> XOrtOrientation q
XOrtOrientation X (Orientation (Point (Matrix x)))
xoDim Orientation (Point (Matrix x)) -> X (Matrix x)
Orientation (Dim x (Point x)) -> X (Matrix x)
xMtx where
xn :: N -> X N
xn N
0 = X N
forall x. X x
XEmpty
xn N
n = N -> N -> X N
xNB N
0 (N -> N
forall a. Enum a => a -> a
pred N
n)
xMtx :: Orientation (Dim x (Point x)) -> X (Matrix x)
xMtx (Dim x (Point x)
cl:>Dim x (Point x)
rw) = do
N
n <- N -> N -> X N
xNB N
0 N
xMax
[(x, N, N)]
xs <- N -> (Dim x (Point x), N) -> (Dim x (Point x), N) -> X [(x, N, N)]
xets N
n (Dim x (Point x)
rw,N
lrw) (Dim x (Point x)
cl,N
lcl)
Matrix x -> X (Matrix x)
forall a. a -> X a
forall (m :: * -> *) a. Monad m => a -> m a
return (Matrix x -> X (Matrix x)) -> Matrix x -> X (Matrix x)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Dim x (Point x) -> Dim x (Point x) -> [(x, N, N)] -> Matrix x
forall x p.
(Additive x, p ~ Point x) =>
Dim x p -> Dim x p -> [(x, N, N)] -> Matrix x
matrix Dim x (Point x)
rw Dim x (Point x)
cl [(x, N, N)]
xs
where lcl :: N
lcl = Dim x (Point x) -> N
forall x. LengthN x => x -> N
lengthN Dim x (Point x)
cl
lrw :: N
lrw = Dim x (Point x) -> N
forall x. LengthN x => x -> N
lengthN Dim x (Point x)
rw
xMax :: N
xMax = Z -> N
forall a b. Projectible a b => b -> a
prj (Z -> N) -> Z -> N
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ (Z, Q) -> Z
forall a b. (a, b) -> a
fst ((Z, Q) -> Z) -> (Z, Q) -> Z
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ Q -> (Z, Q)
forall r. Number r => r -> (Z, r)
zFloorFraction (Q -> (Z, Q)) -> Q -> (Z, Q)
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ N -> Q
forall a b. Embeddable a b => a -> b
inj (N
lclN -> N -> N
forall c. Multiplicative c => c -> c -> c
*N
lrw) Q -> Q -> Q
forall c. Multiplicative c => c -> c -> c
* Q
qMax
xets :: N -> (Dim x (Point x), N) -> (Dim x (Point x), N) -> X [(x, N, N)]
xets N
0 (Dim x (Point x), N)
_ (Dim x (Point x), N)
_ = [(x, N, N)] -> X [(x, N, N)]
forall a. a -> X a
forall (m :: * -> *) a. Monad m => a -> m a
return []
xets N
n (Dim x (Point x)
rw,N
lrw) (Dim x (Point x)
cl,N
lcl) = do
[(x, N, N)]
xs <- N -> (Dim x (Point x), N) -> (Dim x (Point x), N) -> X [(x, N, N)]
xets (N -> N
forall a. Enum a => a -> a
pred N
n) (Dim x (Point x)
rw,N
lrw) (Dim x (Point x)
cl,N
lcl)
N
i <- N -> X N
xn N
lrw
N
j <- N -> X N
xn N
lcl
x
x <- XOrtOrientation x -> Orientation (Point x) -> X x
forall q. XOrtOrientation q -> Orientation (Point q) -> X q
xoArrow XOrtOrientation x
xx (Dim x (Point x)
cl Dim x (Point x) -> N -> Point x
forall (s :: * -> *) i x. Sequence s i x => s x -> i -> x
? N
j Point x -> Point x -> Orientation (Point x)
forall p. p -> p -> Orientation p
:> Dim x (Point x)
rw Dim x (Point x) -> N -> Point x
forall (s :: * -> *) i x. Sequence s i x => s x -> i -> x
? N
i)
[(x, N, N)] -> X [(x, N, N)]
forall a. a -> X a
forall (m :: * -> *) a. Monad m => a -> m a
return ((x
x,N
i,N
j)(x, N, N) -> [(x, N, N)] -> [(x, N, N)]
forall a. a -> [a] -> [a]
:[(x, N, N)]
xs)
xoDim :: Oriented x => N -> N -> XOrtOrientation x -> X (Orientation (Dim' x))
xoDim :: forall x.
Oriented x =>
N -> N -> XOrtOrientation x -> X (Orientation (Dim' x))
xoDim N
l N
h (XOrtOrientation X (Orientation (Point x))
xo Orientation (Point x) -> X x
_) = do
[Point x]
pcl <- N -> N -> X (Point x) -> X [Point x]
forall x. N -> N -> X x -> X [x]
xTakeB N
l N
h ((Orientation (Point x) -> Point x)
-> X (Orientation (Point x)) -> X (Point x)
forall (h :: * -> * -> *) (f :: * -> *) x y.
Applicative1 h f =>
h x y -> f x -> f y
amap1 Orientation (Point x) -> Point x
Orientation (Point x) -> Point (Orientation (Point x))
forall q. Oriented q => q -> Point q
start X (Orientation (Point x))
xo)
[Point x]
prw <- N -> N -> X (Point x) -> X [Point x]
forall x. N -> N -> X x -> X [x]
xTakeB N
l N
h ((Orientation (Point x) -> Point x)
-> X (Orientation (Point x)) -> X (Point x)
forall (h :: * -> * -> *) (f :: * -> *) x y.
Applicative1 h f =>
h x y -> f x -> f y
amap1 Orientation (Point x) -> Point x
Orientation (Point x) -> Point (Orientation (Point x))
forall q. Oriented q => q -> Point q
end X (Orientation (Point x))
xo)
Orientation (Dim' x) -> X (Orientation (Dim' x))
forall a. a -> X a
forall (m :: * -> *) a. Monad m => a -> m a
return ([Point x] -> Dim' x
forall p x. (Entity p, p ~ Point x) => [p] -> Dim x p
productDim [Point x]
pcl Dim' x -> Dim' x -> Orientation (Dim' x)
forall p. p -> p -> Orientation p
:> [Point x] -> Dim' x
forall p x. (Entity p, p ~ Point x) => [p] -> Dim x p
productDim [Point x]
prw)
instance (Distributive x, XStandardOrtOrientation x) => XStandardOrtOrientation (Matrix x) where
xStandardOrtOrientation :: XOrtOrientation (Matrix x)
xStandardOrtOrientation = Q
-> XOrtOrientation x
-> X (Orientation (Point (Matrix x)))
-> XOrtOrientation (Matrix x)
forall x.
Additive x =>
Q
-> XOrtOrientation x
-> X (Orientation (Point (Matrix x)))
-> XOrtOrientation (Matrix x)
xMatrix Q
1 XOrtOrientation x
xo (N -> N -> XOrtOrientation x -> X (Orientation (Dim' x))
forall x.
Oriented x =>
N -> N -> XOrtOrientation x -> X (Orientation (Dim' x))
xoDim N
0 N
5 XOrtOrientation x
xo) where xo :: XOrtOrientation x
xo = XOrtOrientation x
forall q. XStandardOrtOrientation q => XOrtOrientation q
xStandardOrtOrientation
instance TransformableG Matrix DstX DstX where tauG :: forall x. Struct DstX x -> Struct DstX (Matrix x)
tauG Struct DstX x
Struct = Struct DstX (Matrix x)
forall s x. Structure s x => Struct s x
Struct
instance TransformableGRefl Matrix DstX
xMatrixTtl :: (Distributive x, Total x)
=> N -> Q -> X x -> XOrtOrientation (Matrix x)
xMatrixTtl :: forall x.
(Distributive x, Total x) =>
N -> Q -> X x -> XOrtOrientation (Matrix x)
xMatrixTtl N
dimMax Q
qMax X x
xx = Q
-> XOrtOrientation x
-> X (Orientation (Point (Matrix x)))
-> XOrtOrientation (Matrix x)
forall x.
Additive x =>
Q
-> XOrtOrientation x
-> X (Orientation (Point (Matrix x)))
-> XOrtOrientation (Matrix x)
xMatrix Q
qMax (X x -> XOrtOrientation x
forall q. Total q => X q -> XOrtOrientation q
xoTtl X x
xx) X (Orientation (Point (Matrix x)))
X (Orientation (Dim x (Point x)))
xoDim where
d :: Dim x (Point x)
d = Point x -> Dim x (Point x)
forall p x. (Entity p, p ~ Point x) => p -> Dim x p
dim Point x
forall s. Singleton s => s
unit
xoDim :: X (Orientation (Dim x (Point x)))
xoDim = do
N
n <- N -> N -> X N
xNB N
0 N
dimMax
N
m <- N -> N -> X N
xNB N
0 N
dimMax
Orientation (Dim x (Point x)) -> X (Orientation (Dim x (Point x)))
forall a. a -> X a
forall (m :: * -> *) a. Monad m => a -> m a
return (Dim x (Point x)
dDim x (Point x) -> Exponent (Dim x (Point x)) -> Dim x (Point x)
forall f. Exponential f => f -> Exponent f -> f
^N
Exponent (Dim x (Point x))
n Dim x (Point x) -> Dim x (Point x) -> Orientation (Dim x (Point x))
forall p. p -> p -> Orientation p
:> Dim x (Point x)
dDim x (Point x) -> Exponent (Dim x (Point x)) -> Dim x (Point x)
forall f. Exponential f => f -> Exponent f -> f
^N
Exponent (Dim x (Point x))
m)
xodZ :: XOrtOrientation (Matrix Z)
xodZ :: XOrtOrientation (Matrix Z)
xodZ = N -> Q -> X Z -> XOrtOrientation (Matrix Z)
forall x.
(Distributive x, Total x) =>
N -> Q -> X x -> XOrtOrientation (Matrix x)
xMatrixTtl N
5 Q
0.9 (Z -> Z -> X Z
xZB (-Z
100) Z
100)
xodZZ :: XOrtOrientation (Matrix (Matrix Z))
xodZZ :: XOrtOrientation (Matrix (Matrix Z))
xodZZ = Q
-> XOrtOrientation (Matrix Z)
-> X (Orientation (Point (Matrix (Matrix Z))))
-> XOrtOrientation (Matrix (Matrix Z))
forall x.
Additive x =>
Q
-> XOrtOrientation x
-> X (Orientation (Point (Matrix x)))
-> XOrtOrientation (Matrix x)
xMatrix Q
0.7 XOrtOrientation (Matrix Z)
xodZ X (Orientation (Point (Matrix (Matrix Z))))
X (Orientation (Dim (Matrix Z) (Dim Z ())))
xoDim where
dMax :: N
dMax = N
10
xd :: X (Point (Matrix Z))
xd = XOrtOrientation (Matrix Z) -> X (Point (Matrix Z))
forall q. Oriented q => XOrtOrientation q -> X (Point q)
xoPoint XOrtOrientation (Matrix Z)
xodZ
xoDim :: X (Orientation (Dim (Matrix Z) (Dim Z ())))
xoDim = do
[Dim Z ()]
n <- N -> N -> X (Dim Z ()) -> X [Dim Z ()]
forall x. N -> N -> X x -> X [x]
xTakeB N
0 N
dMax X (Dim Z ())
xd
[Dim Z ()]
m <- N -> N -> X (Dim Z ()) -> X [Dim Z ()]
forall x. N -> N -> X x -> X [x]
xTakeB N
0 N
dMax X (Dim Z ())
xd
Orientation (Dim (Matrix Z) (Dim Z ()))
-> X (Orientation (Dim (Matrix Z) (Dim Z ())))
forall a. a -> X a
forall (m :: * -> *) a. Monad m => a -> m a
return ([Dim Z ()] -> Dim (Matrix Z) (Dim Z ())
forall p x. (Entity p, p ~ Point x) => [p] -> Dim x p
productDim [Dim Z ()]
n Dim (Matrix Z) (Dim Z ())
-> Dim (Matrix Z) (Dim Z ())
-> Orientation (Dim (Matrix Z) (Dim Z ()))
forall p. p -> p -> Orientation p
:> [Dim Z ()] -> Dim (Matrix Z) (Dim Z ())
forall p x. (Entity p, p ~ Point x) => [p] -> Dim x p
productDim [Dim Z ()]
m)
instance XStandardPoint (Matrix Z)
instance XStandardOrtSite From (Matrix Z) where
xStandardOrtSite :: XOrtSite 'From (Matrix Z)
xStandardOrtSite = XOrtOrientation (Matrix Z) -> XOrtSite 'From (Matrix Z)
forall q. Oriented q => XOrtOrientation q -> XOrtSite 'From q
xoFrom XOrtOrientation (Matrix Z)
forall q. XStandardOrtOrientation q => XOrtOrientation q
xStandardOrtOrientation
instance XStandardOrtSiteFrom (Matrix Z)
instance XStandardOrtSite To (Matrix Z) where
xStandardOrtSite :: XOrtSite 'To (Matrix Z)
xStandardOrtSite = XOrtOrientation (Matrix Z) -> XOrtSite 'To (Matrix Z)
forall q. Oriented q => XOrtOrientation q -> XOrtSite 'To q
xoTo XOrtOrientation (Matrix Z)
forall q. XStandardOrtOrientation q => XOrtOrientation q
xStandardOrtOrientation
instance XStandard (Matrix Z) where
xStandard :: X (Matrix Z)
xStandard = XOrtSite 'From (Matrix Z) -> X (Matrix Z)
forall q (s :: Site). Oriented q => XOrtSite s q -> XOrt q
xosOrt (XOrtSite 'From (Matrix Z)
forall (s :: Site) a. XStandardOrtSite s a => XOrtSite s a
xStandardOrtSite :: XOrtSite From (Matrix Z))
dstXStdMatrixZ :: Int -> (Matrix Z -> String) -> IO ()
dstXStdMatrixZ :: Int -> (Matrix Z -> String) -> IO ()
dstXStdMatrixZ Int
n Matrix Z -> String
f = IO Omega
getOmega IO Omega -> (Omega -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> X String -> Omega -> IO ()
forall x. (Show x, Ord x) => Int -> X x -> Omega -> IO ()
putDistribution Int
n ((Matrix Z -> String) -> X (Matrix Z) -> X String
forall (h :: * -> * -> *) (f :: * -> *) x y.
Applicative1 h f =>
h x y -> f x -> f y
amap1 Matrix Z -> String
f X (Matrix Z)
forall x. XStandard x => X x
xStandard)
instance
( Conic c
, Diagrammatic d
)
=> XStandardEligibleConeG c Mlt p d Discrete n m (Matrix Z) where
xStandardEligibleConeG :: XEligibleConeG c Mlt p d 'Discrete n m (Matrix Z)
xStandardEligibleConeG = XOrtOrientation (Matrix Z)
-> XEligibleConeG c Mlt p d 'Discrete n m (Matrix Z)
forall x
(c :: *
-> Perspective
-> (DiagramType -> N' -> N' -> * -> *)
-> DiagramType
-> N'
-> N'
-> *
-> *)
(d :: DiagramType -> N' -> N' -> * -> *) s (p :: Perspective)
(n :: N') (m :: N').
(Multiplicative x, Conic c, Diagrammatic d) =>
XOrtOrientation x -> XEligibleConeG c s p d 'Discrete n m x
xecDiscrete XOrtOrientation (Matrix Z)
forall q. XStandardOrtOrientation q => XOrtOrientation q
xStandardOrtOrientation
instance Conic c
=> XStandardEligibleConeFactorG c Mlt Projective d Discrete n m (Matrix Z) where
xStandardEligibleConeFactorG :: XEligibleConeFactorG c Mlt 'Projective d 'Discrete n m (Matrix Z)
xStandardEligibleConeFactorG = XOrtSite 'To (Matrix Z)
-> XEligibleConeFactorG
c Mlt (ToPerspective 'To) d 'Discrete n m (Matrix Z)
forall (c :: *
-> Perspective
-> (DiagramType -> N' -> N' -> * -> *)
-> DiagramType
-> N'
-> N'
-> *
-> *)
(r :: Site) x s (d :: DiagramType -> N' -> N' -> * -> *)
(t :: DiagramType) (n :: N') (m :: N').
Conic c =>
XOrtSite r x
-> XEligibleConeFactorG c s (ToPerspective r) d t n m x
xecfOrtSite (XOrtOrientation (Matrix Z) -> XOrtSite 'To (Matrix Z)
forall q. Oriented q => XOrtOrientation q -> XOrtSite 'To q
xoTo XOrtOrientation (Matrix Z)
forall q. XStandardOrtOrientation q => XOrtOrientation q
xStandardOrtOrientation)
instance Conic c
=> XStandardEligibleConeFactorG c Mlt Injective d Discrete n m (Matrix Z) where
xStandardEligibleConeFactorG :: XEligibleConeFactorG c Mlt 'Injective d 'Discrete n m (Matrix Z)
xStandardEligibleConeFactorG = XOrtSite 'From (Matrix Z)
-> XEligibleConeFactorG
c Mlt (ToPerspective 'From) d 'Discrete n m (Matrix Z)
forall (c :: *
-> Perspective
-> (DiagramType -> N' -> N' -> * -> *)
-> DiagramType
-> N'
-> N'
-> *
-> *)
(r :: Site) x s (d :: DiagramType -> N' -> N' -> * -> *)
(t :: DiagramType) (n :: N') (m :: N').
Conic c =>
XOrtSite r x
-> XEligibleConeFactorG c s (ToPerspective r) d t n m x
xecfOrtSite (XOrtOrientation (Matrix Z) -> XOrtSite 'From (Matrix Z)
forall q. Oriented q => XOrtOrientation q -> XOrtSite 'From q
xoFrom XOrtOrientation (Matrix Z)
forall q. XStandardOrtOrientation q => XOrtOrientation q
xStandardOrtOrientation)