16 m_expressions[i] =
nullptr;
19 m_matrixExpressions[i] =
nullptr;
20 m_matrixLayout[i] =
nullptr;
26 if (m_expressions[i] !=
nullptr) {
27 delete m_expressions[i];
29 m_expressions[i] =
nullptr;
32 if (m_matrixExpressions[i] !=
nullptr) {
33 delete m_matrixExpressions[i];
35 m_matrixExpressions[i] =
nullptr;
36 if (m_matrixLayout[i] !=
nullptr) {
37 delete m_matrixLayout[i];
39 m_matrixLayout[i] =
nullptr;
45 return &defaultExpression;
48 int GlobalContext::symbolIndex(
const Symbol * symbol)
const {
49 if (symbol->isMatrixSymbol()) {
50 return symbol->name() - (char)Symbol::SpecialSymbols::M0;
52 if (symbol->isScalarSymbol()) {
53 return symbol->name() -
'A';
68 int index = symbolIndex(symbol);
70 return m_matrixExpressions[index];
75 if (m_expressions[index] ==
nullptr) {
76 return defaultExpression();
78 return m_expressions[index];
83 int index = symbolIndex(symbol);
84 if (m_matrixLayout[index] ==
nullptr && m_matrixExpressions[index] !=
nullptr) {
85 m_matrixLayout[index] = m_matrixExpressions[index]->
createLayout();
87 return m_matrixLayout[index];
93 int index = symbolIndex(symbol);
95 int indexMatrix = symbol->
name() - (char)Symbol::SpecialSymbols::M0;
98 if (m_matrixExpressions[indexMatrix] !=
nullptr) {
99 delete m_matrixExpressions[indexMatrix];
100 m_matrixExpressions[indexMatrix] =
nullptr;
102 if (m_matrixLayout[indexMatrix] !=
nullptr) {
103 delete m_matrixLayout[indexMatrix];
104 m_matrixLayout[indexMatrix] =
nullptr;
106 if (evaluation !=
nullptr) {
108 m_matrixExpressions[indexMatrix] =
new Matrix(&evaluation, 1, 1,
false);
110 m_matrixExpressions[indexMatrix] =
static_cast<Matrix *
>(evaluation);
119 if (m_expressions[index] !=
nullptr) {
120 delete m_expressions[index];
121 m_expressions[index] =
nullptr;
123 if (evaluation ==
nullptr) {
ExpressionLayout * expressionLayoutForSymbol(const Symbol *symbol)
const Expression * expressionForSymbol(const Symbol *symbol) override
static constexpr uint16_t k_maxNumberOfMatrixExpressions
Expression * approximate(Context &context, AngleUnit angleUnit=AngleUnit::Default) const
void setExpressionForSymbolName(const Expression *expression, const Symbol *symbol, Context &context) override
constexpr Expression::ComplexFormat Cartesian
static constexpr uint16_t k_maxNumberOfScalarExpressions
ExpressionLayout * createLayout(PrintFloat::Mode floatDisplayMode=PrintFloat::Mode::Default, ComplexFormat complexFormat=ComplexFormat::Default) const
static Complex< T > Float(T x)
bool isMatrixSymbol() const
virtual Type type() const =0