summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Static.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs
index e18ba0c..3e772b2 100644
--- a/packages/base/src/Numeric/LinearAlgebra/Static.hs
+++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs
@@ -786,3 +786,41 @@ instance (KnownNat m, KnownNat n) => Normed (L m n)
786 norm_1 m = norm_1 (extract m) 786 norm_1 m = norm_1 (extract m)
787 norm_2 m = norm_2 (extract m) 787 norm_2 m = norm_2 (extract m)
788 norm_Inf m = norm_Inf (extract m) 788 norm_Inf m = norm_Inf (extract m)
789
790mkSym f = Sym . f . unSym
791mkSym2 f x y = Sym (f (unSym x) (unSym y))
792
793instance KnownNat n => Num (Sym n)
794 where
795 (+) = mkSym2 (+)
796 (*) = mkSym2 (*)
797 (-) = mkSym2 (-)
798 abs = mkSym abs
799 signum = mkSym signum
800 negate = mkSym negate
801 fromInteger = Sym . fromInteger
802
803instance KnownNat n => Fractional (Sym n)
804 where
805 fromRational = Sym . fromRational
806 (/) = mkSym2 (/)
807
808instance KnownNat n => Floating (Sym n)
809 where
810 sin = mkSym sin
811 cos = mkSym cos
812 tan = mkSym tan
813 asin = mkSym asin
814 acos = mkSym acos
815 atan = mkSym atan
816 sinh = mkSym sinh
817 cosh = mkSym cosh
818 tanh = mkSym tanh
819 asinh = mkSym asinh
820 acosh = mkSym acosh
821 atanh = mkSym atanh
822 exp = mkSym exp
823 log = mkSym log
824 sqrt = mkSym sqrt
825 (**) = mkSym2 (**)
826 pi = Sym pi