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


Java DoubleMatrix1D.aggregate方法代码示例

本文整理汇总了Java中cern.colt.matrix.DoubleMatrix1D.aggregate方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleMatrix1D.aggregate方法的具体用法?Java DoubleMatrix1D.aggregate怎么用?Java DoubleMatrix1D.aggregate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cern.colt.matrix.DoubleMatrix1D的用法示例。


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

示例1: normalizePuz

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
/**
 * Normalizes matrix of p(z|u) such that \forall_u: \sum_z p(z|u) = 1.
 *
 * @param pu_z normalized matrix of p(z|u)
 */
@Override
protected void normalizePuz(DoubleMatrix2D pu_z) {
    for (int u = 0; u < pu_z.rows(); u++) {
        DoubleMatrix1D tmp = pu_z.viewRow(u);
        double norm = tmp.aggregate(Functions.plus, Functions.identity);
        if (norm != 0.0) {
            tmp.assign(Functions.mult(1 / norm));
        }
    }
}
 
开发者ID:RankSys,项目名称:RankSys,代码行数:16,代码来源:CPLSAIAFactorizationModelFactory.java

示例2: normalizePiz

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
/**
 * Normalizes matrix of p(i|z) such that \forall_z: \sum_i p(i|z) = 1.
 *
 * @param piz normalized matrix of p(i|z)
 */
@Override
protected void normalizePiz(DoubleMatrix2D piz) {
    for (int i = 0; i < piz.columns(); i++) {
        DoubleMatrix1D tmp = piz.viewColumn(i);
        double norm = tmp.aggregate(Functions.plus, Functions.identity);
        if (norm != 0.0) {
            tmp.assign(Functions.mult(1 / norm));
        }
    }
}
 
开发者ID:RankSys,项目名称:RankSys,代码行数:16,代码来源:CPLSAIAFactorizationModelFactory.java

示例3: log_sum_exp

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
public static double log_sum_exp(DoubleMatrix1D exponents) {
  double maxExp = exponents.aggregate(Functions.max, Functions.identity);
  if (maxExp == Double.NEGATIVE_INFINITY) {
    return Double.NEGATIVE_INFINITY;
  }
  else {
    double expSum = exponents.aggregate(Functions.plus, Functions.chain(Functions.exp, Functions.minus(maxExp)));
    return maxExp + Math.log(expSum);
  }
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:11,代码来源:Numerical.java

示例4: matrixMax

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
public static double matrixMax(DoubleMatrix1D mat) {
  return mat.aggregate(Functions.max, Functions.identity);
}
 
开发者ID:shaunmahony,项目名称:multigps-archive,代码行数:4,代码来源:ChipSeqAnalysisUtils.java

示例5: calculate

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
@Override
public double calculate(final double[] parameters) {
    // 20 fitness values
    DoubleMatrix1D f = DoubleFactory1D.dense.make(20);

    // 19 parameters are estimated, passed in parameters[]
    for (int i = 0; i < parameters.length; i++) f.setQuick(i, parameters[i]);

    // One is fixed
    f.setQuick(19, Constants.FITNESS_FIXED_FOR_RELATIVE);

    double mean = f.zSum() / 20.0;
    f.assign(Functions.minus(mean));
    return -coefficient * f.aggregate(Functions.plus, Functions.pow(2.0));
}
 
开发者ID:tamuri,项目名称:swmutsel,代码行数:16,代码来源:MVNPenalty.java

示例6: calculate

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
@Override
public double calculate(final double[] fitness) {
    DoubleMatrix1D theta = DoubleFactory1D.dense.make(fitness);
    theta.assign(Functions.exp);
    theta.assign(Functions.div(1 + theta.zSum()));


    // original:
    return ((alpha - 1) * theta.aggregate(Functions.plus, Functions.log))
            + ((alpha - 1) * Math.log(1 - theta.zSum()))
            + Math.log(Math.abs(Algebra.DEFAULT.det(jacobian(theta))));

}
 
开发者ID:tamuri,项目名称:swmutsel,代码行数:14,代码来源:DirichletPenalty.java

示例7: calculateMdR

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
private double calculateMdR(final double[] fitness) {
    DoubleMatrix1D theta = DoubleFactory1D.dense.make(20, 0.0);
    for (int i = 0; i < fitness.length; i++) theta.setQuick(i, fitness[i]);

    theta.assign(Functions.exp);
    theta.assign(Functions.div(theta.zSum()));

    return alpha * theta.aggregate(Functions.plus, Functions.log);
}
 
开发者ID:tamuri,项目名称:swmutsel,代码行数:10,代码来源:DirichletPenalty.java

示例8: normInfinity

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
/**
 * Returns the infinity norm of vector <tt>x</tt>, which is <tt>Max(abs(x[i]))</tt>.
 */
public double normInfinity(DoubleMatrix1D x) {
	// fix for bug reported by [email protected]
	if (x.size()==0) return 0;
	return x.aggregate(cern.jet.math.Functions.max ,cern.jet.math.Functions.abs);
//	if (x.size()==0) return 0;
//	return x.aggregate(cern.jet.math.Functions.plus,cern.jet.math.Functions.abs);
//	double max = 0;
//	for (int i = x.size(); --i >= 0; ) {
//		max = Math.max(max, x.getQuick(i));
//	}
//	return max;
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:16,代码来源:Algebra.java

示例9: apply

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
public final double apply(DoubleMatrix1D a, DoubleMatrix1D b) {	
	return a.aggregate(b, F.plus, F.chain(F.abs,F.minus)) / a.aggregate(b, F.plus, F.plus);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:4,代码来源:Statistic.java

示例10: norm1

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
/**
 * Returns the one-norm of vector <tt>x</tt>, which is <tt>Sum(abs(x[i]))</tt>.
 */
public double norm1(DoubleMatrix1D x) {
	if (x.size()==0) return 0;
	return x.aggregate(cern.jet.math.Functions.plus,cern.jet.math.Functions.abs);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:8,代码来源:Algebra.java

示例11: dasum

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
public double dasum(DoubleMatrix1D x) {
	return x.aggregate(F.plus, F.abs);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:4,代码来源:SeqBlas.java


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