[chronojump] Class LeastSquares renamed to LeastSquaresParabole
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Class LeastSquares renamed to LeastSquaresParabole
- Date: Fri, 10 Jan 2020 15:35:56 +0000 (UTC)
commit 8aea091a797b23eb5a45d4af7c36cab51c7ecaea
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jan 10 16:19:31 2020 +0100
Class LeastSquares renamed to LeastSquaresParabole
src/gui/app1/chronojump.cs | 4 ++--
src/gui/cairo/jumpsDjOptimalFall.cs | 4 ++--
src/gui/cairo/jumpsEvolution.cs | 4 ++--
src/gui/cairo/jumpsWeightFVProfile.cs | 4 ++--
src/gui/cairo/xy.cs | 4 ++--
src/jumpsDjOptimalFall.cs | 8 ++++----
src/jumpsEvolution.cs | 8 ++++----
src/jumpsWeightFVProfile.cs | 8 ++++----
src/utilMath.cs | 8 +++++---
9 files changed, 27 insertions(+), 25 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 05a8d5aa..0216483c 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -732,9 +732,9 @@ public partial class ChronoJumpWindow
//Json js = new Json();
//js.UploadEncoderData();
- //LeastSquares test
+ //LeastSquaresParabole test
/*
- LeastSquares ls = new LeastSquares();
+ LeastSquaresParabole ls = new LeastSquaresParabole();
ls.Test();
LogB.Information(string.Format("coef = {0} {1} {2}", ls.Coef[0], ls.Coef[1], ls.Coef[2]));
*/
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index b31c8273..73b44e22 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -45,7 +45,7 @@ public class JumpsDjOptimalFallGraph : CairoXY
//regular constructor
public JumpsDjOptimalFallGraph (
List<Point> point_l, double[] coefs,
- LeastSquares.ParaboleTypes paraboleType,
+ LeastSquaresParabole.ParaboleTypes paraboleType,
double xAtMMaxY, //x at Model MaxY
double pointsMaxValue,
DrawingArea area,
@@ -82,7 +82,7 @@ public class JumpsDjOptimalFallGraph : CairoXY
if(coefs.Length == 3)
{
- if(paraboleType == LeastSquares.ParaboleTypes.CONVEX)
+ if(paraboleType == LeastSquaresParabole.ParaboleTypes.CONVEX)
{
plotPredictedMaxPoint();
writeTextPredictedPoint();
diff --git a/src/gui/cairo/jumpsEvolution.cs b/src/gui/cairo/jumpsEvolution.cs
index fe9e6701..0fb035cd 100644
--- a/src/gui/cairo/jumpsEvolution.cs
+++ b/src/gui/cairo/jumpsEvolution.cs
@@ -44,7 +44,7 @@ public class JumpsEvolutionGraph : CairoXY
//regular constructor
public JumpsEvolutionGraph (
List<Point> point_l, double[] coefs,
- LeastSquares.ParaboleTypes paraboleType,
+ LeastSquaresParabole.ParaboleTypes paraboleType,
double xAtMMaxY, //x at Model MaxY
double pointsMaxValue,
DrawingArea area,
@@ -82,7 +82,7 @@ public class JumpsEvolutionGraph : CairoXY
if(coefs.Length == 3)
{
- if(paraboleType == LeastSquares.ParaboleTypes.CONVEX)
+ if(paraboleType == LeastSquaresParabole.ParaboleTypes.CONVEX)
{
plotPredictedMaxPoint();
writeTextPredictedPoint();
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index f1662534..80374493 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -54,7 +54,7 @@ public class JumpsWeightFVProfileGraph : CairoXY
//regular constructor
public JumpsWeightFVProfileGraph (
List<Point> point_l, double[] coefs,
- //LeastSquares.ParaboleTypes paraboleType,
+ //LeastSquaresParabole.ParaboleTypes paraboleType,
//double xAtMMaxY, //x at Model MaxY
//double pointsMaxValue,
DrawingArea area,
@@ -98,7 +98,7 @@ public class JumpsWeightFVProfileGraph : CairoXY
/*
if(coefs.Length == 3)
{
- if(paraboleType == LeastSquares.ParaboleTypes.CONVEX)
+ if(paraboleType == LeastSquaresParabole.ParaboleTypes.CONVEX)
{
plotPredictedMaxPoint();
writeTextPredictedPoint();
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index 04e77595..e8e10cbf 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -29,7 +29,7 @@ public abstract class CairoXY
//used on construction
protected List<Point> point_l;
protected double[] coefs;
- protected LeastSquares.ParaboleTypes paraboleType;
+ protected LeastSquaresParabole.ParaboleTypes paraboleType;
protected double xAtMMaxY;
protected double pointsMaxValue;
protected DrawingArea area;
@@ -128,7 +128,7 @@ public abstract class CairoXY
//includes point and model
protected void findAbsoluteMaximums()
{
- if(coefs.Length == 3 && paraboleType == LeastSquares.ParaboleTypes.CONVEX)
+ if(coefs.Length == 3 && paraboleType == LeastSquaresParabole.ParaboleTypes.CONVEX)
{
//x
absoluteMaxX = xAtMMaxY;
diff --git a/src/jumpsDjOptimalFall.cs b/src/jumpsDjOptimalFall.cs
index fe192fc0..c04bc4df 100644
--- a/src/jumpsDjOptimalFall.cs
+++ b/src/jumpsDjOptimalFall.cs
@@ -24,7 +24,7 @@ using System.Collections.Generic; //List
public class JumpsDjOptimalFall
{
private List<Point> point_l;
- LeastSquares ls;
+ LeastSquaresParabole ls;
//constructor
public JumpsDjOptimalFall()
@@ -45,8 +45,8 @@ public class JumpsDjOptimalFall
Util.GetHeightInCentimeters(j.Tv)
));
- //3 get LeastSquares
- ls = new LeastSquares();
+ //3 get LeastSquaresParabole
+ ls = new LeastSquaresParabole();
ls.Calculate(point_l);
//4 print data
@@ -88,7 +88,7 @@ public class JumpsDjOptimalFall
}
}
- public LeastSquares.ParaboleTypes ParaboleType
+ public LeastSquaresParabole.ParaboleTypes ParaboleType
{
get { return ls.ParaboleType; }
}
diff --git a/src/jumpsEvolution.cs b/src/jumpsEvolution.cs
index e7e767b1..b855c67a 100644
--- a/src/jumpsEvolution.cs
+++ b/src/jumpsEvolution.cs
@@ -26,7 +26,7 @@ using System.Collections.Generic; //List
public class JumpsEvolution
{
private List<Point> point_l;
- LeastSquares ls;
+ LeastSquaresParabole ls;
//constructor
public JumpsEvolution()
@@ -52,8 +52,8 @@ public class JumpsEvolution
));
}
- //3 get LeastSquares
- ls = new LeastSquares();
+ //3 get LeastSquaresParabole
+ ls = new LeastSquaresParabole();
ls.Calculate(point_l);
//4 print data
@@ -95,7 +95,7 @@ public class JumpsEvolution
}
}
- public LeastSquares.ParaboleTypes ParaboleType
+ public LeastSquaresParabole.ParaboleTypes ParaboleType
{
get { return ls.ParaboleType; }
}
diff --git a/src/jumpsWeightFVProfile.cs b/src/jumpsWeightFVProfile.cs
index f2cd5353..0ce46518 100644
--- a/src/jumpsWeightFVProfile.cs
+++ b/src/jumpsWeightFVProfile.cs
@@ -24,7 +24,7 @@ using System.Collections.Generic; //List
public class JumpsWeightFVProfile
{
private List<Point> point_l;
- LeastSquares ls;
+ LeastSquaresParabole ls;
//constructor
public JumpsWeightFVProfile()
@@ -59,8 +59,8 @@ public class JumpsWeightFVProfile
));
}
- //3 get LeastSquares
- ls = new LeastSquares();
+ //3 get LeastSquaresParabole
+ ls = new LeastSquaresParabole();
ls.Calculate(point_l);
//4 print data
@@ -102,7 +102,7 @@ public class JumpsWeightFVProfile
}
}
- public LeastSquares.ParaboleTypes ParaboleType
+ public LeastSquaresParabole.ParaboleTypes ParaboleType
{
get { return ls.ParaboleType; }
}
diff --git a/src/utilMath.cs b/src/utilMath.cs
index 56fa8738..ed1e187f 100644
--- a/src/utilMath.cs
+++ b/src/utilMath.cs
@@ -49,7 +49,7 @@ public class Point
}
-public class LeastSquares
+public class LeastSquaresParabole
{
public bool CalculatedCoef;
public double [] Coef; //indep, x, x^2
@@ -65,7 +65,7 @@ public class LeastSquares
public enum ParaboleTypes { NOTCALCULATED, STRAIGHT, CONVEX, CONCAVE } //CONVEX is usually OK
//constructor
- public LeastSquares() {
+ public LeastSquaresParabole() {
Coef = null;
}
@@ -96,7 +96,7 @@ public class LeastSquares
CalculatedXatMaxY = false;
if(numMeasures < 3) {
- LogB.Error(string.Format("LeastSquares needs at least three values, has: {0}",
numMeasures));
+ LogB.Error(string.Format("LeastSquaresParabole needs at least three values, has:
{0}", numMeasures));
return;
}
@@ -150,6 +150,8 @@ public class LeastSquares
calculateXAtMaxY();
} else {
+ //note determinant == 0 happens on this X data: (2019.11111111111, 2019.78333333333,
2020.025)
+ //but subtracting all by the first it works: (0.0000000, 0.6722222, 0.9138889)
LogB.Error("Determinant of matrix equal to zero");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]