#include #include #include "layout/product_layout.h" extern "C" { #include #include } #include namespace Poincare { Expression::Type Product::type() const { return Type::Product; } Expression * Product::clone() const { Product * a = new Product(m_operands, true); return a; } const char * Product::name() const { return "product"; } int Product::emptySequenceValue() const { return 1; } ExpressionLayout * Product::createSequenceLayoutWithArgumentLayouts(ExpressionLayout * subscriptLayout, ExpressionLayout * superscriptLayout, ExpressionLayout * argumentLayout) const { return new ProductLayout(subscriptLayout, superscriptLayout, argumentLayout); } template Expression * Product::templatedApproximateWithNextTerm(Expression * a, Expression * b) const { if (a->type() == Type::Complex && b->type() == Type::Complex) { Complex * c = static_cast *>(a); Complex * d = static_cast *>(b); return new Complex(Multiplication::compute(*c, *d)); } if (a->type() == Type::Complex) { Complex * c = static_cast *>(a); assert(b->type() == Type::Matrix); Matrix * m = static_cast(b); return Multiplication::computeOnComplexAndMatrix(c, m); } assert(a->type() == Type::Matrix); assert(b->type() == Type::Matrix); Matrix * m = static_cast(a); Matrix * n = static_cast(b); return Multiplication::computeOnMatrices(m, n); } }