diff options
Diffstat (limited to 'packages/base/src/Data')
-rw-r--r-- | packages/base/src/Data/Packed/Internal/Numeric.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/base/src/Data/Packed/Internal/Numeric.hs b/packages/base/src/Data/Packed/Internal/Numeric.hs index 354863f..2e36de2 100644 --- a/packages/base/src/Data/Packed/Internal/Numeric.hs +++ b/packages/base/src/Data/Packed/Internal/Numeric.hs | |||
@@ -50,7 +50,7 @@ import Data.Packed.Development | |||
50 | import Numeric.Vectorized | 50 | import Numeric.Vectorized |
51 | import Data.Complex | 51 | import Data.Complex |
52 | 52 | ||
53 | import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ) | 53 | import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ,multiplyI) |
54 | import Data.Packed.Internal | 54 | import Data.Packed.Internal |
55 | import Foreign.C.Types(CInt) | 55 | import Foreign.C.Types(CInt) |
56 | import Text.Printf(printf) | 56 | import Text.Printf(printf) |
@@ -540,7 +540,7 @@ class (Num e, Element e) => Product e where | |||
540 | -- | sum of absolute value of elements | 540 | -- | sum of absolute value of elements |
541 | norm1 :: Vector e -> RealOf e | 541 | norm1 :: Vector e -> RealOf e |
542 | -- | euclidean norm | 542 | -- | euclidean norm |
543 | norm2 :: Vector e -> RealOf e | 543 | norm2 :: Floating e => Vector e -> RealOf e |
544 | -- | element of maximum magnitude | 544 | -- | element of maximum magnitude |
545 | normInf :: Vector e -> RealOf e | 545 | normInf :: Vector e -> RealOf e |
546 | 546 | ||
@@ -572,6 +572,14 @@ instance Product (Complex Double) where | |||
572 | normInf = emptyVal (maxElement . fst . fromComplex . vectorMapC Abs) | 572 | normInf = emptyVal (maxElement . fst . fromComplex . vectorMapC Abs) |
573 | multiply = emptyMul multiplyC | 573 | multiply = emptyMul multiplyC |
574 | 574 | ||
575 | instance Product CInt where | ||
576 | norm2 = undefined | ||
577 | -- absSum = emptyVal (toScalarF AbsSum) | ||
578 | -- norm1 = emptyVal (toScalarF AbsSum) | ||
579 | -- normInf = emptyVal (maxElement . vectorMapF Abs) | ||
580 | multiply = emptyMul multiplyI | ||
581 | |||
582 | |||
575 | emptyMul m a b | 583 | emptyMul m a b |
576 | | x1 == 0 && x2 == 0 || r == 0 || c == 0 = konst' 0 (r,c) | 584 | | x1 == 0 && x2 == 0 || r == 0 || c == 0 = konst' 0 (r,c) |
577 | | otherwise = m a b | 585 | | otherwise = m a b |
@@ -706,6 +714,8 @@ type instance RealOf (Complex Double) = Double | |||
706 | type instance RealOf Float = Float | 714 | type instance RealOf Float = Float |
707 | type instance RealOf (Complex Float) = Float | 715 | type instance RealOf (Complex Float) = Float |
708 | 716 | ||
717 | type instance RealOf CInt = CInt | ||
718 | |||
709 | type family ComplexOf x | 719 | type family ComplexOf x |
710 | 720 | ||
711 | type instance ComplexOf Double = Complex Double | 721 | type instance ComplexOf Double = Complex Double |