本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR属性的具体用法?Java LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR怎么用?Java LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: normalize
/** {@inheritDoc} */
public Vector1D normalize() throws MathArithmeticException {
double s = getNorm();
if (s == 0) {
throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
}
return scalarMultiply(1 / s);
}
示例2: normalize
/** Get a normalized vector aligned with the instance.
* @return a new normalized vector
* @exception MathArithmeticException if the norm is zero
*/
public FieldVector3D<T> normalize() throws MathArithmeticException {
final T s = getNorm();
if (s.getReal() == 0) {
throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
}
return scalarMultiply(s.reciprocal());
}
示例3: normalize
/** {@inheritDoc} */
public Vector3D normalize() throws MathArithmeticException {
double s = getNorm();
if (s == 0) {
throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
}
return scalarMultiply(1 / s);
}
示例4: normalize
/** {@inheritDoc} */
public Vector2D normalize() throws MathArithmeticException {
double s = getNorm();
if (s == 0) {
throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
}
return scalarMultiply(1 / s);
}