conjugate.cpp
1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <poincare/conjugate.h>
#include <poincare/complex.h>
#include "layout/conjugate_layout.h"
extern "C" {
#include <assert.h>
}
#include <cmath>
namespace Poincare {
Conjugate::Conjugate() :
Function("conj")
{
}
Expression::Type Conjugate::type() const {
return Type::Conjugate;
}
Expression * Conjugate::cloneWithDifferentOperands(Expression** newOperands,
int numberOfOperands, bool cloneOperands) const {
assert(newOperands != nullptr);
Conjugate * c = new Conjugate();
c->setArgument(newOperands, numberOfOperands, cloneOperands);
return c;
}
template<typename T>
Complex<T> Conjugate::templatedComputeComplex(const Complex<T> c) const {
return c.conjugate();
}
ExpressionLayout * Conjugate::privateCreateLayout(FloatDisplayMode floatDisplayMode, ComplexFormat complexFormat) const {
assert(floatDisplayMode != FloatDisplayMode::Default);
assert(complexFormat != ComplexFormat::Default);
return new ConjugateLayout(m_args[0]->createLayout(floatDisplayMode, complexFormat));
}
}