qlasskit
qlasskit copied to clipboard
Pow operator
Implement the ast.Pow operator (**) between a variable and an integer constant.
Since a ** n == a * a * ... * a, we implement this operator with a rewriting rule in ast2ast.
The rewriting rule should be placed in the class AstRewriter (https://github.com/dakk/qlasskit/blob/master/qlasskit/ast2ast.py#L137), overriding the method visit_Pow, and rewriting the pow as multiplications.
- Check that
nis an ast.Constant, positive integer - If overriding
visit_Powwon't work, overridevisit_BinOpinstead and check if the expression is aast.Pow
Please read CONTRIBUTING.md before contributing.