summaryrefslogtreecommitdiff
path: root/packages/base/src/Data/Packed/Internal
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Data/Packed/Internal')
-rw-r--r--packages/base/src/Data/Packed/Internal/Numeric.hs14
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
50import Numeric.Vectorized 50import Numeric.Vectorized
51import Data.Complex 51import Data.Complex
52 52
53import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ) 53import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ,multiplyI)
54import Data.Packed.Internal 54import Data.Packed.Internal
55import Foreign.C.Types(CInt) 55import Foreign.C.Types(CInt)
56import Text.Printf(printf) 56import 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
575instance 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
575emptyMul m a b 583emptyMul 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
706type instance RealOf Float = Float 714type instance RealOf Float = Float
707type instance RealOf (Complex Float) = Float 715type instance RealOf (Complex Float) = Float
708 716
717type instance RealOf CInt = CInt
718
709type family ComplexOf x 719type family ComplexOf x
710 720
711type instance ComplexOf Double = Complex Double 721type instance ComplexOf Double = Complex Double