accelerate-io-vector- Convert between Accelerate and vector

Copyright[2012..2020] The Accelerate Team
MaintainerTrevor L. McDonell <>
Portabilitynon-portable (GHC extensions)
Safe HaskellNone



Efficient non-copying conversion between Storable vectors and Accelerate Arrays.



type Vectors e = GArrayDataR Vector e Source #

A family of types that represents a collection of storable Vectors. The structure of the collection depends on the element type e.

For example:

  • if e :: Int, then Vectors (EltR e) :: Vector Int
  • if e :: (Double, Float), then Vectors (EltR e) :: (((), Vector Double), Vector Float)

toVectors :: forall sh e. (Shape sh, Elt e) => Array sh e -> Vectors (EltR e) Source #

O(1). Turn the Accelerate array into a collection of storable Vectors. The element type of the array e will determine the structure of the output collection. See Vectors.

Data will be output in row-major order.

fromVectors :: forall sh e. (HasCallStack, Shape sh, Elt e) => sh -> Vectors (EltR e) -> Array sh e Source #

O(1). Treat a set of storable vectors as Accelerate arrays. The type of elements e in the output Accelerate array determines the structure of the collection that will be required as the second argument. See Vectors.

Data will be consumed from the vector in row-major order. You must make sure that each of the input vectors contains the right number of elements