Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ArithmeticalExpr
- parseArithmeticalExpr :: Expr -> ArithmeticalExpr
- formatArithmeticalExpr :: ArithmeticalExpr -> Expr
- integerArithmeticalExpr :: Integer -> ArithmeticalExpr
- negateArithmeticalExpr :: ArithmeticalExpr -> ArithmeticalExpr
- plusArithmeticalExpr :: ArithmeticalExpr -> ArithmeticalExpr -> ArithmeticalExpr
- minusArithmeticalExpr :: ArithmeticalExpr -> ArithmeticalExpr -> ArithmeticalExpr
- multArithmeticalExpr :: ArithmeticalExpr -> ArithmeticalExpr -> ArithmeticalExpr
- isZeroArithmeticalExpr :: ArithmeticalExpr -> Bool
- isOneArithmeticalExpr :: ArithmeticalExpr -> Bool
- unNPlusKPattern :: ArithmeticalExpr -> Maybe (VarName, Integer)
- makeVectorFromArithmeticalExpr :: Vector VarName -> ArithmeticalExpr -> Maybe (Vector ArithmeticalExpr, ArithmeticalExpr)
- makeAffineFunctionFromArithmeticalExpr :: VarName -> ArithmeticalExpr -> Maybe (ArithmeticalExpr, ArithmeticalExpr)
- splitConstantFactorArithmeticalExpr :: ArithmeticalExpr -> (Integer, ArithmeticalExpr)
Basic functions
data ArithmeticalExpr Source #
Instances
Eq ArithmeticalExpr Source # | |
Defined in Jikka.Core.Language.ArithmeticalExpr (==) :: ArithmeticalExpr -> ArithmeticalExpr -> Bool # (/=) :: ArithmeticalExpr -> ArithmeticalExpr -> Bool # | |
Ord ArithmeticalExpr Source # | |
Defined in Jikka.Core.Language.ArithmeticalExpr compare :: ArithmeticalExpr -> ArithmeticalExpr -> Ordering # (<) :: ArithmeticalExpr -> ArithmeticalExpr -> Bool # (<=) :: ArithmeticalExpr -> ArithmeticalExpr -> Bool # (>) :: ArithmeticalExpr -> ArithmeticalExpr -> Bool # (>=) :: ArithmeticalExpr -> ArithmeticalExpr -> Bool # max :: ArithmeticalExpr -> ArithmeticalExpr -> ArithmeticalExpr # min :: ArithmeticalExpr -> ArithmeticalExpr -> ArithmeticalExpr # | |
Show ArithmeticalExpr Source # | |
Defined in Jikka.Core.Language.ArithmeticalExpr showsPrec :: Int -> ArithmeticalExpr -> ShowS # show :: ArithmeticalExpr -> String # showList :: [ArithmeticalExpr] -> ShowS # |
parseArithmeticalExpr :: Expr -> ArithmeticalExpr Source #
parseArithmeticalExpr
converts a given expr to a normal form \(\sum_i \prod_j e _ {i,j})\).
This assumes given exprs have the type \(\mathbf{int}\).
Advanced functions
unNPlusKPattern :: ArithmeticalExpr -> Maybe (VarName, Integer) Source #
unNPlusKPattern
recognizes a pattern of \(x + k\) for a variable \(x\) and an integer constant \(k \in \mathbb{Z}\).
makeVectorFromArithmeticalExpr :: Vector VarName -> ArithmeticalExpr -> Maybe (Vector ArithmeticalExpr, ArithmeticalExpr) Source #
makeVectorFromArithmeticalExpr
makes a vector \(f\) and a expr \(c\) from a given vector of variables \(x_0, x_1, \dots, x _ {n - 1}\) and a given expr \(e\) s.t. \(f\) and \(c\) don't have \(x_0, x_1, \dots, x _ {n - 1}\) as free variables and \(e = c + f \cdot (x_0, x_1, \dots, x _ {n - 1})\) holds.
This assumes given variables and exprs have the type \(\mathbf{int}\).
- The returned exprs are normalized with
normalizeArithmeticalExpr
.
makeAffineFunctionFromArithmeticalExpr :: VarName -> ArithmeticalExpr -> Maybe (ArithmeticalExpr, ArithmeticalExpr) Source #
makeAffineFunctionFromArithmeticalExpr
is a specialized version of makeVectorFromArithmeticalExpr
.
This function returns \(a, b\) for a given variable \(x\) and a given expr \(e = a x + b\) where \(a, b\) which doesn't use \(x\) free.
splitConstantFactorArithmeticalExpr :: ArithmeticalExpr -> (Integer, ArithmeticalExpr) Source #
splitConstantFactorArithmeticalExpr
finds \(k\) and \(e'\) for given \(e\) s.t. \(e = k e'\).