Questions tagged [repa]

Repa is a Haskell package for high performance, regular, shape polymorphic parallel arrays.

Repa provides high performance, regular, multi-dimensional, shape polymorphic parallel arrays. All numeric data is stored unboxed. Functions written with the Repa combinators are automatically parallel provided you supply +RTS -Nwhatever on the command line when running the program.

104 questions
1
vote
2 answers

Creating images to use with repa-devil

I am using repa-devil to read and write images. Now I need to programmatically create images. However, the Image constructors (such as RGB) in Data.Array.Repa.IO.DevIL all require foreign memory buffer arrays. Do I have to go off and learn how to…
mhwombat
  • 8,026
  • 28
  • 53
0
votes
1 answer

How to enable parallelism in the HIP library

I wrote a Mandelbrot set generator in Haskell using the HIP library. Now I am trying to parallelize it. Unfortunately running following code on single then six cores seems to have no effect on performance. Main.hs module Main where import…
superstate
  • 173
  • 8
0
votes
1 answer

How I can extract a list from an image. Vector Problem

hello guys I am beginner in haskell and I am trying to get a vector from Bmp image and I am using this function bellow readMatrixfromImage :: FilePath -> IO [Double] readMatrixfromImage image = do x <- readImageFromBMPa image -- 'x' est…
0
votes
1 answer

extracting a vector from a Repa Array

hello everyone I have this function in haskell that let me extract a Repa array from bitmap grayScale readImageFromBMPa :: FilePath -> IO (Either Error (Array U DIM2 ( Word8))) {-# NOINLINE readImageFromBMPa #-} readImageFromBMPa…
Winssen
  • 53
  • 5
0
votes
1 answer

Is there usage of Haskell Repa slice function analogous to Vector and other languages?

I am trying to get a usable version of multidimensional arrays in Haskell, comparable to that of numpy arrays in Python and other languages. I found other questions about how to write custom functions for arrays of specific dimensions, but my…
0
votes
0 answers

REPA: Resizing an image

I am trying to, given an image, generate a new one with twice the original width and height. I am using the haskell's REPA library (https://hackage.haskell.org/package/repa-3.4.1.2/docs/Data-Array-Repa.html), and following this tutorial…
Hamburguesa66
  • 87
  • 1
  • 7
0
votes
0 answers

Couldn't match type `D' with `U' in Haskell repa arrays

I am trying to write some simple back substitution matrix code. For this I wrote a fold operator which folds with rows. Here is a non generic type signature of the function and its implemtation: foldMatrixByRow :: (Array D DIM1 Double -> Array D…
fahad aijaz
  • 1
  • 1
  • 1
0
votes
1 answer

Run-length encoding of a Repa array

I have a one-dimensional Repa array that consists of 0's and 1's and I want to calculate its run-length encoding. E.g.: Turn [0,0,1,1,1,0,0,0,1,0,1,1] into [2,3,3,1,1,2] or something similar. (I'm using a list representation because of…
Valerie94
  • 303
  • 2
  • 9
0
votes
1 answer

Not in scope error when trying to use Repa package

I'm relatively new to Haskell, and I'm trying to use Repa package in a project. I have imported the package in my source code using import qualified Data.Array.Repa as R, but when loading the Haskell file in ghci, I get the following…
0
votes
0 answers

Row or Column operations in Repa

In Repa (Haskell) is there any way to perform row operations directly? I want to do an fft of each row of a 2D array but this does not seem to be possible. As I do not want to write my own fft algorithm, it would be nice if I can apply fft (from…
jpv
  • 101
0
votes
1 answer

how to resolve use of operators in type declaration (Repa) ?

I am playing around with Repa, and the code below can compile and run. import qualified Data.Array.Repa as R --t:: R.Array R.U (R.Z R.:. Int) Float --t = R.fromListUnboxed (R.Z R.:. (10::Int)) ([1.0..10]::[Float]) main = do let x =…
stian
  • 1,947
  • 5
  • 25
  • 47
0
votes
1 answer

What is the fastest way to draw a rectangle in a REPA array?

Usually, a good method of drawing a rectangle in a bitmap is looping through the 2 bounding dimensions and setting individual pixels. For example, on pseudocode: drawRect(array, color, x, X, y, Y): for x from x til X: for y from y til…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
0
votes
1 answer

Haskell repa : inner product result of two array is wrong

import Data.Array.Repa import Data.Vector.Unboxed hiding(zipWith) import Prelude hiding(zipWith,replicate) dotp :: Array U DIM1 Float -> Array U DIM1 Float -> IO Float dotp x y = sumAllP $ zipWith (*) x y x = fromUnboxed (Z:.20000000) $ replicate…
iceiceice
  • 187
  • 1
  • 6
0
votes
1 answer

Scale matrix by a constant in Haskell Data.Array.Repa

Is there a compact way to scale a matrix by a constant in repa-3.2.3.3? Right now I'm using this: (.*) :: (Num d, Shape sh, Source r d) => Array r sh d -> d -> Array D sh d (.*) m c = R.map ((*) c) m I'm confused since such a function is typically…
tba
  • 6,229
  • 8
  • 43
  • 63
1 2 3 4 5 6
7