From 36379e29fe99b033313f42464897c32b9805559d Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sat, 23 May 2015 12:09:45 +0200 Subject: multiplyI --- packages/base/src/Data/Packed/Internal/Numeric.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'packages/base/src/Data/Packed/Internal/Numeric.hs') 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 import Numeric.Vectorized import Data.Complex -import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ) +import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ,multiplyI) import Data.Packed.Internal import Foreign.C.Types(CInt) import Text.Printf(printf) @@ -540,7 +540,7 @@ class (Num e, Element e) => Product e where -- | sum of absolute value of elements norm1 :: Vector e -> RealOf e -- | euclidean norm - norm2 :: Vector e -> RealOf e + norm2 :: Floating e => Vector e -> RealOf e -- | element of maximum magnitude normInf :: Vector e -> RealOf e @@ -572,6 +572,14 @@ instance Product (Complex Double) where normInf = emptyVal (maxElement . fst . fromComplex . vectorMapC Abs) multiply = emptyMul multiplyC +instance Product CInt where + norm2 = undefined +-- absSum = emptyVal (toScalarF AbsSum) +-- norm1 = emptyVal (toScalarF AbsSum) +-- normInf = emptyVal (maxElement . vectorMapF Abs) + multiply = emptyMul multiplyI + + emptyMul m a b | x1 == 0 && x2 == 0 || r == 0 || c == 0 = konst' 0 (r,c) | otherwise = m a b @@ -706,6 +714,8 @@ type instance RealOf (Complex Double) = Double type instance RealOf Float = Float type instance RealOf (Complex Float) = Float +type instance RealOf CInt = CInt + type family ComplexOf x type instance ComplexOf Double = Complex Double -- cgit v1.2.3