mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 01:00:50 +01:00
[poincare] Fix Expression::IsMatrix
Change-Id: I7956ba5c293431f91020e2211245da8fafdd5e1b
This commit is contained in:
@@ -186,7 +186,7 @@ public:
|
||||
virtual Sign sign() const { return Sign::Unknown; }
|
||||
typedef bool (*ExpressionTest)(const Expression * e);
|
||||
bool recursivelyMatches(ExpressionTest test) const;
|
||||
static bool isMatrix(const Expression * e);
|
||||
static bool IsMatrix(const Expression * e);
|
||||
|
||||
/* Comparison */
|
||||
/* isIdenticalTo is the "easy" equality, it returns true if both trees have
|
||||
|
||||
@@ -22,7 +22,7 @@ Expression * Determinant::shallowReduce(Context& context, AngleUnit angleUnit) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
if (!op->recursivelyMatches(Expression::isMatrix)) {
|
||||
if (!op->recursivelyMatches(Expression::IsMatrix)) {
|
||||
return replaceWith(op, true);
|
||||
}
|
||||
return this;
|
||||
|
||||
@@ -88,8 +88,8 @@ bool Expression::recursivelyMatches(ExpressionTest test) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Expression::isMatrix(const Expression * e) {
|
||||
return e->type() == Type::Matrix || e->type() == Type::ConfidenceInterval || e->type() == Type::MatrixDimension || e->type() == Type::PredictionInterval;
|
||||
bool Expression::IsMatrix(const Expression * e) {
|
||||
return e->type() == Type::Matrix || e->type() == Type::ConfidenceInterval || e->type() == Type::MatrixDimension || e->type() == Type::PredictionInterval || e->type() == Type::MatrixInverse || e->type() == Type::MatrixTranspose;
|
||||
}
|
||||
|
||||
/* Comparison */
|
||||
|
||||
@@ -27,7 +27,7 @@ Expression * MatrixDimension::shallowReduce(Context& context, AngleUnit angleUni
|
||||
const Expression * newOperands[2] = {new Rational(m->numberOfRows()), new Rational(m->numberOfColumns())};
|
||||
return replaceWith(new Matrix(newOperands, 1, 2, false), true);
|
||||
}
|
||||
if (!op->recursivelyMatches(Expression::isMatrix)) {
|
||||
if (!op->recursivelyMatches(Expression::IsMatrix)) {
|
||||
const Expression * newOperands[2] = {new Rational(1), new Rational(1)};
|
||||
return replaceWith(new Matrix(newOperands, 1, 2, false), true);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ Expression * MatrixInverse::shallowReduce(Context& context, AngleUnit angleUnit)
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
if (!op->recursivelyMatches(Expression::isMatrix)) {
|
||||
if (!op->recursivelyMatches(Expression::IsMatrix)) {
|
||||
detachOperand(op);
|
||||
return replaceWith(new Power(op, new Rational(-1), false), true)->shallowReduce(context, angleUnit);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ Expression * MatrixTrace::shallowReduce(Context& context, AngleUnit angleUnit) {
|
||||
}
|
||||
return replaceWith(a, true)->shallowReduce(context, angleUnit);
|
||||
}
|
||||
if (!op->recursivelyMatches(Expression::isMatrix)) {
|
||||
if (!op->recursivelyMatches(Expression::IsMatrix)) {
|
||||
return replaceWith(op, true);
|
||||
}
|
||||
return this;
|
||||
|
||||
@@ -28,7 +28,7 @@ Expression * MatrixTranspose::shallowReduce(Context& context, AngleUnit angleUni
|
||||
Matrix * transpose = static_cast<Matrix *>(op)->createTranspose();
|
||||
return replaceWith(transpose, true);
|
||||
}
|
||||
if (!op->recursivelyMatches(Expression::isMatrix)) {
|
||||
if (!op->recursivelyMatches(Expression::IsMatrix)) {
|
||||
return replaceWith(op, true);
|
||||
}
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user