Data.Vector.Dense
 Stability experimental Maintainer Patrick Perry
 Contents The Vector type Vector shape Conjugating vectors Creating new vectors Reading vector elements Special vectors Vector views Vector properties Low-level vector properties Converting between mutable and immutable vectors
Description
Synopsis
 coerceVector :: BaseVector x => x n e -> x n' e module BLAS.Tensor.Base module BLAS.Conj vector :: BLAS1 e => Int -> [(Int, e)] -> Vector n e listVector :: BLAS1 e => Int -> [e] -> Vector n e unsafeVector :: BLAS1 e => Int -> [(Int, e)] -> Vector n e module BLAS.Tensor.Immutable zeroVector :: BLAS1 e => Int -> Vector n e constantVector :: BLAS1 e => Int -> e -> Vector n e basisVector :: BLAS1 e => Int -> Int -> Vector n e subvector :: (BaseVector x, Storable e) => x n e -> Int -> Int -> x n' e subvectorWithStride :: (BaseVector x, Storable e) => Int -> x n e -> Int -> Int -> x n' e sumAbs :: BLAS1 e => Vector n e -> Double norm2 :: BLAS1 e => Vector n e -> Double whichMaxAbs :: BLAS1 e => Vector n e -> (Int, e) (<.>) :: BLAS1 e => Vector n e -> Vector n e -> e
The Vector type
Vector shape
 coerceVector :: BaseVector x => x n e -> x n' e Source
Cast the shape type of the vector.
module BLAS.Tensor.Base
Conjugating vectors
module BLAS.Conj
Creating new vectors
 vector :: BLAS1 e => Int -> [(Int, e)] -> Vector n e Source
Create a vector with the given dimension and elements. The elements given in the association list must all have unique indices, otherwise the result is undefined.
 listVector :: BLAS1 e => Int -> [e] -> Vector n e Source
Create a vector of the given dimension with elements initialized to the values from the list. listVector n es is equivalent to vector n (zip [0..(n-1)] es), except that the result is undefined if length es is less than n.
 unsafeVector :: BLAS1 e => Int -> [(Int, e)] -> Vector n e Source
Same as vector, but does not range-check the indices.
module BLAS.Tensor.Immutable
Special vectors
 zeroVector :: BLAS1 e => Int -> Vector n e Source
zeroVector n creates a vector of dimension n with all values set to zero.
 constantVector :: BLAS1 e => Int -> e -> Vector n e Source
constantVector n e creates a vector of dimension n with all values set to e.
 basisVector :: BLAS1 e => Int -> Int -> Vector n e Source
basisVector n i creates a vector of dimension n with zeros everywhere but position i, where there is a one.
Vector views
 subvector :: (BaseVector x, Storable e) => x n e -> Int -> Int -> x n' e Source
subvector x o n creates a subvector view of x starting at index o and having length n.
 subvectorWithStride :: (BaseVector x, Storable e) => Int -> x n e -> Int -> Int -> x n' e Source
subvectorWithStride s x o n creates a subvector view of x starting at index o, having length n and stride s.
Vector properties
 sumAbs :: BLAS1 e => Vector n e -> Double Source
Compute the sum of absolute values of entries in the vector.
 norm2 :: BLAS1 e => Vector n e -> Double Source
Compute the 2-norm of a vector.
 whichMaxAbs :: BLAS1 e => Vector n e -> (Int, e) Source
Get the index and norm of the element with absulte value. Not valid if any of the vector entries are NaN. Raises an exception if the vector has length 0.
 (<.>) :: BLAS1 e => Vector n e -> Vector n e -> e Source
Compute the dot product of two vectors.
Low-level vector properties
Converting between mutable and immutable vectors