summaryrefslogtreecommitdiff
path: root/packages/base/src
diff options
context:
space:
mode:
authorJustin Le <justin@jle.im>2016-05-25 02:35:19 -0700
committerJustin Le <justin@jle.im>2016-05-25 02:36:42 -0700
commit37c1348ade91807bdad45272801115b32572ad40 (patch)
tree5b6f6f288c7b178deb8dc2dddc7a280c274e417c /packages/base/src
parent5623e4d4e613b89786a225265a4d8373680096f3 (diff)
Additive, Transposable instances for Static data types
Diffstat (limited to 'packages/base/src')
-rw-r--r--packages/base/src/Internal/Static.hs12
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Static.hs7
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
521instance Additive (R n) where
522 add = (+)
523
524instance Additive (C n) where
525 add = (+)
526
527instance (KnownNat m, KnownNat n) => Additive (L m n) where
528 add = (+)
529
530instance (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
825instance KnownNat n => Additive (Sym n) where
826 add = (+)
827
828instance KnownNat n => Transposable (Sym n) (Sym n) where
829 tr (Sym m) = Sym (tr m)
830 tr' = id