Skip to content

Commit 05446d8

Browse files
authored
Merge pull request #72 from bruker-biosensors/feature/minor_revisions
Feature/minor revisions
2 parents 9a30630 + f955d64 commit 05446d8

7 files changed

+4
-609
lines changed

Build.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<RootRevision>3b5475ca350bd5e50b58fd2d8642051ee0c19916</RootRevision>
4+
<RootRevision>v6-36-08</RootRevision>
55
<RootGitPath>$(MSBuildThisFileDirectory)minuit2.net/obj/root</RootGitPath>
66
<SwigOutputPath>$(MSBuildThisFileDirectory)/minuit2.net/obj/gen</SwigOutputPath>
77
</PropertyGroup>
@@ -33,11 +33,11 @@
3333
WorkingDirectory="$(RootGitPath)"/>
3434

3535
<!-- Fetch only the specific commit without history -->
36-
<Exec Command="git fetch --depth 1 --no-tags origin $(RootRevision)"
36+
<Exec Command="git fetch --depth 1 --no-tags origin tag $(RootRevision)"
3737
WorkingDirectory="$(RootGitPath)"/>
3838

3939
<!-- Checkout the fetched commit -->
40-
<Exec Command="git checkout $(RootRevision)"
40+
<Exec Command="git checkout FETCH_HEAD"
4141
WorkingDirectory="$(RootGitPath)"/>
4242
</Target>
4343

minuit2.net/CostFunctions/CostFunction.cs

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -381,68 +381,6 @@ public static ICostFunction LeastSquares(
381381
errorDefinitionInSigma,
382382
false);
383383
}
384-
385-
public static ICostFunction LeastSquaresWithGaussNewtonApproximation(
386-
IReadOnlyList<double> x,
387-
IReadOnlyList<double> y,
388-
IReadOnlyList<string> parameters,
389-
Func<double, IReadOnlyList<double>, double> model,
390-
Func<double, IReadOnlyList<double>, IReadOnlyList<double>> modelGradient,
391-
double errorDefinitionInSigma = 1)
392-
{
393-
DataValidation.EnsureMatchingSizesBetween((x, nameof(x)), (y, nameof(y)));
394-
return new LeastSquaresWithGaussNewtonApproximation(
395-
x,
396-
y,
397-
_ => 1,
398-
parameters,
399-
model,
400-
modelGradient,
401-
errorDefinitionInSigma,
402-
true);
403-
}
404-
405-
public static ICostFunction LeastSquaresWithGaussNewtonApproximation(
406-
IReadOnlyList<double> x,
407-
IReadOnlyList<double> y,
408-
double yError,
409-
IReadOnlyList<string> parameters,
410-
Func<double, IReadOnlyList<double>, double> model,
411-
Func<double, IReadOnlyList<double>, IReadOnlyList<double>> modelGradient,
412-
double errorDefinitionInSigma = 1)
413-
{
414-
DataValidation.EnsureMatchingSizesBetween((x, nameof(x)), (y, nameof(y)));
415-
return new LeastSquaresWithGaussNewtonApproximation(
416-
x,
417-
y,
418-
_ => yError,
419-
parameters,
420-
model,
421-
modelGradient,
422-
errorDefinitionInSigma,
423-
false);
424-
}
425-
426-
public static ICostFunction LeastSquaresWithGaussNewtonApproximation(
427-
IReadOnlyList<double> x,
428-
IReadOnlyList<double> y,
429-
IReadOnlyList<double> yError,
430-
IReadOnlyList<string> parameters,
431-
Func<double, IReadOnlyList<double>, double> model,
432-
Func<double, IReadOnlyList<double>, IReadOnlyList<double>> modelGradient,
433-
double errorDefinitionInSigma = 1)
434-
{
435-
DataValidation.EnsureMatchingSizesBetween((x, nameof(x)), (y, nameof(y)), (yError, nameof(yError)));
436-
return new LeastSquaresWithGaussNewtonApproximation(
437-
x,
438-
y,
439-
i => yError[i],
440-
parameters,
441-
model,
442-
modelGradient,
443-
errorDefinitionInSigma,
444-
false);
445-
}
446384

447385
public static ICostFunction Sum(params ICostFunction[] components) => new CostFunctionSum(components);
448386
}

minuit2.net/CostFunctions/LeastSquaresWithGaussNewtonApproximation.cs

Lines changed: 0 additions & 95 deletions
This file was deleted.

minuit2.net/ParameterConfigurationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static MnUserParameterState AsState(this IEnumerable<ParameterConfigurati
1111

1212
private static void Add(this MnUserParameterState state, ParameterConfiguration parameter)
1313
{
14-
state.Add(parameter.Name, parameter.Value, parameter.Value * 0.01);
14+
state.Add(parameter.Name, parameter.Value, parameter.Value == 0 ? 1 : parameter.Value * 0.01);
1515

1616
if (parameter.IsFixed)
1717
state.Fix(parameter.Name);

test/ExampleProblems/ConfigurableLeastSquaresProblem.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ public class LeastSquaresCostBuilder(
3535
private bool _hasYErrors = true;
3636
private bool _hasGradient;
3737
private bool _hasHessian;
38-
private bool _isUsingGaussNewtonApproximation;
3938
private double _errorDefinitionInSigma = 1;
4039

4140
public ICostFunction Build() => _hasYErrors switch
4241
{
43-
true when _isUsingGaussNewtonApproximation => CostFunction.LeastSquaresWithGaussNewtonApproximation(xValues, yValues, yError, _parameterNames, model, modelGradient, _errorDefinitionInSigma),
44-
false when _isUsingGaussNewtonApproximation => CostFunction.LeastSquaresWithGaussNewtonApproximation(xValues, yValues, _parameterNames, model, modelGradient, _errorDefinitionInSigma),
4542
true when _hasHessian => CostFunction.LeastSquares(xValues, yValues, yError, _parameterNames, model, modelGradient, modelHessian, _errorDefinitionInSigma),
4643
false when _hasHessian => CostFunction.LeastSquares(xValues, yValues, _parameterNames, model, modelGradient, modelHessian, _errorDefinitionInSigma),
4744
true when _hasGradient => CostFunction.LeastSquares(xValues, yValues, yError, _parameterNames, model, modelGradient, _errorDefinitionInSigma),
@@ -68,12 +65,6 @@ public LeastSquaresCostBuilder WithHessian(bool hasHessian = true)
6865
return this;
6966
}
7067

71-
public LeastSquaresCostBuilder UsingGaussNewtonApproximation(bool isUsingGaussNewtonApproximation = true)
72-
{
73-
_isUsingGaussNewtonApproximation = isUsingGaussNewtonApproximation;
74-
return this;
75-
}
76-
7768
public LeastSquaresCostBuilder WithErrorDefinition(double sigma)
7869
{
7970
_errorDefinitionInSigma = sigma;

0 commit comments

Comments
 (0)