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


Java LocalizedFormats.TOO_LARGE_CUTOFF_SINGULAR_VALUE属性代码示例

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


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

示例1: getCovariance

/**
 * Returns the n × n covariance matrix.
 * <p>The covariance matrix is V &times; J &times; V<sup>T</sup>
 * where J is the diagonal matrix of the inverse of the squares of
 * the singular values.</p>
 * @param minSingularValue value below which singular values are ignored
 * (a 0 or negative value implies all singular value will be used)
 * @return covariance matrix
 * @exception IllegalArgumentException if minSingularValue is larger than
 * the largest singular value, meaning all singular values are ignored
 */
public RealMatrix getCovariance(final double minSingularValue) {
    // get the number of singular values to consider
    final int p = singularValues.length;
    int dimension = 0;
    while (dimension < p &&
           singularValues[dimension] >= minSingularValue) {
        ++dimension;
    }

    if (dimension == 0) {
        throw new NumberIsTooLargeException(LocalizedFormats.TOO_LARGE_CUTOFF_SINGULAR_VALUE,
                                            minSingularValue, singularValues[0], true);
    }

    final double[][] data = new double[dimension][p];
    getVT().walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {
        /** {@inheritDoc} */
        @Override
        public void visit(final int row, final int column,
                final double value) {
            data[row][column] = value / singularValues[row];
        }
    }, 0, dimension - 1, 0, p - 1);

    RealMatrix jv = new Array2DRowRealMatrix(data, false);
    return jv.transpose().multiply(jv);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:38,代码来源:SingularValueDecomposition.java


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