diff options
Diffstat (limited to 'packages/base/src/Numeric')
-rw-r--r-- | packages/base/src/Numeric/Container.hs | 3 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra.hs | 2 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static/Internal.hs | 8 | ||||
-rw-r--r-- | packages/base/src/Numeric/Matrix.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Numeric/Vector.hs | 2 |
5 files changed, 9 insertions, 10 deletions
diff --git a/packages/base/src/Numeric/Container.hs b/packages/base/src/Numeric/Container.hs index 5c1a28b..48291a1 100644 --- a/packages/base/src/Numeric/Container.hs +++ b/packages/base/src/Numeric/Container.hs | |||
@@ -7,8 +7,7 @@ module Numeric.Container( | |||
7 | diag, | 7 | diag, |
8 | ident, | 8 | ident, |
9 | ctrans, | 9 | ctrans, |
10 | SContainer(addConstant,add, sub, mul, equal), | 10 | Container(addConstant,add, sub, mul, equal,scaleRecip,divide), |
11 | Container(scaleRecip,divide), | ||
12 | scalar, | 11 | scalar, |
13 | conj, | 12 | conj, |
14 | scale, | 13 | scale, |
diff --git a/packages/base/src/Numeric/LinearAlgebra.hs b/packages/base/src/Numeric/LinearAlgebra.hs index 246c728..4ba0c98 100644 --- a/packages/base/src/Numeric/LinearAlgebra.hs +++ b/packages/base/src/Numeric/LinearAlgebra.hs | |||
@@ -137,7 +137,7 @@ module Numeric.LinearAlgebra ( | |||
137 | meanCov, rowOuters, pairwiseD2, unitary, peps, relativeError, haussholder, optimiseMult, udot, nullspaceSVD, orthSVD, ranksv, | 137 | meanCov, rowOuters, pairwiseD2, unitary, peps, relativeError, haussholder, optimiseMult, udot, nullspaceSVD, orthSVD, ranksv, |
138 | ℝ,ℂ,iC, | 138 | ℝ,ℂ,iC, |
139 | -- * Auxiliary classes | 139 | -- * Auxiliary classes |
140 | Element, SContainer, Container, Product, Numeric, LSDiv, | 140 | Element, Container, Product, Numeric, LSDiv, |
141 | Complexable, RealElement, | 141 | Complexable, RealElement, |
142 | RealOf, ComplexOf, SingleOf, DoubleOf, | 142 | RealOf, ComplexOf, SingleOf, DoubleOf, |
143 | IndexOf, | 143 | IndexOf, |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static/Internal.hs b/packages/base/src/Numeric/LinearAlgebra/Static/Internal.hs index a5fc29b..7ecb132 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static/Internal.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static/Internal.hs | |||
@@ -322,12 +322,12 @@ instance forall n t . (Num (Vector t), Numeric t )=> Num (Dim n (Vector t)) | |||
322 | negate = lift1F negate | 322 | negate = lift1F negate |
323 | fromInteger x = Dim (fromInteger x) | 323 | fromInteger x = Dim (fromInteger x) |
324 | 324 | ||
325 | instance (Num (Vector t), Num (Matrix t), Numeric t) => Fractional (Dim n (Vector t)) | 325 | instance (Num (Vector t), Num (Matrix t), Fractional t, Numeric t) => Fractional (Dim n (Vector t)) |
326 | where | 326 | where |
327 | fromRational x = Dim (fromRational x) | 327 | fromRational x = Dim (fromRational x) |
328 | (/) = lift2F (/) | 328 | (/) = lift2F (/) |
329 | 329 | ||
330 | instance (Floating (Vector t), Numeric t) => Floating (Dim n (Vector t)) where | 330 | instance (Fractional t, Floating (Vector t), Numeric t) => Floating (Dim n (Vector t)) where |
331 | sin = lift1F sin | 331 | sin = lift1F sin |
332 | cos = lift1F cos | 332 | cos = lift1F cos |
333 | tan = lift1F tan | 333 | tan = lift1F tan |
@@ -357,12 +357,12 @@ instance (Num (Matrix t), Numeric t) => Num (Dim m (Dim n (Matrix t))) | |||
357 | negate = (lift1F . lift1F) negate | 357 | negate = (lift1F . lift1F) negate |
358 | fromInteger x = Dim (Dim (fromInteger x)) | 358 | fromInteger x = Dim (Dim (fromInteger x)) |
359 | 359 | ||
360 | instance (Num (Vector t), Num (Matrix t), Numeric t) => Fractional (Dim m (Dim n (Matrix t))) | 360 | instance (Num (Vector t), Num (Matrix t), Fractional t, Numeric t) => Fractional (Dim m (Dim n (Matrix t))) |
361 | where | 361 | where |
362 | fromRational x = Dim (Dim (fromRational x)) | 362 | fromRational x = Dim (Dim (fromRational x)) |
363 | (/) = (lift2F.lift2F) (/) | 363 | (/) = (lift2F.lift2F) (/) |
364 | 364 | ||
365 | instance (Num (Vector t), Floating (Matrix t), Numeric t) => Floating (Dim m (Dim n (Matrix t))) where | 365 | instance (Num (Vector t), Floating (Matrix t), Fractional t, Numeric t) => Floating (Dim m (Dim n (Matrix t))) where |
366 | sin = (lift1F . lift1F) sin | 366 | sin = (lift1F . lift1F) sin |
367 | cos = (lift1F . lift1F) cos | 367 | cos = (lift1F . lift1F) cos |
368 | tan = (lift1F . lift1F) tan | 368 | tan = (lift1F . lift1F) tan |
diff --git a/packages/base/src/Numeric/Matrix.hs b/packages/base/src/Numeric/Matrix.hs index a9022c6..5f27652 100644 --- a/packages/base/src/Numeric/Matrix.hs +++ b/packages/base/src/Numeric/Matrix.hs | |||
@@ -37,7 +37,7 @@ import Numeric.Chain | |||
37 | instance Container Matrix a => Eq (Matrix a) where | 37 | instance Container Matrix a => Eq (Matrix a) where |
38 | (==) = equal | 38 | (==) = equal |
39 | 39 | ||
40 | instance (Container Matrix a, Num (Vector a)) => Num (Matrix a) where | 40 | instance (Container Matrix a, Num a, Num (Vector a)) => Num (Matrix a) where |
41 | (+) = liftMatrix2Auto (+) | 41 | (+) = liftMatrix2Auto (+) |
42 | (-) = liftMatrix2Auto (-) | 42 | (-) = liftMatrix2Auto (-) |
43 | negate = liftMatrix negate | 43 | negate = liftMatrix negate |
@@ -48,7 +48,7 @@ instance (Container Matrix a, Num (Vector a)) => Num (Matrix a) where | |||
48 | 48 | ||
49 | --------------------------------------------------- | 49 | --------------------------------------------------- |
50 | 50 | ||
51 | instance (Container Vector a, Fractional (Vector a), Num (Matrix a)) => Fractional (Matrix a) where | 51 | instance (Container Vector a, Fractional a, Fractional (Vector a), Num (Matrix a)) => Fractional (Matrix a) where |
52 | fromRational n = (1><1) [fromRational n] | 52 | fromRational n = (1><1) [fromRational n] |
53 | (/) = liftMatrix2Auto (/) | 53 | (/) = liftMatrix2Auto (/) |
54 | 54 | ||
diff --git a/packages/base/src/Numeric/Vector.hs b/packages/base/src/Numeric/Vector.hs index 28b453f..1c16871 100644 --- a/packages/base/src/Numeric/Vector.hs +++ b/packages/base/src/Numeric/Vector.hs | |||
@@ -66,7 +66,7 @@ instance Num (Vector (Complex Float)) where | |||
66 | 66 | ||
67 | --------------------------------------------------- | 67 | --------------------------------------------------- |
68 | 68 | ||
69 | instance (Container Vector a, Num (Vector a)) => Fractional (Vector a) where | 69 | instance (Container Vector a, Num (Vector a), Fractional a) => Fractional (Vector a) where |
70 | fromRational n = fromList [fromRational n] | 70 | fromRational n = fromList [fromRational n] |
71 | (/) = adaptScalar f divide g where | 71 | (/) = adaptScalar f divide g where |
72 | r `f` v = scaleRecip r v | 72 | r `f` v = scaleRecip r v |