Java Code Examples for java.io.ObjectOutput#writeDouble()

The following examples show how to use java.io.ObjectOutput#writeDouble() . 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: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  try {
    // save the local attributes
    finalizeStep();
  } catch (MathUserException e) {
      IOException ioe = new IOException(e.getLocalizedMessage());
      ioe.initCause(e);
      throw ioe;
  }
  final int dimension = (currentState == null) ? -1 : currentState.length;
  out.writeInt(dimension);
  for (int i = 0; i < dimension; ++i) {
    out.writeDouble(yDotKLast[0][i]);
    out.writeDouble(yDotKLast[1][i]);
    out.writeDouble(yDotKLast[2][i]);
  }

  // save the state of the base class
  super.writeExternal(out);

}
 
Example 2
Source File: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  try {
    // save the local attributes
    finalizeStep();
  } catch (DerivativeException e) {
    throw MathRuntimeException.createIOException(e);
  }
  final int dimension = (currentState == null) ? -1 : currentState.length;
  out.writeInt(dimension);
  for (int i = 0; i < dimension; ++i) {
    out.writeDouble(yDotKLast[0][i]);
    out.writeDouble(yDotKLast[1][i]);
    out.writeDouble(yDotKLast[2][i]);
  }

  // save the state of the base class
  super.writeExternal(out);

}
 
Example 3
Source File: RungeKuttaStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  // save the state of the base class
  writeBaseExternal(out);

  // save the local attributes
  final int n = (currentState == null) ? -1 : currentState.length;
  for (int i = 0; i < n; ++i) {
    out.writeDouble(previousState[i]);
  }

  final int kMax = (yDotK == null) ? -1 : yDotK.length;
  out.writeInt(kMax);
  for (int k = 0; k < kMax; ++k) {
    for (int i = 0; i < n; ++i) {
      out.writeDouble(yDotK[k][i]);
    }
  }

  // we do not save any reference to the equations

}
 
Example 4
Source File: GraggBulirschStoerStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  final int dimension = (currentState == null) ? -1 : currentState.length;

  // save the state of the base class
  writeBaseExternal(out);

  // save the local attributes (but not the temporary vectors)
  out.writeInt(currentDegree);
  for (int k = 0; k <= currentDegree; ++k) {
    for (int l = 0; l < dimension; ++l) {
      out.writeDouble(polynoms[k][l]);
    }
  }

}
 
Example 5
Source File: GraggBulirschStoerStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  final int dimension = (currentState == null) ? -1 : currentState.length;

  // save the state of the base class
  writeBaseExternal(out);

  // save the local attributes (but not the temporary vectors)
  out.writeInt(currentDegree);
  for (int k = 0; k <= currentDegree; ++k) {
    for (int l = 0; l < dimension; ++l) {
      out.writeDouble(polynoms[k][l]);
    }
  }

}
 
Example 6
Source File: RungeKuttaStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  // save the state of the base class
  writeBaseExternal(out);

  // save the local attributes
  final int n = (currentState == null) ? -1 : currentState.length;
  for (int i = 0; i < n; ++i) {
    out.writeDouble(previousState[i]);
  }

  final int kMax = (yDotK == null) ? -1 : yDotK.length;
  out.writeInt(kMax);
  for (int k = 0; k < kMax; ++k) {
    for (int i = 0; i < n; ++i) {
      out.writeDouble(yDotK[k][i]);
    }
  }

  // we do not save any reference to the equations

}
 
Example 7
Source File: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  try {
    // save the local attributes
    finalizeStep();
  } catch (DerivativeException e) {
    throw MathRuntimeException.createIOException(e);
  }
  final int dimension = (currentState == null) ? -1 : currentState.length;
  out.writeInt(dimension);
  for (int i = 0; i < dimension; ++i) {
    out.writeDouble(yDotKLast[0][i]);
    out.writeDouble(yDotKLast[1][i]);
    out.writeDouble(yDotKLast[2][i]);
  }

  // save the state of the base class
  super.writeExternal(out);

}
 
