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


Java DoubleMatrix1D.zDotProduct方法代码示例

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


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

示例1: the

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
/** 
Generates and returns the (economy-sized) orthogonal factor <tt>Q</tt>.
@return <tt>Q</tt>
*/
public DoubleMatrix2D getQ () {
	cern.jet.math.Functions F = cern.jet.math.Functions.functions;
	DoubleMatrix2D Q = QR.like();
	//double[][] Q = X.getArray();
	for (int k = n-1; k >= 0; k--) {
		DoubleMatrix1D QRcolk = QR.viewColumn(k).viewPart(k,m-k);
		Q.setQuick(k,k, 1);
		for (int j = k; j < n; j++) {
			if (QR.getQuick(k,k) != 0) {
				DoubleMatrix1D Qcolj = Q.viewColumn(j).viewPart(k,m-k);
				double s = QRcolk.zDotProduct(Qcolj);
				s = -s / QR.getQuick(k,k);
				Qcolj.assign(QRcolk, F.plusMult(s));
			}
		}
	}
	return Q;
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:23,代码来源:QRDecomposition.java

示例2: computeEuclidean

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
private double computeEuclidean(DoubleMatrix1D v1, DoubleMatrix1D v2) {
	assert(v1.size() == v2.size());
	
	double norm1 = v1.zDotProduct(v1);
	double norm2 = v2.zDotProduct(v2);
	double dot = v1.zDotProduct(v2);
			
	return Math.sqrt(norm1 + norm2 - 2 * dot);
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:10,代码来源:MutualInformationMST.java

示例3: computeSpecialEuclidean

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
private double computeSpecialEuclidean(DoubleMatrix1D v1, DoubleMatrix1D v2) {
	assert(v1.size() == v2.size());
	
	double norm1 = v1.zDotProduct(v1);
	double norm2 = v2.zDotProduct(v2);
	double dot = v1.zDotProduct(v2);
			
	return (1 - dot / ( Math.sqrt(norm1 * norm2) + Double.MIN_VALUE ) );
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:10,代码来源:MutualInformationMST.java

示例4: laplacianScore

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
public int[] laplacianScore(int numK, String type, double[] weights) {
		if (this.fMat == null) {
			logger.warning("No feature loaded");
			return null;
		}
		System.out.println("computeLaplacian");
		computeLaplacian(numK, type);
		DoubleMatrix2D diagSum = new SparseDoubleMatrix2D(fMat.rows(), fMat.rows()); 
		for (int i = 0; i < fMat.rows(); ++i) {
			diagSum.setQuick(i, i, sumRow[i]);
		}
		diagSum.trimToSize();

		DenseDoubleMatrix1D  onesVector = new DenseDoubleMatrix1D (fMat.rows());
		onesVector.assign(1);
		DenseDoubleMatrix1D  zerosVector = new DenseDoubleMatrix1D (fMat.rows());
		zerosVector.assign(0);

		// f = f - \frac{f^T D 1}{1^T D 1} 1
		System.out.println("compute weight");
//		DoubleMatrix1D[] trans_vec = new DoubleMatrix1D[fMat.columns()];
//		for (int i = 0; i < fMat.columns(); i++)
//		{
//			trans_vec[i] = fMat.viewColumn(i).copy();
//		}
		for (int i = 0; i < fMat.columns(); ++i) {
			if (i % 100 == 0)
				System.out.println("have handle " + i + " feature");
			DoubleMatrix1D colVector = null;
//			colVector = trans_vec[i];
			colVector = fMat.viewColumn(i).copy();
			DoubleMatrix1D tempVector = null;
			
			// potential problem: diagSum.zMult(onesVector, tempVector) will lead tempVector as null!!
			tempVector = diagSum.zMult(onesVector, tempVector);
			double temp1 = colVector.zDotProduct(tempVector);
			double temp2 = onesVector.zDotProduct(onesVector);
			
			for (int j = 0; j < colVector.size(); ++j) {
				double temp3 = colVector.getQuick(j);
				double temp4 = temp3 - temp1/temp2;
				colVector.setQuick(j, temp4);
			}
			
			Laplacian.zMult(colVector, tempVector);
			temp1 = colVector.zDotProduct(tempVector);
			diagSum.zMult(colVector, tempVector);
			temp2 = colVector.zDotProduct(tempVector);
			
			lScore.insert(i, temp1/(temp2+Double.MIN_VALUE));
			weights[i] = temp1/(temp2+Double.MIN_VALUE);
		}
		int[] sortedIndices = MaxHeap.heapSort(lScore);
		//reverse array
//		sortedIndices = lScore.getIndices();
//		double[] scores = lScore.getValues();
//		for (double score: scores)
//				System.out.print(score + " ");
//		System.out.println();
		return sortedIndices;
		
	}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:63,代码来源:LaplacianScore.java

示例5: product

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
static public double product(DoubleMatrix1D v1, DoubleMatrix1D v2) {
	if (v1 instanceof SparseDoubleMatrix1D) {
		return productQuick(v1, v2);
	} else if (v2 instanceof SparseDoubleMatrix1D) {
		return productQuick(v2, v1);
	} else {
		return v1.zDotProduct(v2);
	}
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:10,代码来源:Matrix2DUtil.java

示例6: ddot

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

示例7: mult

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
/**
 * Inner product of two vectors; <tt>Sum(x[i] * y[i])</tt>.
 * Also known as dot product.
 * <br>
 * Equivalent to <tt>x.zDotProduct(y)</tt>.
 *
 * @param x the first source vector.
 * @param y the second source matrix.
 * @return the inner product.
 *
 * @throws IllegalArgumentException if <tt>x.size() != y.size()</tt>.
 */
public double mult(DoubleMatrix1D x, DoubleMatrix1D y) {
	return x.zDotProduct(y);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:16,代码来源:Algebra.java


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