Numworks Epsilon  1.4.1
Graphing Calculator Operating System
matrix.h
Go to the documentation of this file.
1 #ifndef POINCARE_MATRIX_H
2 #define POINCARE_MATRIX_H
3 
5 #include <poincare/matrix_data.h>
6 
7 namespace Poincare {
8 
9 class Matrix : public DynamicHierarchy {
10 public:
11  Matrix(MatrixData * matrixData); // pilfer the operands of matrixData
12  Matrix(const Expression * const * operands, int numberOfRows, int numberOfColumns, bool cloneOperands = true);
13  int numberOfRows() const;
14  int numberOfColumns() const;
15 
16  /* Expression */
17  Type type() const override;
18  Expression * clone() const override;
19  int writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const override;
20  int polynomialDegree(char symbolName) const override;
21 
22  /* Operation on matrix */
23  /* createDeterminant, createTrace and createInverse can only be called on an
24  * matrix of complex expressions. createDeterminant and createTrace return
25  * a complex expression and createInverse returns a matrix of complex
26  * expressions or nullptr if the inverse could not be computed. */
27  template<typename T> Complex<T> * createTrace() const;
28  template<typename T> Complex<T> * createDeterminant() const;
29  template<typename T> Matrix * createInverse() const;
30  Matrix * createTranspose() const;
31  static Matrix * createIdentity(int dim);
32  template<typename T> static Matrix * createApproximateIdentity(int dim);
33 private:
34  /* Layout */
35  ExpressionLayout * privateCreateLayout(PrintFloat::Mode floatDisplayMode, ComplexFormat complexFormat) const override;
36  /* Evaluation */
37  Expression * privateApproximate(SinglePrecision p, Context& context, AngleUnit angleUnit) const override { return templatedApproximate<float>(context, angleUnit); }
38  Expression * privateApproximate(DoublePrecision p, Context& context, AngleUnit angleUnit) const override { return templatedApproximate<double>(context, angleUnit); }
39  template<typename T> Expression * templatedApproximate(Context& context, AngleUnit angleUnit) const;
40  int m_numberOfRows;
41 };
42 
43 }
44 
45 #endif
int numberOfColumns() const
Definition: matrix.cpp:40
Matrix * createInverse() const
Definition: matrix.cpp:195
int polynomialDegree(char symbolName) const override
Definition: matrix.cpp:98
int writeTextInBuffer(char *buffer, int bufferSize, int numberOfSignificantDigits=PrintFloat::k_numberOfStoredSignificantDigits) const override
Definition: matrix.cpp:52
static Matrix * createIdentity(int dim)
Definition: matrix.cpp:285
Matrix * createTranspose() const
Definition: matrix.cpp:272
Matrix(MatrixData *matrixData)
Definition: matrix.cpp:18
Complex< T > * createDeterminant() const
Definition: matrix.cpp:131
Expression * clone() const override
Definition: matrix.cpp:48
const Expression *const * operands() const override
int numberOfRows() const
Definition: matrix.cpp:36
Type type() const override
Definition: matrix.cpp:44
Complex< T > * createTrace() const
Definition: matrix.cpp:115
static Matrix * createApproximateIdentity(int dim)
Definition: matrix.cpp:302