"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "uppsrc/ScatterDraw/Equation.h" between
upp-x11-src-13648.tar.gz and upp-x11-src-13659.tar.gz

About: Ultimate++ is a C++ cross-platform rapid application development framework. Stable release.

Equation.h  (upp-x11-src-13648):Equation.h  (upp-x11-src-13659)
skipping to change at line 27 skipping to change at line 27
ImproperInputParameters = -3, ImproperInputParameters = -3,
TooManyFunctionEvaluation = -4 TooManyFunctionEvaluation = -4
}; };
virtual FitError Fit(DataSource &series, double &r2); virtual FitError Fit(DataSource &series, double &r2);
FitError Fit(DataSource &series) {double dummy; return Fit (series, dummy);} FitError Fit(DataSource &series) {double dummy; return Fit (series, dummy);}
virtual void GuessCoeff(DataSource &series) = 0; virtual void GuessCoeff(DataSource &series) = 0;
virtual double f(double ) = 0; virtual double f(double ) = 0;
virtual double f(double , double ) {NEVER(); return Null;} virtual double f(double , double ) {NEVER(); return Null;}
virtual double f(Vector <double> ) {NEVER(); return Null;} virtual double f(Vector <double> ) {NEVER(); return Null;}
virtual double x(int64 ) {NEVER(); return Null;}
virtual double y(int64 ) {NEVER(); return Null;}
virtual String GetName() = 0; virtual String GetName() = 0;
virtual String GetFullName() {return GetName();} virtual String GetFullName() {return GetName();}
virtual String GetEquation(int numDigits = 3) = 0; virtual String GetEquation(int numDigits = 3) = 0;
virtual inline int64 GetCount() {return Null;} virtual inline int64 GetCount() const {return Null;}
//void SetNumDigits(int n) {numDigits = n;} //void SetNumDigits(int n) {numDigits = n;}
//int GetNumDigits() {return n umDigits;} //int GetNumDigits() {return n umDigits;}
void SetMaxFitFunctionEvaluations(int n){maxFitFunctionEvaluations = n;} void SetMaxFitFunctionEvaluations(int n){maxFitFunctionEvaluations = n;}
int GetMaxFitFunctionEvaluations() {return maxFitFunctionEva luations;} int GetMaxFitFunctionEvaluations() {return maxFitFunctionEva luations;}
friend struct Equation_functor; friend struct Equation_functor;
const Vector<double> &GetCoeff() {return coeff;} const Vector<double> &GetCoeff() {return coeff;}
double GetCoeff(int i) {return c oeff[i];} double GetCoeff(int i) {return c oeff[i];}
skipping to change at line 481 skipping to change at line 483
void Sub(const doubleUnit &d) { void Sub(const doubleUnit &d) {
if (!(unit.IsEqual(d.unit) || IsNull(unit) || IsNull(d.unit))) if (!(unit.IsEqual(d.unit) || IsNull(unit) || IsNull(d.unit)))
throw Exc(t_("Units does not match in substraction")); throw Exc(t_("Units does not match in substraction"));
val -= d.val; val -= d.val;
} }
void Mult(const doubleUnit &d) { void Mult(const doubleUnit &d) {
unit.Mult(d.unit); unit.Mult(d.unit);
val *= d.val; val *= d.val;
} }
void Div(const doubleUnit &d) { void Div(const doubleUnit &d) {
if (d.val < 1e-100) if (abs(d.val) < 1e-100)
throw Exc(t_("Division by zero")); throw Exc(t_("Division by zero"));
unit.Div(d.unit); unit.Div(d.unit);
val /= d.val; val /= d.val;
} }
void Neg() { void Neg() {
val = -val; val = -val;
} }
void Exp(const doubleUnit &d) { void Exp(const doubleUnit &d) {
if (!(IsNull(d.unit) || d.unit.IsAdim())) if (!(IsNull(d.unit) || d.unit.IsAdim()))
throw Exc(t_("Exponent cannot have units")); throw Exc(t_("Exponent cannot have units"));
skipping to change at line 611 skipping to change at line 613
if (ifound >= 0) { if (ifound >= 0) {
double val = ScanDouble(parts[istr].Mid(s trVar.GetCount())); double val = ScanDouble(parts[istr].Mid(s trVar.GetCount()));
coeff << val; coeff << val;
break; break;
} }
} }
if (istr == parts.GetCount()) if (istr == parts.GetCount())
coeff << 0.1; coeff << 0.1;
} }
} }
double f(double x) { double f(double x) {
eval.SetConstant(idx, doubleUnit(x)); eval.SetConstant(idx, doubleUnit(x));
for (int i = 0; i < coeff.GetCount(); ++i) for (int i = 0; i < coeff.GetCount(); ++i)
eval.SetVariable(varNames[i], coeff[i]); eval.SetVariable(varNames[i], coeff[i]);
return eval.Eval(strEquation).val; return eval.Eval(strEquation).val;
} }
void SetName(String _name) {name = _name;} void SetName(String _name) {name = _name;}
virtual String GetName() { return name;} virtual String GetName() { return name;}
virtual String GetEquation(int numDigits = 3) {return eval.EvalStr(strE quation, numDigits);} virtual String GetEquation(int numDigits = 3) {return eval.EvalStr(strE quation, numDigits);}
virtual void GuessCoeff(DataSource & ) {} virtual void GuessCoeff(DataSource & ) {}
void SetDegree(int ) { NEVER();} void SetDegree(int ) { NEVER();}
 End of changes. 4 change blocks. 
3 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)