Jikka-5.0.11.1: A transpiler from Python to C++ for competitive programming

Jikka.Core.Language.ArithmeticalExpr

Synopsis

# Basic functions

#### Instances

Instances details
 Source # Instance detailsDefined in Jikka.Core.Language.ArithmeticalExpr Methods Source # Instance detailsDefined in Jikka.Core.Language.ArithmeticalExpr Methods Source # Instance detailsDefined in Jikka.Core.Language.ArithmeticalExpr MethodsshowList :: [ArithmeticalExpr] -> ShowS #

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}$$.

unNPlusKPattern recognizes a pattern of $$x + k$$ for a variable $$x$$ and an integer constant $$k \in \mathbb{Z}$$.
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}$$.
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 finds $$k$$ and $$e'$$ for given $$e$$ s.t. $$e = k e'$$.