BNFC-2.5.0.1: A compiler front-end generator.
Safe HaskellNone
LanguageHaskell2010

Data.Matrix.Quad

Synopsis

Documentation

data Shape Source #

Constructors

Bin Shape Shape 
Leaf 

data Shape' (a :: Shape) where Source #

Constructors

Bin' :: forall (s :: Shape) (s' :: Shape). !Int -> Shape' s -> Shape' s' -> Shape' ('Bin s s') 
Leaf' :: Shape' 'Leaf 

data SomeShape where Source #

Constructors

S :: forall (s :: Shape). Shape' s -> SomeShape 

data Mat (a :: Shape) (b :: Shape) c where Source #

Constructors

Quad :: forall (x1 :: Shape) (y1 :: Shape) c (x2 :: Shape) (y2 :: Shape). !(Mat x1 y1 c) -> !(Mat x2 y1 c) -> !(Mat x1 y2 c) -> !(Mat x2 y2 c) -> Mat ('Bin x1 x2) ('Bin y1 y2) c 
Zero :: forall (a :: Shape) (b :: Shape) c. Mat a b c 
One :: forall c. !c -> Mat 'Leaf 'Leaf c 
Row :: forall (x1 :: Shape) c (x2 :: Shape). Mat x1 'Leaf c -> Mat x2 'Leaf c -> Mat ('Bin x1 x2) 'Leaf c 
Col :: forall (y1 :: Shape) c (y2 :: Shape). Mat 'Leaf y1 c -> Mat 'Leaf y2 c -> Mat 'Leaf ('Bin y1 y2) c 

Instances

Instances details
AbelianGroupZ a => AbelianGroup (Mat x y a) Source # 
Instance details

Defined in Data.Matrix.Quad

Methods

zero :: Mat x y a Source #

(+) :: Mat x y a -> Mat x y a -> Mat x y a Source #

data Vec (a :: Shape) b where Source #

Constructors

Z :: forall (a :: Shape) b. Vec a b 
O :: forall b. b -> Vec 'Leaf b 
(:!) :: forall (s :: Shape) b (s' :: Shape). Vec s b -> Vec s' b -> Vec ('Bin s s') b 

Instances

Instances details
AbelianGroup a => AbelianGroup (Vec x a) Source # 
Instance details

Defined in Data.Matrix.Quad

Methods

zero :: Vec x a Source #

(+) :: Vec x a -> Vec x a -> Vec x a Source #

row :: forall {x1 :: Shape} {a} {x2 :: Shape}. Mat x1 'Leaf a -> Mat x2 'Leaf a -> Mat ('Bin x1 x2) 'Leaf a Source #

col :: forall (y1 :: Shape) a (y2 :: Shape). Mat 'Leaf y1 a -> Mat 'Leaf y2 a -> Mat 'Leaf ('Bin y1 y2) a Source #

quad :: forall {x1 :: Shape} {y1 :: Shape} {a} {x2 :: Shape} {y2 :: Shape}. Mat x1 y1 a -> Mat x2 y1 a -> Mat x1 y2 a -> Mat x2 y2 a -> Mat ('Bin x1 x2) ('Bin y1 y2) a Source #

one :: AbelianGroupZ a => a -> Mat 'Leaf 'Leaf a Source #

(.+.) :: forall a (x :: Shape) (y :: Shape). AbelianGroupZ a => Mat x y a -> Mat x y a -> Mat x y a Source #

mult :: forall a (x :: Shape) (y :: Shape) (z :: Shape). RingP a => Bool -> Mat x y a -> Mat z x a -> Mat z y (Pair a) Source #

trav :: forall a (y :: Shape) (x :: Shape). AbelianGroupZ a => Mat y x (Pair a) -> Pair (Mat y x a) Source #

q0 :: forall (x :: Shape) (x' :: Shape) (y :: Shape) (y' :: Shape) a. Mat ('Bin x x') ('Bin y y') a Source #

closeDisjointP :: forall a (x :: Shape) (y :: Shape). RingP a => Bool -> Mat x x a -> Mat y x (Pair a) -> Mat y y a -> Pair (Mat y x a) Source #

showR :: forall (x :: Shape) (y :: Shape) a. Mat x y a -> String Source #

bin' :: forall (s :: Shape) (s' :: Shape). Shape' s -> Shape' s' -> Shape' ('Bin s s') Source #

