[poincare] uninline methods in Evaluation and subclasses

This commit is contained in:
Léa Saviot
2018-09-07 16:27:22 +02:00
parent 9c6e65997f
commit b4ea4d9dab
6 changed files with 27 additions and 9 deletions

View File

@@ -41,7 +41,7 @@ template<typename T>
class Complex : public Evaluation<T> {
public:
Complex(ComplexNode<T> * n) : Evaluation<T>(n) {}
Complex(T a, T b = 0.0) : Complex(std::complex<T>(a, b)) {}
Complex(T a, T b = 0.0);
Complex(std::complex<T> c);
static Complex<T> Undefined() {
return Complex<T>(NAN, NAN);

View File

@@ -49,9 +49,7 @@ public:
}
/* Hierarchy */
Evaluation<T> childAtIndex(int i) const {
return Evaluation<T>(static_cast<EvaluationNode<T> *>(TreeByReference::childAtIndex(i).node()));
}
Evaluation<T> childAtIndex(int i) const;
typename Poincare::EvaluationNode<T>::Type type() const { return node()->type(); }
bool isUndefined() const { return node()->isUndefined(); }
T toScalar() const { return node()->toScalar(); }

View File

@@ -56,12 +56,9 @@ class MatrixComplex : public Evaluation<T> {
friend class MatrixComplexNode<T>;
public:
MatrixComplex(MatrixComplexNode<T> * node) : Evaluation<T>(node) {}
MatrixComplex() : Evaluation<T>(TreePool::sharedPool()->createTreeNode<MatrixComplexNode<T> >()) {}
MatrixComplex();
MatrixComplex(std::complex<T> * operands, int numberOfRows, int numberOfColumns);
static MatrixComplex<T> Undefined() {
std::complex<T> undef = std::complex<T>(NAN, NAN);
return MatrixComplex<T>((std::complex<T> *)&undef, 1, 1);
}
static MatrixComplex<T> Undefined();
static MatrixComplex<T> createIdentity(int dim);
MatrixComplex<T> inverse() const { return node()->inverse(); }
MatrixComplex<T> transpose() const { return node()->transpose(); }

View File

@@ -105,6 +105,9 @@ Expression ComplexNode<T>::complexToExpression(Preferences::ComplexFormat comple
}
}
template <typename T>
Complex<T>::Complex(T a, T b) : Complex(std::complex<T>(a, b)) {}
template <typename T>
Complex<T>::Complex(std::complex<T> c) :
Evaluation<T>(TreePool::sharedPool()->createTreeNode<ComplexNode<T>>())
@@ -114,6 +117,8 @@ Complex<T>::Complex(std::complex<T> c) :
template class ComplexNode<float>;
template class ComplexNode<double>;
template Complex<float>::Complex(float a, float b);
template Complex<double>::Complex(double a, double b);
template Complex<float>::Complex(std::complex<float> c);
template Complex<double>::Complex(std::complex<double> c);

View File

@@ -3,11 +3,20 @@
namespace Poincare {
template<typename T>
Evaluation<T> Evaluation<T>::childAtIndex(int i) const {
TreeByReference c = TreeByReference::childAtIndex(i);
return static_cast<Evaluation<T> &>(c);
}
template<typename T>
Expression Evaluation<T>::complexToExpression(Preferences::ComplexFormat complexFormat) const {
return node()->complexToExpression(complexFormat);
}
template Evaluation<float> Evaluation<float>::childAtIndex(int i) const;
template Evaluation<double> Evaluation<double>::childAtIndex(int i) const;
template Expression Evaluation<float>::complexToExpression(Preferences::ComplexFormat) const;
template Expression Evaluation<double>::complexToExpression(Preferences::ComplexFormat) const;

View File

@@ -128,6 +128,15 @@ MatrixComplex<T>::MatrixComplex(std::complex<T> * operands, int numberOfRows, in
setDimensions(numberOfRows, numberOfColumns);
}
template<typename T>
MatrixComplex<T>::MatrixComplex() : Evaluation<T>(TreePool::sharedPool()->createTreeNode<MatrixComplexNode<T> >()) {}
template<typename T>
MatrixComplex<T> MatrixComplex<T>::Undefined() {
std::complex<T> undef = std::complex<T>(NAN, NAN);
return MatrixComplex<T>((std::complex<T> *)&undef, 1, 1);
}
template<typename T>
MatrixComplex<T> MatrixComplex<T>::createIdentity(int dim) {
MatrixComplex<T> result;