Example 8
Source File: GraggBulirschStoerStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  final int dimension = (currentState == null) ? -1 : currentState.length;

  // save the state of the base class
  writeBaseExternal(out);

  // save the local attributes (but not the temporary vectors)
  out.writeInt(currentDegree);
  for (int k = 0; k <= currentDegree; ++k) {
    for (int l = 0; l < dimension; ++l) {
      out.writeDouble(polynoms[k][l]);
    }
  }

}
 
Example 9
Source File: CRSMatrix.java    From hlta with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {

    out.writeInt(rows);
    out.writeInt(columns);
    out.writeInt(cardinality);

    // write pairs (value, column index)
    for (int i = 0; i < cardinality; i++) {
        out.writeDouble(values[i]);
        out.writeInt(columnIndices[i]);
    }

    // write row pointers
    for (int i = 0; i < rows + 1; i++) {
        out.writeInt(rowPointers[i]);
    }
}
 
Example 10
Source File: FirstOrderIntegratorWithJacobians.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Write an array.
 * @param out output stream
 * @param array array to write
 * @exception IOException if array cannot be read
 */
private static void writeArray(final ObjectOutput out, final double[] array)
    throws IOException {
    for (int i = 0; i < array.length; ++i) {
        out.writeDouble(array[i]);
    }
}
 
Example 11
Source File: DummyStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Write the instance to an output channel.
 * @param out output channel
 * @exception IOException if the instance cannot be written
 */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

    // save the state of the base class
  writeBaseExternal(out);

  if (currentDerivative != null) {
      for (int i = 0; i < currentDerivative.length; ++i) {
          out.writeDouble(currentDerivative[i]);
      }
  }

}
 
Example 12
Source File: ExternObjTrees.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
Example 13
Source File: ExternObjTrees.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
Example 14
Source File: NordsieckStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
    throws IOException {

    // save the state of the base class
    writeBaseExternal(out);

    // save the local attributes
    out.writeDouble(scalingH);
    out.writeDouble(referenceTime);

    final int n = (currentState == null) ? -1 : currentState.length;
    if (scaled == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        for (int j = 0; j < n; ++j) {
            out.writeDouble(scaled[j]);
        }
    }

    if (nordsieck == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        out.writeObject(nordsieck);
    }

    // we don't save state variation, it will be recomputed

}
 
Example 15
Source File: TIntDoubleHash.java    From blip with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(0);

    // SUPER
    super.writeExternal(out);

    // NO_ENTRY_KEY
    out.writeInt(no_entry_key);

    // NO_ENTRY_VALUE
    out.writeDouble(no_entry_value);
}
 
Example 16
Source File: VisorQueryDetailMetrics.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
    U.writeString(out, qryType);
    U.writeString(out, qry);
    U.writeString(out, cache);
    out.writeInt(execs);
    out.writeInt(completions);
    out.writeInt(failures);
    out.writeLong(minTime);
    out.writeLong(maxTime);
    out.writeDouble(avgTime);
    out.writeLong(totalTime);
    out.writeLong(lastStartTime);
}
 
Example 17
Source File: FirstOrderIntegratorWithJacobians.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Write an array.
 * @param out output stream
 * @param array array to write
 * @exception IOException if array cannot be read
 */
private static void writeArray(final ObjectOutput out, final double[] array)
    throws IOException {
    for (int i = 0; i < array.length; ++i) {
        out.writeDouble(array[i]);
    }
}
 
Example 18
Source File: NordsieckStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
    throws IOException {

    // save the state of the base class
    writeBaseExternal(out);

    // save the local attributes
    out.writeDouble(scalingH);
    out.writeDouble(referenceTime);

    final int n = (currentState == null) ? -1 : currentState.length;
    if (scaled == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        for (int j = 0; j < n; ++j) {
            out.writeDouble(scaled[j]);
        }
    }

    if (nordsieck == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        out.writeObject(nordsieck);
    }

    // we don't save state variation, it will be recomputed

}
 
Example 19
Source File: Circled.java    From JOML with MIT License 4 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeDouble(x);
    out.writeDouble(y);
    out.writeDouble(r);
}
 
Example 20
Source File: AxisAngle4d.java    From JOML with MIT License 4 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeDouble(angle);
    out.writeDouble(x);
    out.writeDouble(y);
    out.writeDouble(z);
}