Java Code Examples for org.apache.commons.math3.util.FastMath#IEEEremainder
The following examples show how to use
org.apache.commons.math3.util.FastMath#IEEEremainder .
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: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Perform remainder of two derivative structures. * @param lhs array holding left hand side of remainder * @param lhsOffset offset of the left hand side in its array * @param rhs array right hand side of remainder * @param rhsOffset offset of the right hand side in its array * @param result array where result must be stored (it may be * one of the input arrays) * @param resultOffset offset of the result in its array */ public void remainder(final double[] lhs, final int lhsOffset, final double[] rhs, final int rhsOffset, final double[] result, final int resultOffset) { // compute k such that lhs % rhs = lhs - k rhs final double rem = FastMath.IEEEremainder(lhs[lhsOffset], rhs[rhsOffset]); final double k = FastMath.rint((lhs[lhsOffset] - rem) / rhs[rhsOffset]); // set up value result[resultOffset] = rem; // set up partial derivatives for (int i = 1; i < getSize(); ++i) { result[resultOffset + i] = lhs[lhsOffset + i] - k * rhs[rhsOffset + i]; } }
Example 2
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Perform remainder of two derivative structures. * @param lhs array holding left hand side of remainder * @param lhsOffset offset of the left hand side in its array * @param rhs array right hand side of remainder * @param rhsOffset offset of the right hand side in its array * @param result array where result must be stored (it may be * one of the input arrays) * @param resultOffset offset of the result in its array */ public void remainder(final double[] lhs, final int lhsOffset, final double[] rhs, final int rhsOffset, final double[] result, final int resultOffset) { // compute k such that lhs % rhs = lhs - k rhs final double rem = FastMath.IEEEremainder(lhs[lhsOffset], rhs[rhsOffset]); final double k = FastMath.rint((lhs[lhsOffset] - rem) / rhs[rhsOffset]); // set up value result[resultOffset] = rem; // set up partial derivatives for (int i = 1; i < getSize(); ++i) { result[resultOffset + i] = lhs[lhsOffset + i] - k * rhs[rhsOffset + i]; } }
Example 3
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Perform remainder of two derivative structures. * @param lhs array holding left hand side of remainder * @param lhsOffset offset of the left hand side in its array * @param rhs array right hand side of remainder * @param rhsOffset offset of the right hand side in its array * @param result array where result must be stored (it may be * one of the input arrays) * @param resultOffset offset of the result in its array */ public void remainder(final double[] lhs, final int lhsOffset, final double[] rhs, final int rhsOffset, final double[] result, final int resultOffset) { // compute k such that lhs % rhs = lhs - k rhs final double rem = FastMath.IEEEremainder(lhs[lhsOffset], rhs[rhsOffset]); final double k = FastMath.rint((lhs[lhsOffset] - rem) / rhs[rhsOffset]); // set up value result[resultOffset] = rem; // set up partial derivatives for (int i = 1; i < getSize(); ++i) { result[resultOffset + i] = lhs[lhsOffset + i] - k * rhs[rhsOffset + i]; } }
Example 4
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Perform remainder of two derivative structures. * @param lhs array holding left hand side of remainder * @param lhsOffset offset of the left hand side in its array * @param rhs array right hand side of remainder * @param rhsOffset offset of the right hand side in its array * @param result array where result must be stored (it may be * one of the input arrays) * @param resultOffset offset of the result in its array */ public void remainder(final double[] lhs, final int lhsOffset, final double[] rhs, final int rhsOffset, final double[] result, final int resultOffset) { // compute k such that lhs % rhs = lhs - k rhs final double rem = FastMath.IEEEremainder(lhs[lhsOffset], rhs[rhsOffset]); final double k = FastMath.rint((lhs[lhsOffset] - rem) / rhs[rhsOffset]); // set up value result[resultOffset] = rem; // set up partial derivatives for (int i = 1; i < getSize(); ++i) { result[resultOffset + i] = lhs[lhsOffset + i] - k * rhs[rhsOffset + i]; } }
Example 5
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Perform remainder of two derivative structures. * @param lhs array holding left hand side of remainder * @param lhsOffset offset of the left hand side in its array * @param rhs array right hand side of remainder * @param rhsOffset offset of the right hand side in its array * @param result array where result must be stored (it may be * one of the input arrays) * @param resultOffset offset of the result in its array */ public void remainder(final double[] lhs, final int lhsOffset, final double[] rhs, final int rhsOffset, final double[] result, final int resultOffset) { // compute k such that lhs % rhs = lhs - k rhs final double rem = FastMath.IEEEremainder(lhs[lhsOffset], rhs[rhsOffset]); final double k = FastMath.rint((lhs[lhsOffset] - rem) / rhs[rhsOffset]); // set up value result[resultOffset] = rem; // set up partial derivatives for (int i = 1; i < getSize(); ++i) { result[resultOffset + i] = lhs[lhsOffset + i] - k * rhs[rhsOffset + i]; } }
Example 6
Source File: SparseGradient.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public SparseGradient remainder(final double a) { return new SparseGradient(FastMath.IEEEremainder(value, a), derivatives); }
Example 7
Source File: DerivativeStructure.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public DerivativeStructure remainder(final double a) { final DerivativeStructure ds = new DerivativeStructure(this); ds.data[0] = FastMath.IEEEremainder(ds.data[0], a); return ds; }
Example 8
Source File: DerivativeStructure.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public DerivativeStructure remainder(final double a) { final DerivativeStructure ds = new DerivativeStructure(this); ds.data[0] = FastMath.IEEEremainder(ds.data[0], a); return ds; }
Example 9
Source File: DerivativeStructure.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public DerivativeStructure remainder(final double a) { final DerivativeStructure ds = new DerivativeStructure(this); ds.data[0] = FastMath.IEEEremainder(ds.data[0], a); return ds; }
Example 10
Source File: DerivativeStructure.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public DerivativeStructure remainder(final double a) { final DerivativeStructure ds = new DerivativeStructure(this); ds.data[0] = FastMath.IEEEremainder(ds.data[0], a); return ds; }
Example 11
Source File: SparseGradient.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public SparseGradient remainder(final double a) { return new SparseGradient(FastMath.IEEEremainder(value, a), derivatives); }
Example 12
Source File: DerivativeStructure.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public DerivativeStructure remainder(final double a) { final DerivativeStructure ds = new DerivativeStructure(this); ds.data[0] = FastMath.IEEEremainder(ds.data[0], a); return ds; }
Example 13
Source File: SparseGradient.java From astor with GNU General Public License v2.0 | 3 votes |
/** {@inheritDoc} */ public SparseGradient remainder(final SparseGradient a) { // compute k such that lhs % rhs = lhs - k rhs final double rem = FastMath.IEEEremainder(value, a.value); final double k = FastMath.rint((value - rem) / a.value); return subtract(a.multiply(k)); }
Example 14
Source File: SparseGradient.java From astor with GNU General Public License v2.0 | 3 votes |
/** {@inheritDoc} */ public SparseGradient remainder(final SparseGradient a) { // compute k such that lhs % rhs = lhs - k rhs final double rem = FastMath.IEEEremainder(value, a.value); final double k = FastMath.rint((value - rem) / a.value); return subtract(a.multiply(k)); }