mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 22:30:30 +01:00
[poincare] Change privateApproximate-->approximate
This commit is contained in:
@@ -24,7 +24,7 @@ private:
|
||||
Expression shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const override;
|
||||
/* Evaluation */
|
||||
Evaluation<float> approximate(Expression::SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate<float>(context, angleUnit); }
|
||||
Evaluation<double> * privateApproximate(Expression::DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate<double>(context, angleUnit); }
|
||||
Evaluation<double> * approximate(Expression::DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate<double>(context, angleUnit); }
|
||||
template<typename T> Evaluation<T> templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ Expression MatrixDimension::shallowReduce(Context& context, Preferences::AngleUn
|
||||
|
||||
template<typename T>
|
||||
Evaluation<T> MatrixDimension::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Evaluation<T> * input = childAtIndex(0)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * input = childAtIndex(0)->approximate(T(), context, angleUnit);
|
||||
std::complex<T> operands[2];
|
||||
if (input->type() == Evaluation<T>::Type::MatrixComplex) {
|
||||
operands[0] = std::complex<T>(static_cast<MatrixComplex<T> *>(input)->numberOfRows());
|
||||
|
||||
@@ -46,7 +46,7 @@ Expression MatrixInverse::shallowReduce(Context& context, Preferences::AngleUnit
|
||||
// TODO: handle this exactly in shallowReduce for small dimensions.
|
||||
template<typename T>
|
||||
Evaluation<T> MatrixInverse::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Evaluation<T> * input = childAtIndex(0)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * input = childAtIndex(0)->approximate(T(), context, angleUnit);
|
||||
Evaluation<T> * inverse = input->createInverse();
|
||||
if (inverse == nullptr) {
|
||||
inverse = new Complex<T>(Complex<T>::Undefined());
|
||||
|
||||
@@ -50,7 +50,7 @@ Expression MatrixTrace::shallowReduce(Context& context, Preferences::AngleUnit a
|
||||
|
||||
template<typename T>
|
||||
Complex<T> * MatrixTrace::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Evaluation<T> * input = childAtIndex(0)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * input = childAtIndex(0)->approximate(T(), context, angleUnit);
|
||||
Complex<T> * result = new Complex<T>(input->createTrace());
|
||||
delete input;
|
||||
return result;
|
||||
|
||||
@@ -39,7 +39,7 @@ Expression MatrixTranspose::shallowReduce(Context& context, Preferences::AngleUn
|
||||
|
||||
template<typename T>
|
||||
Evaluation<T> MatrixTranspose::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Evaluation<T> * input = childAtIndex(0)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * input = childAtIndex(0)->approximate(T(), context, angleUnit);
|
||||
Evaluation<T> * transpose = input->createTranspose();
|
||||
assert(transpose != nullptr);
|
||||
delete input;
|
||||
|
||||
@@ -68,8 +68,8 @@ Expression PermuteCoefficient::shallowReduce(Context& context, Preferences::Angl
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Complex<T> * PermuteCoefficient::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const { Evaluation<T> * nInput = childAtIndex(0)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * kInput = childAtIndex(1)->privateApproximate(T(), context, angleUnit);
|
||||
Complex<T> * PermuteCoefficient::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const { Evaluation<T> * nInput = childAtIndex(0)->approximate(T(), context, angleUnit);
|
||||
Evaluation<T> * kInput = childAtIndex(1)->approximate(T(), context, angleUnit);
|
||||
T n = nInput->toScalar();
|
||||
T k = kInput->toScalar();
|
||||
delete nInput;
|
||||
|
||||
@@ -72,8 +72,8 @@ Expression PredictionInterval::shallowReduce(Context& context, Preferences::Angl
|
||||
|
||||
template<typename T>
|
||||
Evaluation<T> PredictionInterval::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Evaluation<T> * pInput = childAtIndex(0)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * nInput = childAtIndex(1)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * pInput = childAtIndex(0)->approximate(T(), context, angleUnit);
|
||||
Evaluation<T> * nInput = childAtIndex(1)->approximate(T(), context, angleUnit);
|
||||
T p = static_cast<Complex<T> *>(pInput)->toScalar();
|
||||
T n = static_cast<Complex<T> *>(nInput)->toScalar();
|
||||
delete pInput;
|
||||
|
||||
@@ -19,8 +19,8 @@ Expression * Randint::clone() const {
|
||||
}
|
||||
|
||||
template <typename T> Evaluation<T> * Randint::templateApproximate(Context & context, Preferences::AngleUnit angleUnit) const {
|
||||
Evaluation<T> * aInput = childAtIndex(0)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * bInput = childAtIndex(1)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * aInput = childAtIndex(0)->approximate(T(), context, angleUnit);
|
||||
Evaluation<T> * bInput = childAtIndex(1)->approximate(T(), context, angleUnit);
|
||||
T a = aInput->toScalar();
|
||||
T b = bInput->toScalar();
|
||||
delete aInput;
|
||||
|
||||
@@ -54,8 +54,8 @@ Expression Round::shallowReduce(Context& context, Preferences::AngleUnit angleUn
|
||||
|
||||
template<typename T>
|
||||
Complex<T> * Round::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Evaluation<T> * f1Input = childAtIndex(0)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * f2Input = childAtIndex(1)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * f1Input = childAtIndex(0)->approximate(T(), context, angleUnit);
|
||||
Evaluation<T> * f2Input = childAtIndex(1)->approximate(T(), context, angleUnit);
|
||||
T f1 = f1Input->toScalar();
|
||||
T f2 = f2Input->toScalar();
|
||||
delete f1Input;
|
||||
|
||||
@@ -17,8 +17,8 @@ LayoutRef Sequence::createLayout(Preferences::PrintFloatMode floatDisplayMode, i
|
||||
|
||||
template<typename T>
|
||||
Evaluation<T> Sequence::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Evaluation<T> * aInput = childAtIndex(1)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * bInput = childAtIndex(2)->privateApproximate(T(), context, angleUnit);
|
||||
Evaluation<T> * aInput = childAtIndex(1)->approximate(T(), context, angleUnit);
|
||||
Evaluation<T> * bInput = childAtIndex(2)->approximate(T(), context, angleUnit);
|
||||
T start = aInput->toScalar();
|
||||
T end = bInput->toScalar();
|
||||
delete aInput;
|
||||
@@ -34,7 +34,7 @@ Evaluation<T> Sequence::templatedApproximate(Context& context, Preferences::Angl
|
||||
return new Complex<T>(Complex<T>::Undefined());
|
||||
}
|
||||
nContext.setApproximationForVariable((T)i);
|
||||
Evaluation<T> * expression = childAtIndex(0)->privateApproximate(T(), nContext, angleUnit);
|
||||
Evaluation<T> * expression = childAtIndex(0)->approximate(T(), nContext, angleUnit);
|
||||
Evaluation<T> * newResult = evaluateWithNextTerm(T(), result, expression);
|
||||
delete result;
|
||||
delete expression;
|
||||
|
||||
@@ -45,7 +45,7 @@ template<typename T>
|
||||
Evaluation<T> Store::templatedApproximate(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
context.setExpressionForSymbolName(value(), symbol(), context);
|
||||
if (context.expressionForSymbol(symbol()) != nullptr) {
|
||||
return context.expressionForSymbol(symbol())->privateApproximate(T(), context, angleUnit);
|
||||
return context.expressionForSymbol(symbol())->approximate(T(), context, angleUnit);
|
||||
}
|
||||
return new Complex<T>(Complex<T>::Undefined());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user