• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DoubleMatrix1D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testBuildMatrix4

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
@Test
public final void testBuildMatrix4()
{
	LearnerGraph gr=buildLearnerGraph("A-a->B\nA-b->C\nD-a->C",	"testBuildMatrix4",config,converter);
	final int size =4*5/2; 
	DoubleMatrix2D matrix=createIdentity(size);
	DoubleMatrix1D row=DoubleFactory1D.dense.make(size, 0);
	matrix.setQuick(2, 2, 1);matrix.setQuick(4, 4, 1);matrix.setQuick(5, 5, 1);// pairs with zero total outgoing transitions.
	matrix.setQuick(0, 0, 2*2);matrix.setQuick(0, 2, -k);matrix.setQuick(0, 5, -k);row.setQuick(0, 2);
	matrix.setQuick(1, 1, 2*2);
	matrix.setQuick(3, 3, 2*2);
	matrix.setQuick(6, 6, 2*2);

	matrix.setQuick(9, 5, -k);row.setQuick(9, 1);
	matrix.setQuick(6, 4, -k);row.setQuick(6, 1);
			
	checkBuildMatrix(gr,matrix,row);
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:19,代码来源:TestMatrixComputationWithMultipleThreads.java


示例2: testBuildMatrix5

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
@Test
public final void testBuildMatrix5()
{
	LearnerGraph gr=buildLearnerGraph("A-a->B\nA-b->C\nD-a->C\nD-b->C","testBuildMatrix5",config,converter);
	final int size =4*5/2; 
	DoubleMatrix2D matrix=createIdentity(size);
	DoubleMatrix1D row=DoubleFactory1D.dense.make(size, 0);
	matrix.setQuick(2, 2, 1);matrix.setQuick(4, 4, 1);matrix.setQuick(5, 5, 1);// pairs with zero total outgoing transitions.
	matrix.setQuick(0, 0, 2*2);matrix.setQuick(0, 2, -k);matrix.setQuick(0, 5, -k);row.setQuick(0, 2);
	matrix.setQuick(1, 1, 2*2);
	matrix.setQuick(3, 3, 2*2);
	matrix.setQuick(6, 6, 2*2);

	matrix.setQuick(9, 5, -2*k);row.setQuick(9, 2);
	matrix.setQuick(6, 4, -k);matrix.setQuick(6, 5, -k);row.setQuick(6, 2);
	matrix.setQuick(9, 9, 2*2);
	matrix.setQuick(8, 8, 2*2);
	matrix.setQuick(7, 7, 2*2);
	matrix.setQuick(6, 6, 2*2);
	
	checkBuildMatrix(gr,matrix,row);
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:23,代码来源:TestMatrixComputationWithMultipleThreads.java


示例3: testBuildMatrix6

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
@Test
public final void testBuildMatrix6()
{
	LearnerGraph gr=buildLearnerGraph("A-a->B\nA-b->C\nD-a->C\nD-b->C\nD-c->A","testBuildMatrix6",config,converter);
	final int size =4*5/2; 
	DoubleMatrix2D matrix=createIdentity(size);
	DoubleMatrix1D row=DoubleFactory1D.dense.make(size, 0);
	matrix.setQuick(2, 2, 1);matrix.setQuick(4, 4, 1);matrix.setQuick(5, 5, 1);// pairs with zero total outgoing transitions.
	matrix.setQuick(0, 0, 2*2);matrix.setQuick(0, 2, -k);matrix.setQuick(0, 5, -k);row.setQuick(0, 2);
	matrix.setQuick(1, 1, 2*2);
	matrix.setQuick(3, 3, 2*2);
	matrix.setQuick(6, 6, 2*2);

	matrix.setQuick(9, 5, -2*k);matrix.setQuick(9, 0, -k);row.setQuick(9, 3);
	matrix.setQuick(6, 4, -k);matrix.setQuick(6, 5, -k);row.setQuick(6, 2);
	matrix.setQuick(9, 9, 3*2);
	matrix.setQuick(8, 8, 3*2);
	matrix.setQuick(7, 7, 3*2);
	matrix.setQuick(6, 6, 3*2);
	
	checkBuildMatrix(gr,matrix,row);
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:23,代码来源:TestMatrixComputationWithMultipleThreads.java


示例4: testBuildMatrix7

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
@Test
public final void testBuildMatrix7()
{
	LearnerGraph gr=buildLearnerGraph("A-a->B\nA-b->C\nA-c->C\nD-a->C\nD-b->C\nD-c->A","testBuildMatrix7",config,converter);

	final int size =4*5/2; 
	DoubleMatrix2D matrix=createIdentity(size);
	DoubleMatrix1D row=DoubleFactory1D.dense.make(size, 0);
	matrix.setQuick(2, 2, 1);matrix.setQuick(4, 4, 1);matrix.setQuick(5, 5, 1);// pairs with zero total outgoing transitions.
	matrix.setQuick(0, 0, 3*2);matrix.setQuick(0, 2, -k);matrix.setQuick(0, 5, -2*k);row.setQuick(0, 3);
	matrix.setQuick(1, 1, 3*2);
	matrix.setQuick(3, 3, 3*2);
	matrix.setQuick(6, 6, 3*2);

	matrix.setQuick(9, 5, -2*k);matrix.setQuick(9, 0, -k);row.setQuick(9, 3);
	matrix.setQuick(6, 4, -k);matrix.setQuick(6, 5, -k);matrix.setQuick(6, 3, -k);row.setQuick(6, 3);
	matrix.setQuick(9, 9, 3*2);
	matrix.setQuick(8, 8, 3*2);
	matrix.setQuick(7, 7, 3*2);
	matrix.setQuick(6, 6, 3*2);
	
	checkBuildMatrix(gr,matrix,row);
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:24,代码来源:TestMatrixComputationWithMultipleThreads.java


示例5: testBuildMatrix8

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
@Test
public final void testBuildMatrix8()
{
	LearnerGraph gr=buildLearnerGraph("A-a->B\nA-b->C\nA-c->C\nD-a->C\nD-b->C\nD-d->C\nD-c->A","testBuildMatrix8",config,converter);

	final int size =4*5/2; 
	DoubleMatrix2D matrix=createIdentity(size);
	DoubleMatrix1D row=DoubleFactory1D.dense.make(size, 0);
	matrix.setQuick(2, 2, 1);matrix.setQuick(4, 4, 1);matrix.setQuick(5, 5, 1);// pairs with zero total outgoing transitions.
	matrix.setQuick(0, 0, 3*2);matrix.setQuick(0, 2, -k);matrix.setQuick(0, 5, -2*k);row.setQuick(0, 3);
	matrix.setQuick(1, 1, 3*2);
	matrix.setQuick(3, 3, 3*2);
	matrix.setQuick(6, 6, 3*2);

	matrix.setQuick(9, 5, -3*k);matrix.setQuick(9, 0, -k);row.setQuick(9, 4);
	matrix.setQuick(6, 4, -k);matrix.setQuick(6, 5, -k);matrix.setQuick(6, 3, -k);row.setQuick(6, 3);
	matrix.setQuick(9, 9, 4*2);
	matrix.setQuick(8, 8, 4*2);
	matrix.setQuick(7, 7, 4*2);
	matrix.setQuick(6, 6, 4*2);
	
	checkBuildMatrix(gr,matrix,row);
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:24,代码来源:TestMatrixComputationWithMultipleThreads.java


示例6: Mult

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
static DoubleMatrix1D Mult(DoubleMatrix2D M, DoubleMatrix1D y, DoubleMatrix1D z, double alpha, double beta, boolean transposeA, EdgeGenerator edgeGen) {
    // z = alpha * A * y + beta*z
    for (int i = 0; i < z.size(); z.set(i,z.get(i)*beta),i++);
    for (int j = 0; j < M.columns(); j++) {
        for (int i = (edgeGen==null)?j:edgeGen.first(j); i < M.rows(); i = (edgeGen==null)?i+1:edgeGen.next(j,i)) {
            int r = i;
            int c = j;
            if (transposeA) {
                r = j;
                c = i;
            }
            z.set(r, z.getQuick(r) + M.getQuick(i,j)*y.getQuick(c)*alpha);
        }
    }
    return z;
}
 
开发者ID:fauconnier,项目名称:LaToe,代码行数:17,代码来源:RobustMath.java


示例7: allocateCacheArray

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
private void allocateCacheArray(DataSequence dataSeq) {
    int i = -1, seqLength = dataSeq.length(), ell;
    Iter iter = getIter();
    Mis = new LogSparseDoubleMatrix2D[seqLength][];
    Ris = new LogSparseDoubleMatrix1D[seqLength][];
    int size = 0, maxEll = 0;
    staticHeapMi.reset();
    staticHeapRi.reset();
    for(i++; i < seqLength; i++){
        iter.start(i, dataSeq);
        while((ell = iter.nextEll(i)) > 0 )
            maxEll = (maxEll < ell) ? ell : maxEll;
        size = (i < maxEll ? i+1: maxEll);
        Mis[i] = new LogSparseDoubleMatrix2D[size + 1];
        Ris[i] = new LogSparseDoubleMatrix1D[size + 1];            
        for(int j = 0; j < Mis[i].length; j++){
            Mis[i][j] =  (DoubleMatrix2D) staticHeapMi.getObject(); //new LogSparseDoubleMatrix2D(numY,numY);
            Ris[i][j] =  (DoubleMatrix1D) staticHeapRi.getObject(); //new LogSparseDoubleMatrix1D(numY);
        }
    }
}
 
开发者ID:fauconnier,项目名称:LaToe,代码行数:22,代码来源:SparseViterbi.java


示例8: MetaPathInstanceCnt

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
public MetaPathInstanceCnt(MetaPath metaPath,List<List<DoubleMatrix1D>> interMats) {
	this.metaPath = metaPath;
	this.interMats = interMats;
	doc_num = interMats.get(0).size();
	
	label_map = new HashMap<Integer, Integer>();
	Set<String> types = new HashSet<String>();
	int cnt = 0;
	for(int i = 0; i < metaPath.path.size(); i++)
	{
		String type = metaPath.path.get(i);
		if (!types.contains(type))
		{
			types.add(type);
			label_map.put(i, cnt);
			cnt ++;
		} else {
			for (int j = 0; j < i; j++)
				if (metaPath.path.get(j).equals(type))
				{
					label_map.put(i, label_map.get(j));
					break;
				}
		}
	}	
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:27,代码来源:MetaPathInstanceCnt.java


示例9: getVertexNum

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
public static int getVertexNum(List<List<DoubleMatrix1D>> interMats, boolean self_cycle, Map<Integer, Integer> label_map)
{
	int num = 0;
	Set<Integer> visited = new HashSet<Integer>();
	for (int i = 0; i < interMats.size(); i++)
	{
		int idx = label_map.get(i);
		if (! visited.contains(idx)){
			num += interMats.get(i).size();
			visited.add(idx);
		}
	}
	if (!self_cycle)
	{
		num += interMats.get(interMats.size() - 1).get(0).size();
	}
	return num;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:19,代码来源:GraphPrune.java


示例10: matrixSum

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
static public DoubleMatrix1D matrixSum (List<DoubleMatrix1D> mat, int dim) {
	DenseDoubleMatrix1D maxVector = null;
	if (dim == 2) { // row sum valuse
		maxVector = new ColtDenseVector(mat.size());
	} else if(dim == 1) { // column sum value
		maxVector = new ColtDenseVector(mat.get(0).size());
	}
	
	for (int i = 0; i < mat.size(); ++i) {
		for (int j = 0; j < mat.get(i).size(); ++j) {
			if (dim == 2) {
				maxVector.setQuick(i, maxVector.getQuick(i) + mat.get(i).getQuick(j));
			} else if (dim == 1) {
				maxVector.setQuick(j, maxVector.getQuick(j) + mat.get(i).getQuick(j));
			}
		}
	}
	return maxVector;		
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:20,代码来源:Matrix2DUtil.java


示例11: SparseMultSparseTranspose

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
static public List<DoubleMatrix1D> SparseMultSparseTranspose(List<DoubleMatrix1D> A,
		List<DoubleMatrix1D> B) {
	int m = A.size();
	int n = A.get(0).size();
	int p = B.size();
	List<DoubleMatrix1D> C = null;
	if (C==null) {
		C = new ArrayList<DoubleMatrix1D>();
		for (int i = 0; i < m; ++i) {
			C.add(new ColtSparseVector(p));
		}
	}
	if (B.get(0).size() != n)
		throw new IllegalArgumentException("Matrix2D inner dimensions must agree.");
	for (int i = 0; i < m; ++i) {
		IntArrayList indexList = new IntArrayList();
		DoubleArrayList valueList = new DoubleArrayList();
		A.get(i).getNonZeros(indexList, valueList);
		for (int j = 0; j < p; ++j) {
			if (B.get(j).size() != A.get(i).size())
				throw new IllegalArgumentException("Matrix2D inner dimensions must agree.");
			double sum = 0.0;
			for (int k = 0; k < indexList.size(); ++k) {
				int index = indexList.get(k);
				double value1 = valueList.get(k);
				double value2 = B.get(j).getQuick(index); 
				if (value1 != 0 || value2 != 0) { 
					sum += value1 * value2;
				}
			}
			C.get(i).setQuick(j, sum);
		}	
	}
	return C;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:36,代码来源:Matrix2DUtil.java


示例12: SparseTransposeMultSparse

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
static public List<DoubleMatrix1D> SparseTransposeMultSparse(List<DoubleMatrix1D> A,
			List<DoubleMatrix1D> B) {
//		List<DoubleMatrix1D> AT = new ArrayList<DoubleMatrix1D>();
//		for (int i = 0; i < A.get(0).size(); ++i) {
//			AT.add(new ColtSparseVector(A.size()));
//		}
//		for (int i = 0; i < A.size(); ++i) {
//			IntArrayList indexList = new IntArrayList();
//			DoubleArrayList valueList = new DoubleArrayList();
//			A.get(i).getNonZeros(indexList, valueList);
//			for (int k = 0; k < indexList.size(); ++k) {
//				int index = indexList.get(k);
//				double value = valueList.get(k);
//				AT.get(index).set(i, value);
//			}
//		}
		List<DoubleMatrix1D> AT = getSparseTranspose(A);
		List<DoubleMatrix1D> C = SparseMultSparse(AT, B);
		AT = null;
		return C;
	}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:22,代码来源:Matrix2DUtil.java


示例13: getSparseTranspose

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
static public List<DoubleMatrix1D> getSparseTranspose(List<DoubleMatrix1D> A) {
	List<DoubleMatrix1D> AT = new ArrayList<DoubleMatrix1D>();
	for (int i = 0; i < A.get(0).size(); ++i) {
		AT.add(new ColtSparseVector(A.size()));
	}
	for (int i = 0; i < A.size(); ++i) {
		IntArrayList indexList = new IntArrayList();
		DoubleArrayList valueList = new DoubleArrayList();
		A.get(i).getNonZeros(indexList, valueList);
		for (int k = 0; k < indexList.size(); ++k) {
			int index = indexList.get(k);
			double value = valueList.get(k);
			AT.get(index).set(i, value);
		}
	}
	return AT;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:18,代码来源:Matrix2DUtil.java


示例14: productQuick

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
static public double productQuick(DoubleMatrix1D v1, DoubleMatrix1D v2) {
		IntArrayList indexList = new IntArrayList();
		DoubleArrayList valueList = new DoubleArrayList();
		v1.getNonZeros(indexList, valueList);
		double prod = 0.0;
		for (int i = 0; i < indexList.size(); ++i) {
			double temp = v2.getQuick(indexList.getQuick(i));
			if (temp != 0.0) {
				prod += valueList.getQuick(i) * temp;
			}
		}

//		for (int i = 0; i < v1.size(); ++i) {
//			double temp1 = v1.getQuick(i);
//			double temp2 = v2.getQuick(i);
//			if (temp1 != 0.0 || temp2 != 0.0) {
//				prod += temp1 * temp2;
//			}
//		}
		return prod;
	}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:22,代码来源:Matrix2DUtil.java


示例15: computeCosineSimilarity

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
public static double computeCosineSimilarity(IntArrayList indexA, DoubleArrayList valueA, DoubleMatrix1D B, DoubleArrayList valueB)
{
	double sim = -1;
	
	double num = 0;
	double den = 0;
	double den_1 = 0;
	double den_2 = 0;

	num = Matrix2DUtil.productQuick(indexA, valueA, B);
	den_1 = Matrix2DUtil.getSqrSum(valueA);
	den_2 = Matrix2DUtil.getSqrSum(valueB);
	den = Math.sqrt(den_1) * Math.sqrt(den_2);
	if(den == 0)
		return 0;
	sim = num/den;
	return sim;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:19,代码来源:SimilarityMeasures.java


示例16: computeJaccardSimilarity

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
public static double computeJaccardSimilarity(DoubleMatrix1D a, DoubleMatrix1D b)
{
	double sim = -1;
	if(a.size() != b.size())
		return sim;
	double num = 0;
	double den = 0;
	num = Matrix2DUtil.productQuick(a, b);
	den = Matrix2DUtil.getSqrSum(a) + Matrix2DUtil.getSqrSum(b);
	

	if((den-num) == 0)
		return 0;
	sim = num/(den - num);
	return sim;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:17,代码来源:SimilarityMeasures.java


示例17: computeMetaPath

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
public static double[][] computeMetaPath(List<double[][]> interMats)
{
	int length = interMats.size();
	List<List<DoubleMatrix1D>> mats = new ArrayList<List<DoubleMatrix1D>>(); 
	for (int i = 0; i < length; i++)
	{
		mats.add(array2mat(interMats.get(i)));
	}
	List<DoubleMatrix1D> M, ans;
	M = mats.get(0);
	for (int i = 1; i < length; i++)
		M = Matrix2DUtil.DenseMultDense(M, mats.get(i));
	ans = Matrix2DUtil.DenseMultDenseTranspose(M, M);
	double[][] ret = new double[ans.size()][ans.get(0).size()];
	for (int i = 0; i < ans.size(); i++)
	{
		for (int j = 0; j < ans.get(i).size(); j++)
			ret[i][j] = ans.get(i).getQuick(j);
	}
	return ret;
	
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:23,代码来源:SimilarityMeasures.java


示例18: regress

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
public LeastSquaresRegressionResult regress(final double[][] x, final double[] weights, final double[] y, final boolean useIntercept) {
  if (weights == null) {
    throw new IllegalArgumentException("Cannot perform WLS regression without an array of weights");
  }
  checkData(x, weights, y);
  final double[][] dep = addInterceptVariable(x, useIntercept);
  final double[] indep = new double[y.length];
  final double[] w = new double[weights.length];
  for (int i = 0; i < y.length; i++) {
    indep[i] = y[i];
    w[i] = weights[i];
  }
  final DoubleMatrix2D matrix = DoubleFactory2D.dense.make(dep);
  final DoubleMatrix1D vector = DoubleFactory1D.dense.make(indep);
  final DoubleMatrix2D wDiag = DoubleFactory2D.sparse.diagonal(DoubleFactory1D.dense.make(w));
  final DoubleMatrix2D transpose = _algebra.transpose(matrix);
  final DoubleMatrix1D betasVector =
      _algebra.mult(_algebra.mult(_algebra.mult(_algebra.inverse(_algebra.mult(transpose, _algebra.mult(wDiag, matrix))), transpose), wDiag), vector);
  final double[] yModel = convertArray(_algebra.mult(matrix, betasVector).toArray());
  final double[] betas = convertArray(betasVector.toArray());
  return getResultWithStatistics(x, convertArray(wDiag.toArray()), y, betas, yModel, transpose, matrix, useIntercept);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:23,代码来源:WeightedLeastSquaresRegression.java


示例19: regress

import cern.colt.matrix.DoubleMatrix1D; //导入依赖的package包/类
@Override
public LeastSquaresRegressionResult regress(final double[][] x, final double[][] weights, final double[] y, final boolean useIntercept) {
  if (weights == null) {
    throw new IllegalArgumentException("Cannot perform GLS regression without an array of weights");
  }
  checkData(x, weights, y);
  final double[][] dep = addInterceptVariable(x, useIntercept);
  final double[] indep = new double[y.length];
  final double[][] wArray = new double[y.length][y.length];
  for (int i = 0; i < y.length; i++) {
    indep[i] = y[i];
    for (int j = 0; j < y.length; j++) {
      wArray[i][j] = weights[i][j];
    }
  }
  final DoubleMatrix2D matrix = DoubleFactory2D.dense.make(dep);
  final DoubleMatrix1D vector = DoubleFactory1D.dense.make(indep);
  final DoubleMatrix2D w = DoubleFactory2D.dense.make(wArray);
  final DoubleMatrix2D transpose = _algebra.transpose(matrix);
  final DoubleMatrix1D betasVector = _algebra.mult(_algebra.mult(_algebra.mult(_algebra.inverse(_algebra.mult(transpose, _algebra.mult(w, matrix))), transpose), w), vector);
  final double[] yModel = convertArray(_algebra.mult(matrix, betasVector).toArray());
  final double[] betas = convertArray(betasVector.toArray());
  return getResultWithStatistics(x, y, betas, yModel, useIntercept);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:25,代码来源:GeneralizedLeastSquaresRegression.java


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LocalTransaction类代码示例发布时间:2022-05-21
下一篇:
Java YarnRPC类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap