|
Data.Vector.Dense.Class | Stability | experimental | Maintainer | Patrick Perry <patperry@stanford.edu> |
|
|
|
|
|
Description |
|
|
Synopsis |
|
class BaseTensor x Int => BaseVector x where | | | class (BaseVector x, UnsafeIOToM m, ReadTensor x Int m) => ReadVector x m | | class (ReadVector x m, WriteTensor x Int m) => WriteVector x m | x -> m, m -> x | | dim :: BaseVector x => x n e -> Int | | coerceVector :: BaseVector x => x n e -> x n' e | | module BLAS.Tensor.Base | | module BLAS.Conj | | newVector_ :: (WriteVector x m, Elem e) => Int -> m (x n e) | | newVector :: (WriteVector x m, Elem e) => Int -> [(Int, e)] -> m (x n e) | | newListVector :: (WriteVector x m, Elem e) => Int -> [e] -> m (x n e) | | unsafeNewVector :: (WriteVector x m, Elem e) => Int -> [(Int, e)] -> m (x n e) | | module BLAS.Tensor.Read | | module BLAS.Tensor.Write | | newZeroVector :: (WriteVector y m, Elem e) => Int -> m (y n e) | | newConstantVector :: (WriteVector y m, Elem e) => Int -> e -> m (y n e) | | newBasisVector :: (WriteVector x m, Elem e) => Int -> Int -> m (x n e) | | setZeroVector :: (WriteVector y m, Elem e) => y n e -> m () | | setConstantVector :: (WriteVector y m, Elem e) => e -> y n e -> m () | | setBasisVector :: (WriteVector x m, Elem e) => Int -> x n e -> m () | | 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 | | unsafeSubvector :: (BaseVector x, Storable e) => x n e -> Int -> Int -> x n' e | | unsafeSubvectorWithStride :: (BaseVector x, Storable e) => Int -> x n e -> Int -> Int -> x n' e | | newCopyVector :: (BLAS1 e, ReadVector x m, WriteVector y m) => x n e -> m (y n e) | | copyVector :: (BLAS1 e, WriteVector y m, ReadVector x m) => y n e -> x n e -> m () | | swapVector :: (BLAS1 e, WriteVector y m) => y n e -> y n e -> m () | | unsafeCopyVector :: (BLAS1 e, WriteVector y m, ReadVector x m) => y n e -> x n e -> m () | | unsafeSwapVector :: (BLAS1 e, WriteVector y m) => y n e -> y n e -> m () | | getSumAbs :: (ReadVector x m, BLAS1 e) => x n e -> m Double | | getNorm2 :: (ReadVector x m, BLAS1 e) => x n e -> m Double | | getWhichMaxAbs :: (ReadVector x m, BLAS1 e) => x n e -> m (Int, e) | | getDot :: (ReadVector x m, ReadVector y m, BLAS1 e) => x n e -> y n e -> m e | | unsafeGetDot :: (ReadVector x m, ReadVector y m, BLAS1 e) => x n e -> y n e -> m e | | getConjVector :: (ReadVector x m, WriteVector y m, BLAS1 e) => x n e -> m (y n e) | | getScaledVector :: (ReadVector x m, WriteVector y m, BLAS1 e) => e -> x n e -> m (y n e) | | getShiftedVector :: (ReadVector x m, WriteVector y m, BLAS1 e) => e -> x n e -> m (y n e) | | getAddVector :: (ReadVector x m, ReadVector y m, WriteVector z m, BLAS1 e) => x n e -> y n e -> m (z n e) | | getSubVector :: (ReadVector x m, ReadVector y m, WriteVector z m, BLAS1 e) => x n e -> y n e -> m (z n e) | | getMulVector :: (ReadVector x m, ReadVector y m, WriteVector z m, BLAS1 e) => x n e -> y n e -> m (z n e) | | getDivVector :: (ReadVector x m, ReadVector y m, WriteVector z m, BLAS1 e) => x n e -> y n e -> m (z n e) | | addVector :: (WriteVector y m, ReadVector x m, BLAS1 e) => y n e -> x n e -> m () | | subVector :: (WriteVector y m, ReadVector x m, BLAS1 e) => y n e -> x n e -> m () | | axpyVector :: (ReadVector x m, WriteVector y m, BLAS1 e) => e -> x n e -> y n e -> m () | | mulVector :: (WriteVector y m, ReadVector x m, BLAS1 e) => y n e -> x n e -> m () | | divVector :: (WriteVector y m, ReadVector x m, BLAS1 e) => y n e -> x n e -> m () | | unsafeGetAddVector :: (ReadVector x m, ReadVector y m, WriteVector z m, BLAS1 e) => x n e -> y n e -> m (z n e) | | unsafeGetSubVector :: (ReadVector x m, ReadVector y m, WriteVector z m, BLAS1 e) => x n e -> y n e -> m (z n e) | | unsafeGetMulVector :: (ReadVector x m, ReadVector y m, WriteVector z m, BLAS1 e) => x n e -> y n e -> m (z n e) | | unsafeGetDivVector :: (ReadVector x m, ReadVector y m, WriteVector z m, BLAS1 e) => x n e -> y n e -> m (z n e) | | unsafeAddVector :: (WriteVector y m, ReadVector x m, BLAS1 e) => y n e -> x n e -> m () | | unsafeSubVector :: (WriteVector y m, ReadVector x m, BLAS1 e) => y n e -> x n e -> m () | | unsafeAxpyVector :: (ReadVector x m, WriteVector y m, BLAS1 e) => e -> x n e -> y n e -> m () | | unsafeMulVector :: (WriteVector y m, ReadVector x m, BLAS1 e) => y n e -> x n e -> m () | | unsafeDivVector :: (WriteVector y m, ReadVector x m, BLAS1 e) => y n e -> x n e -> m () | | stride :: BaseVector x => x n e -> Int | | isConj :: BaseVector x => x n e -> Bool | | withVectorPtr :: BaseVector x => x n e -> (Ptr e -> IO a) -> IO a |
|
|
|
The dense vector type classes
|
|
|
| Methods | | | Instances | |
|
|
|
| Instances | |
|
|
|
| Instances | |
|
|
Vector shape
|
|
|
|
|
Cast the shape type of the vector.
|
|
module BLAS.Tensor.Base |
|
Conjugating vectors
|
|
module BLAS.Conj |
|
Creating new vectors
|
|
|
Creates a new vector of the given length. The elements will be
uninitialized.
|
|
|
Creates a new vector with the given association list. Unspecified
indices will get initialized to zero.
|
|
|
Creates a new vector of the given dimension with the given elements.
If the list has length less than the passed-in dimenson, the tail of
the vector will be uninitialized.
|
|
|
Same as newVector but indices are not range-checked.
|
|
Reading and writing vector elements
|
|
module BLAS.Tensor.Read |
|
module BLAS.Tensor.Write |
|
Special vectors
|
|
|
Create a zero vector of the specified length.
|
|
|
Create a constant vector of the specified length.
|
|
|
newBasisVector n i creates a vector of length n that is all zero
except for at position i, where it equal to one.
|
|
|
Set every element in the vector to zero.
|
|
|
Set every element in the vector to a constant.
|
|
|
setBasis x i sets the ith coordinate of x to 1, and all other
coordinates to 0. If the vector has been scaled, it is possible that
readVector x i will not return exactly 1. See setElem.
|
|
Vector views
|
|
|
subvector x o n creates a subvector view of x starting at index o
and having length n.
|
|
|
subvectorWithStride s x o n creates a subvector view of x starting
at index o, having length n and stride s.
|
|
|
|
|
|
Copying vectors
|
|
|
Creats a new vector by copying another one.
|
|
|
copyVector dst src replaces the values in dst with those in
source. The operands must be the same shape.
|
|
|
Swap the values stored in two vectors.
|
|
|
Same as copyVector but the sizes of the arguments are not checked.
|
|
|
Same as swapVector but the sizes of the arguments are not checked.
|
|
Vector Properties
|
|
|
Gets the sum of the absolute values of the vector entries.
|
|
|
Gets the 2-norm of a vector.
|
|
|
Gets the index and norm of the element with maximum magnitude. This is
undefined if any of the elements are NaN. It will throw an exception if
the dimension of the vector is 0.
|
|
|
Computes the dot product of two vectors.
|
|
|
|
Vector operations
|
|
Unary
|
|
|
Get a new vector with elements with the conjugates of the elements
of the given vector
|
|
|
Get a new vector by scaling the elements of another vector
by a given value.
|
|
|
Get a new vector by shifting the elements of another vector
by a given value.
|
|
Binary
|
|
|
getAddVector x y creates a new vector equal to the sum x+y. The
operands must have the same dimension.
|
|
|
getSubVector x y creates a new tensor equal to the difference x-y.
The operands must have the same dimension.
|
|
|
getMulVector x y creates a new vector equal to the elementwise product
x*y. The operands must have the same dimensino
|
|
|
getDivVector x y creates a new vector equal to the elementwise
ratio x/y. The operands must have the same shape.
|
|
|
addVector y x replaces y with y+x.
|
|
|
subVector y x replaces y with y-x.
|
|
|
axpyVector alpha x y replaces y with alpha * x + y.
|
|
|
mulVector y x replaces y with y*x.
|
|
|
divVector y x replaces y with y/x.
|
|
Unsafe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Low-level functions
|
|
|
|
|
|
|
|
Produced by Haddock version 2.3.0 |