当前位置: 首页>>代码示例>>Java>>正文


Java LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX属性代码示例

本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX属性的具体用法?Java LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX怎么用?Java LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.exception.util.LocalizedFormats的用法示例。


在下文中一共展示了LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReal

/**
 * Get the real part of the {@code k}-th {@code n}-th root of unity.
 *
 * @param k index of the {@code n}-th root of unity
 * @return real part of the {@code k}-th {@code n}-th root of unity
 * @throws MathIllegalStateException if no roots of unity have been
 * computed yet
 * @throws MathIllegalArgumentException if {@code k} is out of range
 */
public synchronized double getReal(int k)
        throws MathIllegalStateException, MathIllegalArgumentException {

    if (omegaCount == 0) {
        throw new MathIllegalStateException(
                LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET);
    }
    if ((k < 0) || (k >= omegaCount)) {
        throw new OutOfRangeException(
                LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX,
                Integer.valueOf(k),
                Integer.valueOf(0),
                Integer.valueOf(omegaCount - 1));
    }

    return omegaReal[k];
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:26,代码来源:RootsOfUnity.java

示例2: getImaginary

/**
 * Get the imaginary part of the {@code k}-th {@code n}-th root of unity.
 *
 * @param k index of the {@code n}-th root of unity
 * @return imaginary part of the {@code k}-th {@code n}-th root of unity
 * @throws MathIllegalStateException if no roots of unity have been
 * computed yet
 * @throws OutOfRangeException if {@code k} is out of range
 */
public synchronized double getImaginary(int k)
        throws MathIllegalStateException, OutOfRangeException {

    if (omegaCount == 0) {
        throw new MathIllegalStateException(
                LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET);
    }
    if ((k < 0) || (k >= omegaCount)) {
        throw new OutOfRangeException(
                LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX,
                Integer.valueOf(k),
                Integer.valueOf(0),
                Integer.valueOf(omegaCount - 1));
    }

    return isCounterClockWise ? omegaImaginaryCounterClockwise[k] :
        omegaImaginaryClockwise[k];
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:27,代码来源:RootsOfUnity.java


注:本文中的org.apache.commons.math3.exception.util.LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。