Numworks Epsilon  1.4.1
Graphing Calculator Operating System
simplification_engine.cpp
Go to the documentation of this file.
2 
3 #if MATRIX_EXACT_REDUCING
4 
5 namespace Poincare {
6 
7 Expression * SimplificationEngine::map(Expression * e, Context & context, Expression::AngleUnit angleUnit) {
8  assert(e->numberOfOperands() == 1 && e->operand(0)->type() == Expression::Type::Matrix);
9  Expression * op = e->editableOperand(0);
10  for (int i = 0; i < op->numberOfOperands(); i++) {
11  Expression * entry = op->editableOperand(i);
12  Expression * eCopy = e->clone();
13  eCopy->replaceOperand(eCopy->editableOperand(0), entry, true);
14  op->replaceOperand(entry, eCopy, false);
15  eCopy->shallowReduce(context, angleUnit);
16  }
17  return e->replaceWith(op, true)->shallowReduce(context, angleUnit);
18 }
19 
20 }
21 
22 #endif
#define assert(e)
Definition: assert.h:9