tcalculus-1.0.0: A DSL prototype for structured realtime/reactive functional programing

Copyright(c) David Janin, 2016
Licensesee the LICENSE file in the distribution
Maintainerjanin@labri.fr
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Duration.Affine

Description

An implementation of multi-variable linear polynoms. Associated partial order when variables are always assumed to have stricly positive values. This can also be seen as an algebra of (positive) delays with unknows.

Warning : the num and fractional instances are there for notational convinience. In order to stay within affine functions, the product fails over two non constant functions and teh inverse fails over a non constant function.

Synopsis

Documentation

data Affine d i Source #

Affine functions over a numeric space d and a set of variable index i.

Constructors

Affine !d ![(d, i)] 

Instances

(Num d, Ord d, Ord i) => Eq (Affine d i) Source #

Semantical equality

Methods

(==) :: Affine d i -> Affine d i -> Bool #

(/=) :: Affine d i -> Affine d i -> Bool #

(Fractional d, Eq d, Ord i) => Fractional (Affine d i) Source #

For syntactic confort (with partially defined inverse)

Methods

(/) :: Affine d i -> Affine d i -> Affine d i #

recip :: Affine d i -> Affine d i #

fromRational :: Rational -> Affine d i #

(Num d, Eq d, Ord i) => Num (Affine d i) Source #

For syntactic confort (with partially defined product)

Methods

(+) :: Affine d i -> Affine d i -> Affine d i #

(-) :: Affine d i -> Affine d i -> Affine d i #

(*) :: Affine d i -> Affine d i -> Affine d i #

negate :: Affine d i -> Affine d i #

abs :: Affine d i -> Affine d i #

signum :: Affine d i -> Affine d i #

fromInteger :: Integer -> Affine d i #

(Num d, Ord d, Ord i) => Ord (Affine d i) Source #

Total order with possible error

Methods

compare :: Affine d i -> Affine d i -> Ordering #

(<) :: Affine d i -> Affine d i -> Bool #

(<=) :: Affine d i -> Affine d i -> Bool #

(>) :: Affine d i -> Affine d i -> Bool #

(>=) :: Affine d i -> Affine d i -> Bool #

max :: Affine d i -> Affine d i -> Affine d i #

min :: Affine d i -> Affine d i -> Affine d i #

(Show d, Show i) => Show (Affine d i) Source # 

Methods

showsPrec :: Int -> Affine d i -> ShowS #

show :: Affine d i -> String #

showList :: [Affine d i] -> ShowS #

(Num d, Ord d, Ord i) => POrd (Affine d i) Source #

Semantical partial order (with positive variables)

Methods

partialCompare :: Affine d i -> Affine d i -> Maybe Ordering Source #

pLeq :: Affine d i -> Affine d i -> Bool Source #

pOrdEq :: Affine d i -> Affine d i -> Bool Source #

pOrdMin :: [Affine d i] -> Maybe (Affine d i) Source #

pOrdMax :: [Affine d i] -> Maybe (Affine d i) Source #

pOrdReduceMin :: [Affine d i] -> [Affine d i] Source #

pOrdReduceMax :: [Affine d i] -> [Affine d i] Source #

affineFromID :: Num d => i -> Affine d i Source #

Creates the one variable affine function (X_i) from index i.

affineFromConst :: d -> Affine d i Source #

Creates the constant affine function (d) from value d.

shiftAffine :: (Eq d, Num d, Ord i) => d -> Affine d i -> Affine d i Source #

Replaces any variable X by X + d

setToZeroAffine :: (Num d, Ord i) => [i] -> Affine d i -> Affine d i Source #

Sets variables Xi with i in the list to zero

evalAffine :: (Eq d, Num d, Ord i) => d -> Affine d i -> Affine d i Source #

Evals an affine function on a point (for debug)

getNextKnownDelay :: (Eq d, Num d) => Affine d i -> Maybe d Source #

Gets the greatest stricly positive constant lower than an affine returns Nothing if its 0 error if there is no such value