Search in sources :

Example 1 with FlatOrderlessStepVisitor

use of org.matheclipse.core.patternmatching.FlatOrderlessStepVisitor in project symja_android_library by axkr.

the class CombinatoricTestCase method testRosenIterator.

public void testRosenIterator() {
    IAST lhsPatternAST = F.Plus(F.x_, F.y_, F.z_);
    IAST lhsEvalAST = F.Plus(F.a, F.b, F.c, F.d);
    PatternMatcher patternMatcher = new PatternMatcher(lhsPatternAST);
    IPatternMap patternMap = patternMatcher.createPatternMap();
    // StackMatcher stackMatcher = patternMatcher.new StackMatcher(EvalEngine.get());
    FlatOrderlessStepVisitor visitor = new FlatOrderlessStepVisitor(F.Plus, lhsPatternAST, lhsEvalAST, patternMatcher, patternMap);
    MultisetPartitionsIterator iter = new MultisetPartitionsIterator(visitor, lhsPatternAST.argSize());
    boolean b = false;
    while (!b) {
        b = iter.execute();
        if (!b) {
            System.out.println(iter.toString());
            iter.initPatternMap();
        }
    }
    assertEquals(true, b);
}
Also used : IPatternMap(org.matheclipse.core.patternmatching.IPatternMap) FlatOrderlessStepVisitor(org.matheclipse.core.patternmatching.FlatOrderlessStepVisitor) MultisetPartitionsIterator(org.matheclipse.core.combinatoric.MultisetPartitionsIterator) IAST(org.matheclipse.core.interfaces.IAST) PatternMatcher(org.matheclipse.core.patternmatching.PatternMatcher)

Aggregations

MultisetPartitionsIterator (org.matheclipse.core.combinatoric.MultisetPartitionsIterator)1 IAST (org.matheclipse.core.interfaces.IAST)1 FlatOrderlessStepVisitor (org.matheclipse.core.patternmatching.FlatOrderlessStepVisitor)1 IPatternMap (org.matheclipse.core.patternmatching.IPatternMap)1 PatternMatcher (org.matheclipse.core.patternmatching.PatternMatcher)1