Java Code Examples for org.apache.commons.math.ode.sampling.DummyStepInterpolator#storeTime()
The following examples show how to use
org.apache.commons.math.ode.sampling.DummyStepInterpolator#storeTime() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 6 votes |
@Test public void testFixedState() throws DerivativeException { double[] y = { 1.0, 3.0, -4.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); interpolator.setInterpolatedTime(0.1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } interpolator.setInterpolatedTime(0.5); result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 2
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 6 votes |
@Test public void testFixedState() throws DerivativeException { double[] y = { 1.0, 3.0, -4.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); interpolator.setInterpolatedTime(0.1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } interpolator.setInterpolatedTime(0.5); result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 3
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 6 votes |
@Test public void testFixedState() throws MathUserException { double[] y = { 1.0, 3.0, -4.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); interpolator.setInterpolatedTime(0.1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { Assert.assertTrue(FastMath.abs(result[i] - y[i]) < 1.0e-10); } interpolator.setInterpolatedTime(0.5); result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { Assert.assertTrue(FastMath.abs(result[i] - y[i]) < 1.0e-10); } }
Example 4
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 6 votes |
@Test public void testFixedState() throws DerivativeException { double[] y = { 1.0, 3.0, -4.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); interpolator.setInterpolatedTime(0.1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } interpolator.setInterpolatedTime(0.5); result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 5
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 6 votes |
@Test public void testFixedState() throws DerivativeException { double[] y = { 1.0, 3.0, -4.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); interpolator.setInterpolatedTime(0.1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } interpolator.setInterpolatedTime(0.5); result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 6
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 6 votes |
@Test public void testFixedState() throws DerivativeException { double[] y = { 1.0, 3.0, -4.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); interpolator.setInterpolatedTime(0.1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } interpolator.setInterpolatedTime(0.5); result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 7
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testSerialization() throws DerivativeException, IOException, ClassNotFoundException { double[] y = { 0.0, 1.0, -2.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(interpolator); assertTrue(bos.size () > 150); assertTrue(bos.size () < 250); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis); DummyStepInterpolator dsi = (DummyStepInterpolator) ois.readObject(); dsi.setInterpolatedTime(0.5); double[] result = dsi.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 8
Source File: ContinuousOutputModelTest.java From astor with GNU General Public License v2.0 | 5 votes |
private StepInterpolator buildInterpolator(double t0, double[] y0, double t1) { DummyStepInterpolator interpolator = new DummyStepInterpolator(y0, t1 >= t0); interpolator.storeTime(t0); interpolator.shift(); interpolator.storeTime(t1); return interpolator; }
Example 9
Source File: ContinuousOutputModelTest.java From astor with GNU General Public License v2.0 | 5 votes |
private StepInterpolator buildInterpolator(double t0, double[] y0, double t1) { DummyStepInterpolator interpolator = new DummyStepInterpolator(y0, t1 >= t0); interpolator.storeTime(t0); interpolator.shift(); interpolator.storeTime(t1); return interpolator; }
Example 10
Source File: ContinuousOutputModelTest.java From astor with GNU General Public License v2.0 | 5 votes |
private StepInterpolator buildInterpolator(double t0, double[] y0, double t1) { DummyStepInterpolator interpolator = new DummyStepInterpolator(y0, new double[y0.length], t1 >= t0); interpolator.storeTime(t0); interpolator.shift(); interpolator.storeTime(t1); return interpolator; }
Example 11
Source File: ContinuousOutputModelTest.java From astor with GNU General Public License v2.0 | 5 votes |
private StepInterpolator buildInterpolator(double t0, double[] y0, double t1) { DummyStepInterpolator interpolator = new DummyStepInterpolator(y0, t1 >= t0); interpolator.storeTime(t0); interpolator.shift(); interpolator.storeTime(t1); return interpolator; }
Example 12
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testNoReset() throws MathUserException { double[] y = { 0.0, 1.0, -2.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { Assert.assertTrue(FastMath.abs(result[i] - y[i]) < 1.0e-10); } }
Example 13
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testNoReset() throws DerivativeException { double[] y = { 0.0, 1.0, -2.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 14
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testNoReset() throws DerivativeException { double[] y = { 0.0, 1.0, -2.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 15
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testNoReset() throws DerivativeException { double[] y = { 0.0, 1.0, -2.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 16
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testNoReset() throws DerivativeException { double[] y = { 0.0, 1.0, -2.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 17
Source File: ContinuousOutputModelTest.java From astor with GNU General Public License v2.0 | 5 votes |
private StepInterpolator buildInterpolator(double t0, double[] y0, double t1) { DummyStepInterpolator interpolator = new DummyStepInterpolator(y0, new double[y0.length], t1 >= t0); interpolator.storeTime(t0); interpolator.shift(); interpolator.storeTime(t1); return interpolator; }
Example 18
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testNoReset() throws DerivativeException { double[] y = { 0.0, 1.0, -2.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); double[] result = interpolator.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 19
Source File: DummyStepInterpolatorTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testSerialization() throws DerivativeException, IOException, ClassNotFoundException { double[] y = { 0.0, 1.0, -2.0 }; DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true); interpolator.storeTime(0); interpolator.shift(); interpolator.storeTime(1); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(interpolator); assertTrue(bos.size () > 150); assertTrue(bos.size () < 250); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis); DummyStepInterpolator dsi = (DummyStepInterpolator) ois.readObject(); dsi.setInterpolatedTime(0.5); double[] result = dsi.getInterpolatedState(); for (int i = 0; i < result.length; ++i) { assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10); } }
Example 20
Source File: ContinuousOutputModelTest.java From astor with GNU General Public License v2.0 | 5 votes |
private StepInterpolator buildInterpolator(double t0, double[] y0, double t1) { DummyStepInterpolator interpolator = new DummyStepInterpolator(y0, new double[y0.length], t1 >= t0); interpolator.storeTime(t0); interpolator.shift(); interpolator.storeTime(t1); return interpolator; }