Safe Haskell | None |
---|---|
Language | Haskell2010 |
Representation, constructors and limited arithmetic on linear functions.
The linear function is indexed by its result type: either purely integer (KZ
) or mixed/real (KR
).
This index is used to allow strictly-less-than constraints only on integer functions,
and to allow retrieving integer values from purely integer functions.
Synopsis
- data Linear z r c k where
- toR :: Rep c => Linear z r c k -> Linear z r c KR
- z :: Rep c => z -> Z c -> Linear z r c KZ
- z1 :: Rep c => z -> Linear z r c KZ
- r :: Rep c => r -> R c -> Linear z r c KR
- r1 :: Rep c => r -> Linear z r c KR
- con :: Rep c => Z c -> Linear z r c KZ
- conZ :: Rep c => Z c -> Linear z r c KZ
- conR :: Rep c => R c -> Linear z r c KR
- c0 :: Rep c => Linear z r c KZ
- c1 :: Rep c => Linear z r c KZ
- neg :: Rep c => Linear z r c k -> Linear z r c k
- (.*) :: Rep c => Linear z r c k -> KRep k c -> Linear z r c k
- (*.) :: Rep c => KRep k c -> Linear z r c k -> Linear z r c k
- (.+.) :: Rep c => Linear z r c k1 -> Linear z r c k2 -> Linear z r c (KMerge k1 k2)
- (.-.) :: Rep c => Linear z r c k1 -> Linear z r c k2 -> Linear z r c (KMerge k1 k2)
Documentation
data Linear z r c k where Source #
Representation of either integral of real linear functions: a list of variables with coefficients, plus a constant summand.
toR :: Rep c => Linear z r c k -> Linear z r c KR Source #
Any linear function can be converted into a real linear function.
neg :: Rep c => Linear z r c k -> Linear z r c k Source #
Negate a linear function. Negation does not change the kind.
(.*) :: Rep c => Linear z r c k -> KRep k c -> Linear z r c k infix 7 Source #
Multiply a linear function by some constant.
Note that you cannot multiply a linear function by another linear function, as the result would likely be non-linear!
(*.) :: Rep c => KRep k c -> Linear z r c k -> Linear z r c k infix 7 Source #
Multiply a linear function by some constant.