Skip to content

Commit

Permalink
improved test for stackVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
Serrof authored Feb 7, 2025
1 parent 3a25a68 commit 07f8551
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ public FieldGradient<T> linearCombination(final double a1, final FieldGradient<T
/**
* Add an independent variable to the Taylor expansion.
* @return object with one more variable
* @since 13.0
* @since 4.0
*/
public FieldGradient<T> stackVariable() {
final T[] gradient = MathArrays.buildArray(getValueField(), this.getFreeParameters() + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ public Gradient linearCombination(final double a1, final Gradient b1,
/**
* Add an independent variable to the Taylor expansion.
* @return object with one more variable
* @since 13.0
* @since 4.0
*/
public Gradient stackVariable() {
final double[] gradient = new double[this.getFreeParameters() + 1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void testStackVariable() {
// THEN
Assertions.assertEquals(gradient.getValue(), gradientWithMoreVariable.getValue());
Assertions.assertEquals(gradient.getFreeParameters() + 1, gradientWithMoreVariable.getFreeParameters());
Assertions.assertEquals(0., gradientWithMoreVariable.getGradient[gradient.getFreeParameters().getReal()])
Assertions.assertArrayEquals(gradient.getGradient(), Arrays.copyOfRange(gradientWithMoreVariable.getGradient(),
0, gradient.getFreeParameters()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void testStackVariable() {
// THEN
Assertions.assertEquals(gradient.getValue(), gradientWithMoreVariable.getValue());
Assertions.assertEquals(gradient.getFreeParameters() + 1, gradientWithMoreVariable.getFreeParameters());
Assertions.assertEquals(0., gradientWithMoreVariable.getGradient[gradient.getFreeParameters()])
Assertions.assertArrayEquals(gradient.getGradient(), Arrays.copyOfRange(gradientWithMoreVariable.getGradient(),
0, gradient.getFreeParameters()));
}
Expand Down

0 comments on commit 07f8551

Please sign in to comment.