Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype LinComb x c = LinComb (Map x c)
- fromLinComb :: LinComb x c -> Map x c
- eval :: forall d x c v. Scalable d x => Additive x => (c -> d) -> (v -> x) -> LinComb v c -> x
- normalise :: DecidableZero c => LinComb x c -> LinComb x c
- toList :: LinComb k a -> [(k, a)]
- var :: Multiplicative c => x -> LinComb x c
- unsafeFromList :: Ord v => [(v, c)] -> LinComb v c
- fromList :: DecidableZero c => Additive c => Ord v => [(v, c)] -> LinComb v c
- subst :: DecidableZero c => AbelianAdditive c => Scalable c c => Ord v => (x -> LinComb v c) -> LinComb x c -> LinComb v c
- mapVars :: Ord x => (t -> x) -> LinComb t c -> LinComb x c
- mulVarsMonotonic :: Multiplicative x => x -> LinComb x c -> LinComb x c
- traverseVars :: Applicative f => Ord x => (v -> f x) -> LinComb v c -> f (LinComb x c)
- bitraverse :: Applicative f => Ord x => (v -> f x) -> (c -> f d) -> LinComb v c -> f (LinComb x d)
Documentation
Normalised linear combinations as maps from variables to coefficients (zero coefficient never present in the map)
Instances
fromLinComb :: LinComb x c -> Map x c Source #
eval :: forall d x c v. Scalable d x => Additive x => (c -> d) -> (v -> x) -> LinComb v c -> x Source #
var :: Multiplicative c => x -> LinComb x c Source #
unsafeFromList :: Ord v => [(v, c)] -> LinComb v c Source #
Convert from list without testing coefficients
subst :: DecidableZero c => AbelianAdditive c => Scalable c c => Ord v => (x -> LinComb v c) -> LinComb x c -> LinComb v c Source #
Substitution by evaluation
mapVars :: Ord x => (t -> x) -> LinComb t c -> LinComb x c Source #
transform variables. coefficients are not touched
mulVarsMonotonic :: Multiplicative x => x -> LinComb x c -> LinComb x c Source #
Multiplies elements, assuming multiplication is monotonous.
traverseVars :: Applicative f => Ord x => (v -> f x) -> LinComb v c -> f (LinComb x c) Source #
transform variables with effect. coefficients are not touched
bitraverse :: Applicative f => Ord x => (v -> f x) -> (c -> f d) -> LinComb v c -> f (LinComb x d) Source #
transform variables and coefficients with effect.