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


Java DenseMatrix.get方法代码示例

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


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

示例1: getSortedEigenVectors

import no.uib.cipr.matrix.DenseMatrix; //导入方法依赖的package包/类
/**
 * The Eigenvector for the absolutely smallest Eigenvalue
 * is sorted to the back. The two other vectors are sorted
 * such that their Eigenvalues are ascending
 * @param evd
 * @return
 */
public static double[][] getSortedEigenVectors(EVD evd){
	double[] eigVal = evd.getRealEigenvalues();
	DenseMatrix eigVec = evd.getRightEigenvectors();
	double[][] eigVecArr = new double[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			eigVecArr[i][j]= eigVec.get(j,i);
		}
	}
	//get minimal magnitude
	int i3 = getIndexOfMinMagnitude(eigVal);
	int i1 = (i3 + 1) % 3;
	int i2 = (i3 + 2) % 3;
	double k1 = eigVal[i1];
	double k2 = eigVal[i2];
	double[][] r = new double[3][];
	r[0] = k1 < k2 ? eigVecArr[i1] : eigVecArr[i2];
	r[1] = k1 < k2 ? eigVecArr[i2] : eigVecArr[i1];
	r[2] = eigVecArr[i3];
	return r;
}
 
开发者ID:sechel,项目名称:jtem-halfedgetools,代码行数:29,代码来源:CurvatureUtility.java

示例2: data2string

import no.uib.cipr.matrix.DenseMatrix; //导入方法依赖的package包/类
/**
	 * Parse the DenseMatrix of INPUT real values to a String 2D array, ready for printing
	 * to a file. It also fits the values to the original bounds if needed.
	 * @param mat The DenseMatrix with the input values in double format
	 * @param X The output String matrix, ready to be printed
	 * @param IS The InstanceSet with the original values, used to obtain the OUTPUT values
	 */
	protected void data2string(DenseMatrix mat, String [][] X,InstanceSet IS){
		Attribute a;
		Instance inst;
		double value;
		int in,out;
		
		for(int i=0;i<X.length;i++){
			in = 0;
			out = 0;
			inst = IS.getInstance(i);
			for(int j=0;j<X[i].length;j++){
				a = Attributes.getAttribute(j);
				//older version - SVDi only used inputs attributes
//				if(a.getDirectionAttribute() == Attribute.INPUT){
//					value = mat.get(i, in);
//					in++;
//				}
//				else{
//					value = inst.getAllOutputValues()[out];
//					out++;
//				}
				
				value = mat.get(i, j);
				if(a.getType() != Attribute.NOMINAL){
					if(value < a.getMinAttribute())
						value = a.getMinAttribute();
					else if(value > a.getMaxAttribute())
						value = a.getMaxAttribute();
				}

				if(a.getType() == Attribute.REAL)
					X[i][j] = String.valueOf(value);
				else if(a.getType() == Attribute.INTEGER)
					X[i][j] = String.valueOf(Math.round(value));
				else{
					value =  Math.round(value);
					if(value >= a.getNumNominalValues())
						value = a.getNumNominalValues()-1;
					if(value < 0)
						value = 0;
					
					X[i][j] = a.getNominalValue((int)value);
				}
			}
		}
		
	}
 
开发者ID:triguero,项目名称:Keel3.0,代码行数:55,代码来源:SVDimpute.java

示例3: data2string

import no.uib.cipr.matrix.DenseMatrix; //导入方法依赖的package包/类
/**
 * Parse the DenseMatrix of INPUT real values to a String 2D array, ready for printing
 * to a file. It also fits the values to the original bounds if needed.
 * @param mat The DenseMatrix with the input values in double format
 * @param X The output String matrix, ready to be printed
 * @param IS The InstanceSet with the original values, used to obtain the OUTPUT values
 */
protected void data2string(DenseMatrix mat, String [][] X,InstanceSet IS){
	Attribute a;
	Instance inst;
	double value;
	int in,out;
	
	for(int i=0;i<X.length;i++){
		in = 0;
		out = 0;
		inst = IS.getInstance(i);
		for(int j=0;j<X[i].length;j++){
			a = Attributes.getAttribute(j);
			if(a.getDirectionAttribute() == Attribute.INPUT){
				value = mat.get(i, in);
				in++;
			}
			else{
				value = inst.getAllOutputValues()[out];
				out++;
			}
			if(a.getType() != Attribute.NOMINAL){
				if(value < a.getMinAttribute())
					value = a.getMinAttribute();
				else if(value > a.getMaxAttribute())
					value = a.getMaxAttribute();
			}

			if(a.getType() == Attribute.REAL)
				X[i][j] = String.valueOf(value);
			else if(a.getType() == Attribute.INTEGER)
				X[i][j] = String.valueOf(Math.round(value));
			else{
				value =  Math.round(value);
				if(value >= a.getNumNominalValues())
					value = a.getNumNominalValues()-1;
				if(value < 0)
					value = 0;
				
				X[i][j] = a.getNominalValue((int)value);
			}
		}
	}
	
}
 
开发者ID:triguero,项目名称:Keel3.0,代码行数:52,代码来源:BPCA.java


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