Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type VectorSpace scalar a = (Field scalar, Module scalar a, Group a)
- class (Finite (Rep v), Representable v, Foldable v, Applicative v) => VectorR v where
- class VectorR v => InnerProdSpace v where
- type VZero x = Zero x
- data VNext v a = VNext {}
- data V f a where
- class (Foldable f, Applicative f) => IsVec f where
- fromV :: V f a -> f a
- type V1' = VNext One
- type V2' = VNext V1'
- type V3' = VNext V2'
- pattern V1' :: a -> V1' a
- pattern V2' :: forall a. a -> a -> V2' a
- pattern V3' :: forall a. a -> a -> a -> V3' a
- newtype Euclid f a = Euclid {
- fromEuclid :: f a
- type V3 = Euclid V3'
- type V2 = Euclid V2'
- pattern V2 :: forall a. a -> a -> Euclid V2' a
- pattern V3 :: forall a. a -> a -> a -> Euclid V3' a
- pureMat :: (Applicative v, Applicative w) => s -> Mat s v w
- (⊙) :: Applicative v => Multiplicative s => v s -> v s -> v s
- (·) :: Field s => InnerProdSpace v => v s -> v s -> s
- sqNorm :: Field s => InnerProdSpace v => v s -> s
- norm :: Algebraic s => InnerProdSpace v => v s -> s
- normalize :: VectorSpace s (v s) => Algebraic s => InnerProdSpace v => v s -> v s
- (×) :: Ring a => V3 a -> V3 a -> V3 a
- type SqMat v s = Mat s v v
- newtype Mat s w v = Mat {
- fromMat :: w (v s)
- newtype Flat w v s = Flat {
- fromFlat :: w (v s)
- flatMat :: Mat s w v -> Flat w v s
- matFlat :: Flat w v s -> Mat s w v
- fromRel :: (VectorR a, VectorR b) => Rel s (Rep a) (Rep b) -> Mat s a b
- type Mat3x3 s = SqMat V3 s
- type Mat2x2 s = SqMat V2 s
- pattern Mat2x2 :: forall s. s -> s -> s -> s -> Mat s V2 V2
- pattern Mat3x3 :: forall s. s -> s -> s -> s -> s -> s -> s -> s -> s -> Mat s V3 V3
- rotation2d :: Transcendental a => a -> Mat2x2 a
- crossProductMatrix :: Group a => V3 a -> Mat3x3 a
- outerWith :: (Applicative v, Applicative w) => (s -> t -> u) -> w s -> v t -> Mat u v w
- outer :: (Applicative v, Applicative w, Multiplicative s) => Euclid w s -> Euclid v s -> Mat s (Euclid w) (Euclid v)
- diagonal :: Eq (Rep v) => Representable v => Ring s => Applicative v => v s -> SqMat v s
- rotation3d :: Transcendental a => a -> V3 a -> Mat3x3 a
- rotationFromTo :: forall a. Algebraic a => V3 a -> V3 a -> Mat3x3 a
- transpose :: Functor f => Distributive g => Mat a f g -> Mat a g f
- matMul :: (Foldable u, Ring s, Applicative w, Applicative v, Applicative u) => Mat s u w -> Mat s v u -> Mat s v w
- (<+>) :: (Applicative f, Additive b) => f b -> f b -> f b
- matVecMul :: forall s v w. (Ring s, Foldable v, Applicative v, Applicative w) => Mat s v w -> v s -> w s
- prop_linear_with_functor_laws :: Property
- runTests :: IO Bool
Documentation
class (Finite (Rep v), Representable v, Foldable v, Applicative v) => VectorR v where Source #
Representation of vector as traversable functor ... but this is missing the link with *^ for module. We should be able to add forall s. PreRing s => Module s (v s), but this creates problems when defining instances.
Nothing
vectorSplit :: v ~ (f ⊗ g) => Dict (VectorR f, VectorR g) Source #
vectorCut :: v ~ (f ⊕ g) => Dict (VectorR f, VectorR g) Source #
class VectorR v => InnerProdSpace v where Source #
Instances
Representable a => Representable (VNext a) Source # | |
Foldable v => Foldable (VNext v) Source # | |
Defined in Algebra.Linear fold :: Monoid m => VNext v m -> m # foldMap :: Monoid m => (a -> m) -> VNext v a -> m # foldMap' :: Monoid m => (a -> m) -> VNext v a -> m # foldr :: (a -> b -> b) -> b -> VNext v a -> b # foldr' :: (a -> b -> b) -> b -> VNext v a -> b # foldl :: (b -> a -> b) -> b -> VNext v a -> b # foldl' :: (b -> a -> b) -> b -> VNext v a -> b # foldr1 :: (a -> a -> a) -> VNext v a -> a # foldl1 :: (a -> a -> a) -> VNext v a -> a # elem :: Eq a => a -> VNext v a -> Bool # maximum :: Ord a => VNext v a -> a # minimum :: Ord a => VNext v a -> a # | |
Traversable v => Traversable (VNext v) Source # | |
Applicative v => Applicative (VNext v) Source # | |
Functor v => Functor (VNext v) Source # | |
Distributive v => Distributive (VNext v) Source # | |
IsVec f => IsVec (VNext f) Source # | |
VectorR a => VectorR (VNext a) Source # | |
(Show a, Show (v a)) => Show (VNext v a) Source # | |
(Eq a, Eq (v a)) => Eq (VNext v a) Source # | |
(Ord a, Ord (v a)) => Ord (VNext v a) Source # | |
Defined in Algebra.Linear | |
type Rep (VNext a) Source # | |
Instances
Foldable (V f) Source # | |
Defined in Algebra.Linear fold :: Monoid m => V f m -> m # foldMap :: Monoid m => (a -> m) -> V f a -> m # foldMap' :: Monoid m => (a -> m) -> V f a -> m # foldr :: (a -> b -> b) -> b -> V f a -> b # foldr' :: (a -> b -> b) -> b -> V f a -> b # foldl :: (b -> a -> b) -> b -> V f a -> b # foldl' :: (b -> a -> b) -> b -> V f a -> b # foldr1 :: (a -> a -> a) -> V f a -> a # foldl1 :: (a -> a -> a) -> V f a -> a # elem :: Eq a => a -> V f a -> Bool # maximum :: Ord a => V f a -> a # | |
Traversable (V f) Source # | |
IsVec f => Applicative (V f) Source # | |
Functor (V f) Source # | |
Show a => Show (V f a) Source # | |
Eq a => Eq (V f a) Source # | |
class (Foldable f, Applicative f) => IsVec f where Source #
Make a Euclidean vector out of a traversable functor. (The p)
Euclid | |
|
Instances
pureMat :: (Applicative v, Applicative w) => s -> Mat s v w Source #
(⊙) :: Applicative v => Multiplicative s => v s -> v s -> v s Source #
Hadamard product
(·) :: Field s => InnerProdSpace v => v s -> v s -> s Source #
sqNorm :: Field s => InnerProdSpace v => v s -> s Source #
norm :: Algebraic s => InnerProdSpace v => v s -> s Source #
normalize :: VectorSpace s (v s) => Algebraic s => InnerProdSpace v => v s -> v s Source #
(×) :: Ring a => V3 a -> V3 a -> V3 a Source #
Cross product in 3 dimensions https://en.wikipedia.org/wiki/Cross_product
Matrix type. (w s) is a column. (v s) is a row.
Instances
(Functor f, Functor g, Scalable s a) => Scalable s (Mat a f g) Source # | |
Ring s => Braided ((⊗) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (One :: Type -> Type) (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Ring s => Cartesian ((⊗) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (One :: Type -> Type) (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Defined in Algebra.Linear exl :: forall (a :: k) (b :: k). O2 (Mat s) a b => Mat s (a ⊗ b) a Source # exr :: forall (a :: k) (b :: k). O2 (Mat s) a b => Mat s (a ⊗ b) b Source # dis :: forall (a :: k). Obj (Mat s) a => Mat s a One Source # dup :: forall (a :: k). Obj (Mat s) a => Mat s a (a ⊗ a) Source # (▵) :: forall (a :: k) (b :: k) (c :: k). (Obj (Mat s) a, Obj (Mat s) b, Obj (Mat s) c) => Mat s a b -> Mat s a c -> Mat s a (b ⊗ c) Source # | |
Ring s => CoCartesian ((⊗) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (One :: Type -> Type) (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Defined in Algebra.Linear inl :: forall (a :: k) (b :: k). O2 (Mat s) a b => Mat s a (a ⊗ b) Source # inr :: forall (a :: k) (b :: k). O2 (Mat s) a b => Mat s b (a ⊗ b) Source # new :: forall (a :: k). Obj (Mat s) a => Mat s One a Source # jam :: forall (a :: k). Obj (Mat s) a => Mat s (a ⊗ a) a Source # (▿) :: forall (a :: k) (b :: k) (c :: k). (Obj (Mat s) a, Obj (Mat s) b, Obj (Mat s) c) => Mat s b a -> Mat s c a -> Mat s (b ⊗ c) a Source # | |
Ring s => Monoidal ((⊗) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (One :: Type -> Type) (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Defined in Algebra.Linear (⊗) :: forall (a :: k) (b :: k) (c :: k) (d :: k). (Obj (Mat s) a, Obj (Mat s) b, Obj (Mat s) c, Obj (Mat s) d) => Mat s a b -> Mat s c d -> Mat s (a ⊗ c) (b ⊗ d) Source # assoc :: forall (a :: k) (b :: k) (c :: k). (Obj (Mat s) a, Obj (Mat s) b, Obj (Mat s) c) => Mat s ((a ⊗ b) ⊗ c) (a ⊗ (b ⊗ c)) Source # assoc_ :: forall (a :: k) (b :: k) (c :: k). (Obj (Mat s) a, Obj (Mat s) b, Obj (Mat s) c) => Mat s (a ⊗ (b ⊗ c)) ((a ⊗ b) ⊗ c) Source # unitorR :: forall (a :: k). (Obj (Mat s) a, Obj (Mat s) One) => Mat s a (a ⊗ One) Source # unitorR_ :: forall (a :: k). (Obj (Mat s) a, Obj (Mat s) One) => Mat s (a ⊗ One) a Source # unitorL :: forall (a :: k). (Obj (Mat s) a, Obj (Mat s) One) => Mat s a (One ⊗ a) Source # unitorL_ :: forall (a :: k). (Obj (Mat s) a, Obj (Mat s) One) => Mat s (One ⊗ a) a Source # | |
Ring s => Symmetric ((⊗) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (One :: Type -> Type) (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Defined in Algebra.Linear | |
Ring s => Braided ((∘) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Id (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Ring s => Monoidal ((∘) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Id (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Defined in Algebra.Linear (⊗) :: forall (a :: k) (b :: k) (c :: k) (d :: k). (Obj (Mat s) a, Obj (Mat s) b, Obj (Mat s) c, Obj (Mat s) d) => Mat s a b -> Mat s c d -> Mat s (a ∘ c) (b ∘ d) Source # assoc :: forall (a :: k) (b :: k) (c :: k). (Obj (Mat s) a, Obj (Mat s) b, Obj (Mat s) c) => Mat s ((a ∘ b) ∘ c) (a ∘ (b ∘ c)) Source # assoc_ :: forall (a :: k) (b :: k) (c :: k). (Obj (Mat s) a, Obj (Mat s) b, Obj (Mat s) c) => Mat s (a ∘ (b ∘ c)) ((a ∘ b) ∘ c) Source # unitorR :: forall (a :: k). (Obj (Mat s) a, Obj (Mat s) Id) => Mat s a (a ∘ Id) Source # unitorR_ :: forall (a :: k). (Obj (Mat s) a, Obj (Mat s) Id) => Mat s (a ∘ Id) a Source # unitorL :: forall (a :: k). (Obj (Mat s) a, Obj (Mat s) Id) => Mat s a (Id ∘ a) Source # unitorL_ :: forall (a :: k). (Obj (Mat s) a, Obj (Mat s) Id) => Mat s (Id ∘ a) a Source # | |
Ring s => Symmetric ((∘) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Id (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Defined in Algebra.Linear | |
Ring s => Category (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
Ring s => Dagger (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
(Arbitrary s, Arbitrary1 a, Arbitrary1 b) => Arbitrary (Mat s a b) Source # | |
Show (w (v s)) => Show (Mat s w v) Source # | |
(Applicative f, Applicative g, AbelianAdditive a) => AbelianAdditive (Mat a f g) Source # | |
Defined in Algebra.Linear | |
(Applicative f, Applicative g, Additive a) => Additive (Mat a f g) Source # | |
(Applicative f, Applicative g, Group a) => Group (Mat a f g) Source # | |
(TestEqual s, Arbitrary s, Arbitrary1 a, Arbitrary1 b, Show (a (b s)), VectorR b, VectorR a) => TestEqual (Mat s a b) Source # | |
type Obj (Mat s :: (Type -> Type) -> (Type -> Type) -> Type) Source # | |
View of the matrix as a composition of functors.
Instances
(Foldable w, Foldable v) => Foldable (Flat w v) Source # | |
Defined in Algebra.Linear fold :: Monoid m => Flat w v m -> m # foldMap :: Monoid m => (a -> m) -> Flat w v a -> m # foldMap' :: Monoid m => (a -> m) -> Flat w v a -> m # foldr :: (a -> b -> b) -> b -> Flat w v a -> b # foldr' :: (a -> b -> b) -> b -> Flat w v a -> b # foldl :: (b -> a -> b) -> b -> Flat w v a -> b # foldl' :: (b -> a -> b) -> b -> Flat w v a -> b # foldr1 :: (a -> a -> a) -> Flat w v a -> a # foldl1 :: (a -> a -> a) -> Flat w v a -> a # elem :: Eq a => a -> Flat w v a -> Bool # maximum :: Ord a => Flat w v a -> a # minimum :: Ord a => Flat w v a -> a # | |
(Applicative w, Applicative v) => Applicative (Flat w v) Source # | |
(Functor w, Functor v) => Functor (Flat w v) Source # | |
Show (w (v s)) => Show (Flat w v s) Source # | |
rotation2d :: Transcendental a => a -> Mat2x2 a Source #
outerWith :: (Applicative v, Applicative w) => (s -> t -> u) -> w s -> v t -> Mat u v w Source #
outer :: (Applicative v, Applicative w, Multiplicative s) => Euclid w s -> Euclid v s -> Mat s (Euclid w) (Euclid v) Source #
Outer product
diagonal :: Eq (Rep v) => Representable v => Ring s => Applicative v => v s -> SqMat v s Source #
rotation3d :: Transcendental a => a -> V3 a -> Mat3x3 a Source #
3d rotation around given axis
rotationFromTo :: forall a. Algebraic a => V3 a -> V3 a -> Mat3x3 a Source #
3d rotation mapping the direction of from
to that of to
transpose :: Functor f => Distributive g => Mat a f g -> Mat a g f Source #
Transposition as distribution
matMul :: (Foldable u, Ring s, Applicative w, Applicative v, Applicative u) => Mat s u w -> Mat s v u -> Mat s v w Source #
(<+>) :: (Applicative f, Additive b) => f b -> f b -> f b Source #
matVecMul :: forall s v w. (Ring s, Foldable v, Applicative v, Applicative w) => Mat s v w -> v s -> w s Source #