Data.Packed.Vector
 Portability portable Stability provisional Maintainer Alberto Ruiz
Description
A representation of 1D arrays suitable for numeric computations using external libraries.
Synopsis
 data Vector t fromList :: Storable a => [a] -> Vector a (|>) :: Storable a => Int -> [a] -> Vector a toList :: Storable a => Vector a -> [a] dim :: Vector t -> Int (@>) :: Storable t => Vector t -> Int -> t subVector :: Storable t => Int -> Int -> Vector t -> Vector t join :: Storable t => [Vector t] -> Vector t constant :: Element a => a -> Int -> Vector a linspace :: Int -> (Double, Double) -> Vector Double vectorMax :: Vector Double -> Double vectorMin :: Vector Double -> Double vectorMaxIndex :: Vector Double -> Int vectorMinIndex :: Vector Double -> Int liftVector :: (Storable a, Storable b) => (a -> b) -> Vector a -> Vector b liftVector2 :: (Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c
Documentation
 data Vector t Source
A one-dimensional array of objects stored in a contiguous memory block. Instances
 Container Vector Double Linear Vector Double Joinable Vector Matrix Joinable Matrix Vector Mul Vector Matrix Vector Mul Matrix Vector Vector Container Vector (Complex Double) Linear Vector (Complex Double) (Eq a, Element a) => Eq (Vector a) Floating (Vector Double) Floating (Vector (Complex Double)) Linear Vector a => Fractional (Vector a) Linear Vector a => Num (Vector a) (Show a, Storable a) => Show (Vector a) Storable a => Monoid (Vector a) Normed (Vector Double) Normed (Vector (Complex Double))
 fromList :: Storable a => [a] -> Vector a Source

creates a Vector from a list:

```> fromList [2,3,5,7]
4 |> [2.0,3.0,5.0,7.0]```
 (|>) :: Storable a => Int -> [a] -> Vector a Source
an alternative to fromList with explicit dimension, used also in the instances for Show (Vector a).
 toList :: Storable a => Vector a -> [a] Source

extracts the Vector elements to a list

```> toList (linspace 5 (1,10))
[1.0,3.25,5.5,7.75,10.0]```
 dim :: Vector t -> Int Source
number of elements
 (@>) :: Storable t => Vector t -> Int -> t Source

```> fromList [0..9] @> 7
7.0```
 subVector Source
 :: Storable t => Int index of the starting element -> Int number of elements to extract -> Vector t source -> Vector t result takes a number of consecutive elements from a Vector ```> subVector 2 3 (fromList [1..10]) 3 |> [3.0,4.0,5.0]```
 join :: Storable t => [Vector t] -> Vector t Source

creates a new Vector by joining a list of Vectors

```> join [fromList [1..5], constant 1 3]
8 |> [1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0]```
 constant :: Element a => a -> Int -> Vector a Source

creates a vector with a given number of equal components:

```> constant 2 7
7 |> [2.0,2.0,2.0,2.0,2.0,2.0,2.0]```
 linspace :: Int -> (Double, Double) -> Vector Double Source

Creates a real vector containing a range of values:

```> linspace 5 (-3,7)
5 |> [-3.0,-0.5,2.0,4.5,7.0]```
 vectorMax :: Vector Double -> Double Source
 vectorMin :: Vector Double -> Double Source
 vectorMaxIndex :: Vector Double -> Int Source
 vectorMinIndex :: Vector Double -> Int Source
 liftVector :: (Storable a, Storable b) => (a -> b) -> Vector a -> Vector b Source
map on Vectors
 liftVector2 :: (Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c Source
zipWith for Vectors