I have a vector of Float
elements created by the getVectorFloat
function.
In order to make some measurements, I need to use deepSeqArray
.
However, I don't manage to do it.
Here is my example:
import Data.Array.Repa as R
import Data.Array.Repa.Algorithms.Randomish
len :: Int
len = 3000000
main = do
ws <- getVectorFloat len
ws `deepSeqArray` return()
getVectorFloat :: Int -> Array DIM1 Float
getVectorFloat len = R.map (toFloat) (getVectorDouble len)
toFloat :: Double -> Float
toFloat a = realToFrac a
getVectorDouble :: Int -> Array DIM1 Double
getVectorDouble len = randomishDoubleArray (Z :. len) (-100) 100 1
And the error I get:
haskell.hs:9:9:
Couldn't match expected type `Array sh0 a0'
with actual type `Float'
In the first argument of `deepSeqArray', namely `ws'
In the expression: ws `deepSeqArray` return ()
In the expression:
do { ws <- getVectorFloat len;
ws `deepSeqArray` return () }
I don't understand why Array sh0 a0
can't be matched to Array Dim1 Float
.
Thank you for your help