Safe Haskell | None |
---|
- type Vector = Array
- type family RealOf x
- type ComplexOf x = Complex (RealOf x)
- toList :: (C sh, Storable a) => Vector sh a -> [a]
- fromList :: (C sh, Storable a) => sh -> [a] -> Vector sh a
- autoFromList :: Storable a => [a] -> Vector (ZeroBased Int) a
- append :: (C shx, C shy, Storable a) => Array shx a -> Array shy a -> Array (:+: shx shy) a
- (+++) :: (C shx, C shy, Storable a) => Vector shx a -> Vector shy a -> Vector (shx :+: shy) a
- take :: (Integral n, Storable a) => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a
- drop :: (Integral n, Storable a) => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a
- takeLeft :: (C sh0, C sh1, Storable a) => Array (:+: sh0 sh1) a -> Array sh0 a
- takeRight :: (C sh0, C sh1, Storable a) => Array (:+: sh0 sh1) a -> Array sh1 a
- swap :: (Indexed sh, Storable a) => Index sh -> Index sh -> Vector sh a -> Vector sh a
- singleton :: Storable a => a -> Array () a
- constant :: (C sh, Floating a) => sh -> a -> Vector sh a
- zero :: (C sh, Floating a) => sh -> Vector sh a
- one :: (C sh, Floating a) => sh -> Vector sh a
- unit :: (Indexed sh, Floating a) => sh -> Index sh -> Vector sh a
- dot :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> a
- inner :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> a
- (-*|) :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> a
- sum :: (C sh, Floating a) => Vector sh a -> a
- absSum :: (C sh, Floating a) => Vector sh a -> RealOf a
- norm1 :: (C sh, Floating a) => Vector sh a -> RealOf a
- norm2 :: (C sh, Floating a) => Vector sh a -> RealOf a
- norm2Squared :: (C sh, Floating a) => Vector sh a -> RealOf a
- normInf :: (C sh, Floating a) => Vector sh a -> RealOf a
- normInf1 :: (C sh, Floating a) => Vector sh a -> RealOf a
- argAbsMaximum :: (InvIndexed sh, Floating a) => Vector sh a -> (Index sh, a)
- argAbs1Maximum :: (InvIndexed sh, Floating a) => Vector sh a -> (Index sh, a)
- product :: (C sh, Floating a) => Vector sh a -> a
- scale :: (C sh, Floating a) => a -> Vector sh a -> Vector sh a
- scaleReal :: (C sh, Floating a) => RealOf a -> Vector sh a -> Vector sh a
- (.*|) :: (C sh, Floating a) => a -> Vector sh a -> Vector sh a
- add :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a
- sub :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a
- (|+|) :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a
- (|-|) :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a
- negate :: (C sh, Floating a) => Vector sh a -> Vector sh a
- raise :: (C sh, Floating a) => a -> Array sh a -> Array sh a
- mac :: (C sh, Eq sh, Floating a) => a -> Vector sh a -> Vector sh a -> Vector sh a
- mul :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a
- divide :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> Vector sh a
- recip :: (C sh, Floating a) => Vector sh a -> Vector sh a
- minimum :: (C sh, Real a) => Vector sh a -> a
- argMinimum :: (InvIndexed sh, Index sh ~ ix, Real a) => Vector sh a -> (ix, a)
- maximum :: (C sh, Real a) => Vector sh a -> a
- argMaximum :: (InvIndexed sh, Index sh ~ ix, Real a) => Vector sh a -> (ix, a)
- limits :: (C sh, Real a) => Vector sh a -> (a, a)
- argLimits :: (InvIndexed sh, Index sh ~ ix, Real a) => Vector sh a -> ((ix, a), (ix, a))
- foldl :: (C sh, Storable a) => (b -> a -> b) -> b -> Array sh a -> b
- foldl1 :: (C sh, Storable a) => (a -> a -> a) -> Array sh a -> a
- foldMap :: (C sh, Storable a, Ord a, Semigroup m) => (a -> m) -> Array sh a -> m
- conjugate :: (C sh, Floating a) => Vector sh a -> Vector sh a
- fromReal :: (C sh, Floating a) => Vector sh (RealOf a) -> Vector sh a
- toComplex :: (C sh, Floating a) => Vector sh a -> Vector sh (ComplexOf a)
- realPart :: (C sh, Floating a) => Vector sh a -> Vector sh (RealOf a)
- imaginaryPart :: (C sh, Real a) => Vector sh (Complex a) -> Vector sh a
- zipComplex :: (C sh, Eq sh, Real a) => Vector sh a -> Vector sh a -> Vector sh (Complex a)
- unzipComplex :: (C sh, Real a) => Vector sh (Complex a) -> (Vector sh a, Vector sh a)
- random :: (C sh, Floating a) => RandomDistribution -> sh -> Word64 -> Vector sh a
- data RandomDistribution
- = UniformBox01
- | UniformBoxPM1
- | Normal
- | UniformDisc
- | UniformCircle
Documentation
(+++) :: (C shx, C shy, Storable a) => Vector shx a -> Vector shy a -> Vector (shx :+: shy) aSource
Precedence and associativity (right) of (List.++). This also matches '(Shape.:+:)'.
constant :: (C sh, Floating a) => sh -> a -> Vector sh aSource
constant () = singleton
However, singleton does not need Floating
constraint.
dot :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> aSource
dot x y = Matrix.toScalar (singleRow x <#> singleColumn y)
inner :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> aSource
inner x y = dot (conjugate x) y
(-*|) :: (C sh, Eq sh, Floating a) => Vector sh a -> Vector sh a -> aSource
dot x y = Matrix.toScalar (singleRow x <#> singleColumn y)
absSum :: (C sh, Floating a) => Vector sh a -> RealOf aSource
Sum of the absolute values of real numbers or components of complex numbers.
For real numbers it is equivalent to norm1
.
norm2 :: (C sh, Floating a) => Vector sh a -> RealOf aSource
Euclidean norm of a vector or Frobenius norm of a matrix.
normInf1 :: (C sh, Floating a) => Vector sh a -> RealOf aSource
Computes (almost) the infinity norm of the vector. For complex numbers every element is replaced by the sum of the absolute component values first.
argAbsMaximum :: (InvIndexed sh, Floating a) => Vector sh a -> (Index sh, a)Source
Returns the index and value of the element with the maximal absolute value. Caution: It actually returns the value of the element, not its absolute value!
argAbs1Maximum :: (InvIndexed sh, Floating a) => Vector sh a -> (Index sh, a)Source
Returns the index and value of the element with the maximal absolute value. The function does not strictly compare the absolute value of a complex number but the sum of the absolute complex components. Caution: It actually returns the value of the element, not its absolute value!
argMinimum :: (InvIndexed sh, Index sh ~ ix, Real a) => Vector sh a -> (ix, a)Source
For restrictions see limits
.
argMaximum :: (InvIndexed sh, Index sh ~ ix, Real a) => Vector sh a -> (ix, a)Source
For restrictions see limits
.
limits :: (C sh, Real a) => Vector sh a -> (a, a)Source
It should hold limits x = Array.limits x
.
The function is based on fast BLAS functions.
It should be faster than Array.minimum
and Array.maximum
although it is certainly not as fast as possible.
It is less precise if minimum and maximum differ considerably in magnitude
and there are several minimum or maximum candidates of similar value.
E.g. you cannot rely on the property
that raise (- minimum x) x
has only non-negative elements.