mkSing :: forall a (x :: Shape) (y :: Shape). AbelianGroupZ a => Shape' x -> Shape' y -> a -> Mat x y a Source #

data SomeTri a where Source #

Constructors

T :: forall (s :: Shape) a. Shape' s -> Pair (Mat s s a) -> SomeTri a 

type Q a = SomeTri a Source #

mkUpDiag :: forall a (s :: Shape). AbelianGroupZ a => [a] -> Shape' s -> Mat s s a Source #

close :: forall a (s :: Shape). RingP a => Bool -> Mat s s (Pair a) -> Pair (Mat s s a) Source #

mkTree :: RingP a => [Pair a] -> SomeTri a Source #

quad' :: forall {f} {x1 :: Shape} {y1 :: Shape} {a} {x2 :: Shape} {y2 :: Shape}. Applicative f => f (Mat x1 y1 a) -> f (Mat x2 y1 a) -> f (Mat x1 y2 a) -> f (Mat x2 y2 a) -> f (Mat ('Bin x1 x2) ('Bin y1 y2) a) Source #

mergein :: RingP a => Bool -> SomeTri a -> Pair a -> SomeTri a -> SomeTri a Source #

zw :: forall a b c (y :: Shape). (AbelianGroup a, AbelianGroup b) => (a -> b -> c) -> Vec y a -> Vec y b -> Vec y c Source #

A variant of zipWith on vectors

lk :: forall a (x :: Shape). AbelianGroup a => Int -> Shape' x -> Vec x a -> a Source #

Lookup in a vector

lin' :: forall a (x :: Shape) (y :: Shape). AbelianGroup a => Mat x y a -> Vec y (Vec x a) Source #

Linearize a matrix

contents :: forall (x :: Shape) a. Shape' x -> Vec x a -> [(Int, a)] Source #

Contents of a vector

first :: (t -> a) -> (t, b) -> (a, b) Source #

second :: (t -> b) -> (a, t) -> (a, b) Source #

data Path (a :: Shape) where Source #

Constructors

Here :: Path 'Leaf 
Low :: forall (s :: Shape) (s' :: Shape). Path s -> Path ('Bin s s') 
High :: forall (s :: Shape) (s' :: Shape). Path s -> Path ('Bin s' s) 

(<||>) :: forall a (x :: Shape) (x' :: Shape). Maybe (a, Path x) -> Maybe (a, Path x') -> Maybe (a, Path ('Bin x x')) Source #

rightmostOnLine :: forall (y :: Shape) (x :: Shape) a. Path y -> Mat x y a -> Maybe (a, Path x) Source #

What is, and where is the rightmost non-zero element on a given line of the matrix?

isRightmost :: forall (x :: Shape). Path x -> Bool Source #

Is this the rightmost path?

results' :: forall a (y :: Shape). AbelianGroup a => Mat y y a -> Path y -> [(Path y, a, Path y)] Source #

results :: AbelianGroupZ a => SomeTri a -> [(Int, a, Int)] Source #

leftMost :: forall (s :: Shape). Shape' s -> Path s Source #

fromPath :: forall (y :: Shape). Shape' y -> Path y -> Int Source #

root' :: forall a (x :: Shape) (y :: Shape). AbelianGroup a => Mat x y a -> a Source #

square3 :: RingP a => Bool -> Pair a -> Pair a -> SomeTri a Source #

sz' :: forall (s :: Shape). Shape' s -> Int Source #

(|+|) :: [[a]] -> [[a]] -> [[a]] Source #

(-+-) :: [a] -> [a] -> [a] Source #

lin :: forall a (x :: Shape) (y :: Shape). AbelianGroup a => Shape' x -> Shape' y -> Mat x y a -> [[a]] Source #