mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Solver: increase IncreasingFunctionRoot precision
This commit is contained in:
@@ -111,12 +111,10 @@ double Distribution::cumulativeDistributiveInverseForProbabilityUsingIncreasingF
|
||||
if (*probability <= 0.0) {
|
||||
return -INFINITY;
|
||||
}
|
||||
double valuePrecision = FLT_EPSILON;
|
||||
Poincare::Coordinate2D<double> result = Poincare::Solver::IncreasingFunctionRoot(
|
||||
ax,
|
||||
bx,
|
||||
DBL_EPSILON,
|
||||
valuePrecision,
|
||||
[](double x, Poincare::Context * context, Poincare::Preferences::ComplexFormat complexFormat, Poincare::Preferences::AngleUnit angleUnit, const void * context1, const void * context2, const void * context3) {
|
||||
const Distribution * distribution = reinterpret_cast<const Distribution *>(context1);
|
||||
const double * proba = reinterpret_cast<const double *>(context2);
|
||||
@@ -130,7 +128,7 @@ double Distribution::cumulativeDistributiveInverseForProbabilityUsingIncreasingF
|
||||
nullptr);
|
||||
/* Either no result was found, the precision is ok or the result was outside
|
||||
* the given ax bx bounds */
|
||||
assert(std::isnan(result.x2()) || std::fabs(result.x2()) < valuePrecision || result.x1() == ax);
|
||||
assert(std::isnan(result.x2()) || std::fabs(result.x2()) <= DBL_EPSILON || result.x1() == ax);
|
||||
return result.x1();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
|
||||
// Root
|
||||
static double BrentRoot(double ax, double bx, double precision, ValueAtAbscissa evaluation, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, const void * context1 = nullptr, const void * context2 = nullptr, const void * context3 = nullptr);
|
||||
static Coordinate2D<double> IncreasingFunctionRoot(double ax, double bx, double resultPrecision, double valuePrecision, ValueAtAbscissa evaluation, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, const void * context1 = nullptr, const void * context2 = nullptr, const void * context3 = nullptr, double * resultEvaluation = nullptr);
|
||||
static Coordinate2D<double> IncreasingFunctionRoot(double ax, double bx, double resultPrecision, ValueAtAbscissa evaluation, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, const void * context1 = nullptr, const void * context2 = nullptr, const void * context3 = nullptr, double * resultEvaluation = nullptr);
|
||||
|
||||
// Proba
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ double Solver::BrentRoot(double ax, double bx, double precision, ValueAtAbscissa
|
||||
}
|
||||
|
||||
|
||||
Coordinate2D<double> Solver::IncreasingFunctionRoot(double ax, double bx, double resultPrecision, double valuePrecision, ValueAtAbscissa evaluation, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, const void * context1, const void * context2, const void * context3, double * resultEvaluation) {
|
||||
Coordinate2D<double> Solver::IncreasingFunctionRoot(double ax, double bx, double resultPrecision, ValueAtAbscissa evaluation, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, const void * context1, const void * context2, const void * context3, double * resultEvaluation) {
|
||||
assert(ax < bx);
|
||||
double min = ax;
|
||||
double max = bx;
|
||||
|
||||
Reference in New Issue
Block a user