本文整理匯總了Java中org.apache.commons.math3.util.FastMath.IEEEremainder方法的典型用法代碼示例。如果您正苦於以下問題:Java FastMath.IEEEremainder方法的具體用法?Java FastMath.IEEEremainder怎麽用?Java FastMath.IEEEremainder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.util.FastMath
的用法示例。
在下文中一共展示了FastMath.IEEEremainder方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: remainder
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** 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];
}
}
示例2: remainder
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public SparseGradient remainder(final double a) {
return new SparseGradient(FastMath.IEEEremainder(value, a), derivatives);
}
示例3: remainder
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public DerivativeStructure remainder(final double a) {
final DerivativeStructure ds = new DerivativeStructure(this);
ds.data[0] = FastMath.IEEEremainder(ds.data[0], a);
return ds;
}