summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/dph/dotp/DotPVect.hs
blob: 5b623017d9205fa4173b627fff4b39ea88de7880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE ParallelArrays #-}
{-# OPTIONS -fvectorise #-}
module DotPVect ( dotp ) where

import Data.Array.Parallel
import Data.Array.Parallel.Prelude.Double as D

import qualified Prelude

dotp :: PArray Double -> PArray Double -> Double
{-# NOINLINE dotp #-}
dotp v w = dotp' (fromPArrayP v) (fromPArrayP w)

dotp' :: [:Double:] -> [:Double:] -> Double
dotp' v w = D.sumP (zipWithP (*) v w)