diff options
author | Justin Le <justin@jle.im> | 2016-05-25 02:35:19 -0700 |
---|---|---|
committer | Justin Le <justin@jle.im> | 2016-05-25 02:36:42 -0700 |
commit | 37c1348ade91807bdad45272801115b32572ad40 (patch) | |
tree | 5b6f6f288c7b178deb8dc2dddc7a280c274e417c /packages/base/src | |
parent | 5623e4d4e613b89786a225265a4d8373680096f3 (diff) |
Additive, Transposable instances for Static data types
Diffstat (limited to 'packages/base/src')
-rw-r--r-- | packages/base/src/Internal/Static.hs | 12 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/packages/base/src/Internal/Static.hs b/packages/base/src/Internal/Static.hs index 381f3bc..9ed4710 100644 --- a/packages/base/src/Internal/Static.hs +++ b/packages/base/src/Internal/Static.hs | |||
@@ -518,6 +518,18 @@ instance (KnownNat n, KnownNat m) => Floating (M n m) where | |||
518 | (**) = lift2MD (**) | 518 | (**) = lift2MD (**) |
519 | pi = M pi | 519 | pi = M pi |
520 | 520 | ||
521 | instance Additive (R n) where | ||
522 | add = (+) | ||
523 | |||
524 | instance Additive (C n) where | ||
525 | add = (+) | ||
526 | |||
527 | instance (KnownNat m, KnownNat n) => Additive (L m n) where | ||
528 | add = (+) | ||
529 | |||
530 | instance (KnownNat m, KnownNat n) => Additive (M m n) where | ||
531 | add = (+) | ||
532 | |||
521 | -------------------------------------------------------------------------------- | 533 | -------------------------------------------------------------------------------- |
522 | 534 | ||
523 | 535 | ||
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index a55ae44..2ffc531 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -821,3 +821,10 @@ instance KnownNat n => Floating (Sym n) | |||
821 | sqrt = mkSym sqrt | 821 | sqrt = mkSym sqrt |
822 | (**) = mkSym2 (**) | 822 | (**) = mkSym2 (**) |
823 | pi = Sym pi | 823 | pi = Sym pi |
824 | |||
825 | instance KnownNat n => Additive (Sym n) where | ||
826 | add = (+) | ||
827 | |||
828 | instance KnownNat n => Transposable (Sym n) (Sym n) where | ||
829 | tr (Sym m) = Sym (tr m) | ||
830 | tr' = id | ||