Skip to content

Commit

Permalink
Fix weight calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Am6er committed Jan 21, 2023
1 parent 38add14 commit 3b46aa8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions BecquerelMonitor/Utils/CalibrationSolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,23 @@ public static double[] SolveWeighted (List<CalibrationPoint> points, int Polynom
double[] dense_vector = new double[points.Count];
double[,] dense_weight = new double[points.Count, points.Count];

int max_count = 1;
double max_count = 1.0;
for (int i = 0; i < points.Count; i++)
{
if (points[i].Count > max_count)
{
max_count = points[i].Count;
}
}
max_count = Math.Sqrt(max_count);

for (int i = 0; i < points.Count; i++)
{
for (int j = 0; j < points.Count; j ++)
{
if (i == j)
{
dense_weight[i, j] = (double)points[i].Count / (double)max_count;
dense_weight[i, j] = Math.Sqrt((double)points[i].Count) / (double)max_count;
}
else
{
Expand Down

0 comments on commit 3b46aa8

Please sign in to comment.