diff --git a/src/test/java/org/orekit/rugged/api/RuggedTest.java b/src/test/java/org/orekit/rugged/api/RuggedTest.java
index 8d44d62404433a65130d9553ff6221a8670d3ccb..d3938f6c4dd232b3d510de326d2d64e34a2c39d0 100644
--- a/src/test/java/org/orekit/rugged/api/RuggedTest.java
+++ b/src/test/java/org/orekit/rugged/api/RuggedTest.java
@@ -35,7 +35,6 @@ import java.util.List;
 import java.util.Locale;
 
 import org.hipparchus.analysis.differentiation.DSFactory;
-import org.hipparchus.analysis.differentiation.DerivativeStructure;
 import org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator;
 import org.hipparchus.analysis.differentiation.Gradient;
 import org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction;
@@ -1390,27 +1389,27 @@ public class RuggedTest {
 
         // Expected derivatives for
         // minimum distance between LOS
-        double[] expectedDminDerivatives = {3.88800245, -153874.01319097, -678866.03112033, 191294.06938169, 668600.16715270} ;
+        double[] expectedDminDerivatives = {-153874.01319097, -678866.03112033, 191294.06938169, 668600.16715270} ;
         // minimum distance to the ground
-        double[] expectedDcentralBodyDerivatives = {6368020.55910153, 7007767.46926062, -1577060.82402054, -6839286.39593802, 1956452.66636262};
+        double[] expectedDcentralBodyDerivatives = {7007767.46926062, -1577060.82402054, -6839286.39593802, 1956452.66636262};
 
-        DerivativeStructure[] distancesBetweenLOSwithDS = refiningTest.computeDistancesBetweenLOSDerivatives(realPixelA, realPixelB, expectedDistanceBetweenLOS, expectedDistanceToTheGround);
+        Gradient[] distancesBetweenLOSGradient = refiningTest.computeDistancesBetweenLOSGradient(realPixelA, realPixelB, expectedDistanceBetweenLOS, expectedDistanceToTheGround);
 
         // Minimum distance between LOS
-        DerivativeStructure dMin = distancesBetweenLOSwithDS[0];
+        Gradient dMin = distancesBetweenLOSGradient[0];
         // Minimum distance to the ground
-        DerivativeStructure dCentralBody = distancesBetweenLOSwithDS[1];
+        Gradient dCentralBody = distancesBetweenLOSGradient[1];
 
         Assert.assertEquals(expectedDistanceBetweenLOS, dMin.getValue(), 1.e-8);
         Assert.assertEquals(expectedDistanceToTheGround, dCentralBody.getValue() , 1.e-5);
 
 
-        for (int i = 0; i < dMin.getAllDerivatives().length; i++) {
-            Assert.assertEquals(expectedDminDerivatives[i], dMin.getAllDerivatives()[i], 1.e-8);
+        for (int i = 0; i < dMin.getFreeParameters(); i++) {
+            Assert.assertEquals(expectedDminDerivatives[i], dMin.getPartialDerivative(i), 1.e-8);
         }
 
-        for (int i = 0; i < dCentralBody.getAllDerivatives().length; i++) {
-            Assert.assertEquals(expectedDcentralBodyDerivatives[i], dCentralBody.getAllDerivatives()[i], 3.e-8);
+        for (int i = 0; i < dCentralBody.getFreeParameters(); i++) {
+            Assert.assertEquals(expectedDcentralBodyDerivatives[i], dCentralBody.getPartialDerivative(i), 3.e-8);
         }
     }
 
diff --git a/src/test/java/org/orekit/rugged/linesensor/PolynomialRotationTest.java b/src/test/java/org/orekit/rugged/linesensor/PolynomialRotationTest.java
index bdc68cd93d9510a51622c07389360a4f47138db3..338bb26d6dc1fed2eed8cfd552436c30197f636f 100644
--- a/src/test/java/org/orekit/rugged/linesensor/PolynomialRotationTest.java
+++ b/src/test/java/org/orekit/rugged/linesensor/PolynomialRotationTest.java
@@ -21,10 +21,13 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import org.hipparchus.Field;
 import org.hipparchus.analysis.UnivariateMatrixFunction;
 import org.hipparchus.analysis.differentiation.DSFactory;
 import org.hipparchus.analysis.differentiation.DerivativeStructure;
 import org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator;
+import org.hipparchus.analysis.differentiation.Gradient;
+import org.hipparchus.analysis.differentiation.GradientField;
 import org.hipparchus.analysis.differentiation.UnivariateDifferentiableMatrixFunction;
 import org.hipparchus.analysis.polynomials.PolynomialFunction;
 import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
@@ -41,7 +44,7 @@ import org.junit.Test;
 import org.orekit.rugged.los.LOSBuilder;
 import org.orekit.rugged.los.PolynomialRotation;
 import org.orekit.rugged.los.TimeDependentLOS;
-import org.orekit.rugged.utils.DSGenerator;
+import org.orekit.rugged.utils.DerivativeGenerator;
 import org.orekit.time.AbsoluteDate;
 import org.orekit.utils.ParameterDriver;
 
@@ -173,8 +176,8 @@ public class PolynomialRotationTest {
             for (final ParameterDriver driver : selected) {
                 driver.setSelected(true);
             }
-            final DSFactory factoryS = new DSFactory(selected.size(), 1);
-            DSGenerator generator = new DSGenerator() {
+            final GradientField field = GradientField.getField(selected.size());
+            DerivativeGenerator<Gradient> generator = new DerivativeGenerator<Gradient>() {
 
                 /** {@inheritDoc} */
                 @Override
@@ -184,23 +187,29 @@ public class PolynomialRotationTest {
 
                 /** {@inheritDoc} */
                 @Override
-                public DerivativeStructure constant(final double value) {
-                    return factoryS.constant(value);
+                public Gradient constant(final double value) {
+                    return Gradient.constant(selected.size(), value);
                 }
 
                 /** {@inheritDoc} */
                 @Override
-                public DerivativeStructure variable(final ParameterDriver driver) {
+                public Gradient variable(final ParameterDriver driver) {
                     int index = 0;
                     for (ParameterDriver d : getSelected()) {
                         if (d == driver) {
-                            return factoryS.variable(index, driver.getValue());
+                            return Gradient.variable(selected.size(), index, driver.getValue());
                         }
                         ++index;
                     }
                     return constant(driver.getValue());
                 }
 
+                /** {@inheritDoc} */
+                @Override
+                public Field<Gradient> getField() {
+                    return field;
+                }
+
             };
             Assert.assertEquals(7, generator.getSelected().size());
 
@@ -226,7 +235,7 @@ public class PolynomialRotationTest {
                 DerivativeStructure[][] mDS = f.value(factory11.variable(0, driver.getValue()));
                 for (int i = 0; i < raw.size(); ++i) {
                     Vector3D los = tdl.getLOS(i, date);
-                    FieldVector3D<DerivativeStructure> losDS = tdl.getLOSDerivatives(i, date, generator);
+                    FieldVector3D<Gradient> losDS = tdl.getLOSDerivatives(i, date, generator);
                     Assert.assertEquals(los.getX(), losDS.getX().getValue(), 2.0e-15);
                     Assert.assertEquals(los.getY(), losDS.getY().getValue(), 2.0e-15);
                     Assert.assertEquals(los.getZ(), losDS.getZ().getValue(), 2.0e-15);