From 2869503ccb552238e330562a62a076e48d567f79 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 20 Jun 2014 11:30:59 +0200 Subject: dot, mul, app --- packages/base/src/Data/Packed/Numeric.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'packages/base/src/Data/Packed') diff --git a/packages/base/src/Data/Packed/Numeric.hs b/packages/base/src/Data/Packed/Numeric.hs index ab9e8a2..7aa53f1 100644 --- a/packages/base/src/Data/Packed/Numeric.hs +++ b/packages/base/src/Data/Packed/Numeric.hs @@ -39,7 +39,7 @@ module Data.Packed.Numeric ( step, cond, find, assoc, accum, Transposable(..), Linear(..), -- * Matrix product - Product(..), udot, dot, (<·>), (#>), + Product(..), udot, dot, (<·>), (#>), app, Mul(..), (<.>), optimiseMult, @@ -105,7 +105,7 @@ infixl 7 <.> infixr 8 <·>, #> -{- | dot product +{- | infix synonym for 'dot' >>> vector [1,2,3,4] <·> vector [-2,0,1,1] 5.0 @@ -121,7 +121,7 @@ infixr 8 <·>, #> (<·>) = dot -{- | dense matrix-vector product +{- | infix synonym for 'app' >>> let m = (2><3) [1..] >>> m @@ -138,6 +138,10 @@ fromList [140.0,320.0] (#>) :: Numeric t => Matrix t -> Vector t -> Vector t (#>) = mXv +-- | dense matrix-vector product +app :: Numeric t => Matrix t -> Vector t -> Vector t +app = (#>) + -------------------------------------------------------------------------------- class Mul a b c | a b -> c where @@ -226,8 +230,8 @@ instance Container Matrix e => Build (Int,Int) (e -> e -> e) Matrix e -------------------------------------------------------------------------------- --- | dot product: @cdot u v = 'udot' ('conj' u) v@ -dot :: (Container Vector t, Product t) => Vector t -> Vector t -> t +-- @dot u v = 'udot' ('conj' u) v@ +dot :: (Numeric t) => Vector t -> Vector t -> t dot u v = udot (conj u) v -------------------------------------------------------------------------------- -- cgit v1.2.3