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


Java DenseMatrix64F.set方法代码示例

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


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

示例1: setA

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
public boolean setA(DenseMatrix64F A)
{
	if (A.numCols <= UnrolledInverseFromMinor.MAX)
	{
		// Direct inversion using the determinant 
		if (A.numCols >= 2)
		{
			UnrolledInverseFromMinor.inv(A, A);
		}
		else
		{
			A.set(0, 1.0 / A.get(0));
		}

		// Check for NaN or Infinity
		for (int i = A.data.length; i-- > 0;)
			if (!Maths.isFinite(A.data[i]))
				return false;

		this.A = A;
		return true;
	}
	return false;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:25,代码来源:EJMLLinearSolver.java

示例2: invertAndGetDeterminant

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
public static double invertAndGetDeterminant(DenseMatrix64F mat, DenseMatrix64F result) {

        final int numCol = mat.getNumCols();
        final int numRow = mat.getNumRows();
        if (numCol != numRow) {
            throw new IllegalArgumentException("Must be a square matrix.");
        }

        if (numCol <= 5) {

            if (numCol >= 2) {
                UnrolledInverseFromMinor.inv(mat, result);
            } else {
                result.set(0, 1.0D / mat.get(0));
            }

            return numCol >= 2 ?
                    UnrolledDeterminantFromMinor.det(mat) :
                    mat.get(0);
        } else {

            LUDecompositionAlt_D64 alg = new LUDecompositionAlt_D64();
            LinearSolverLu_D64 solver = new LinearSolverLu_D64(alg);
            if (solver.modifiesA()) {
                mat = mat.copy();
            }

            if (!solver.setA(mat)) {
                return Double.NaN;
            }

            solver.invert(result);

            return alg.computeDeterminant().real;

        }
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:38,代码来源:MissingOps.java

示例3: getExponentTerm

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
private double getExponentTerm(double[] features) {
    DenseMatrix64F ft =new DenseMatrix64F(1,features.length);

    for(int i=0;i<features.length;i++){
        ft.set(0,i,features[i]-avg[i]);
    }

    DenseMatrix64F ft2=new DenseMatrix64F(1,features.length);
    CommonOps.mult(ft, inv, ft2);
    DenseMatrix64F ft3=new DenseMatrix64F(1,1);
    CommonOps.multTransB(1, ft2, ft, ft3);

    return FastMath.exp(-0.5 *ft3.get(0,0));
}
 
开发者ID:kevoree,项目名称:kevoree-brain,代码行数:15,代码来源:MultivariateNormalDistribution.java

示例4: permuteEvects

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
public static DenseMatrix64F permuteEvects(SymmetricQRAlgorithmDecomposition in, int[] permutation){
	int N = in.getNumberOfEigenvalues();
	if(N==0){ return null; }

	DenseMatrix64F out = new DenseMatrix64F(N,in.getEigenVector(0).numRows);
	for(int i=0; i<N; i++){
		DenseMatrix64F evec = in.getEigenVector(permutation[out.numCols - i - 1]);
		logger.debug("\tevec: " + evec);
		for(int j=0; j<out.numCols; j++){
			out.set(i,j,evec.get(j));
		}
	}
	return out;
}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:15,代码来源:ImgMoment.java

示例5: rotationCenteredMtx

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * 
 * @param R
 * @param center
 * @return
 */
public static DenseMatrix64F rotationCenteredMtx( DenseMatrix64F R, double[] center)
{
	int ndims = center.length;
	
	logger.debug("R " + R);
	
	DenseMatrix64F affineXfm = new DenseMatrix64F( ndims + 1, ndims + 1 ); 
	DenseMatrix64F res = new DenseMatrix64F( ndims, 1 );
	
	DenseMatrix64F ctrVec = new DenseMatrix64F( ndims, 1 );
	
	ctrVec.setData( center );
	CommonOps.changeSign(ctrVec);
	
	CommonOps.mult(R, ctrVec, res);
	
	CommonOps.insert(  R, affineXfm, 0, 0);
	CommonOps.insert(res, affineXfm, 0, ndims);
	affineXfm.set( ndims, ndims, 1 );
	
	CommonOps.changeSign(ctrVec);
	for (int i = 0; i < ndims; i++) {
		affineXfm.set(i, ndims, 
				affineXfm.get(i,ndims) + ctrVec.get(i));
	}
	
	return affineXfm;
}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:35,代码来源:TransformTools.java

示例6: summarize

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
@Override
public Set<String> summarize(Map<String, Vector> vectors, int L) {
	
	int n = vectors.size();
	int themes = (int) Math.sqrt(n);
	
	DenseMatrix64F A = new DenseMatrix64F(n, n);

	Set<String> keys = vectors.keySet();
	List<String> ids = sortTimesliceIds(keys);
	for(int i = 0; i<n; i++) {
		for(int j = i; j<n; j++) {
			
			Vector v1 = vectors.get(ids.get(i));
			Vector v2 = vectors.get(ids.get(j));
			
			double w = .0;
			if(v1 != null && v2 != null) {
				w = v1.cosine(v2);
				if(w < similarityThreshold) {
					w = .0;
				}
			}
			
			A.set(i, j, w);
			A.set(j, i, w);				
			
		}	
	}
	
	System.out.println("Start Eigenvalue Decomposition.");
	EigenDecomposition<DenseMatrix64F> evdFactory = DecompositionFactory.eig(n, true);
	evdFactory.decompose(A);
	System.out.println(evdFactory.getNumberOfEigenvalues() + " eigenvalues, " + themes + " major themes");
	
	System.out.println("Start Event Segmentation");
	List<Event> events = segment(evdFactory, themes);
	
	System.out.println("#Events: " + events.size());
	
	Map<String, Double> scores = new HashMap<String, Double>();
	for(Event event : events) {
		System.out.println(event.toString());
		int index = event.maxAmplBlock;
		if(index >= 0) {
			String id = ids.get(index);
			Double score = scores.get(id);
			if(score == null || score < event.maxAmplitude) {
				scores.put(id, event.maxAmplitude);
			}
		}
	}
	
	// Sort by weight
	List<Entry<String, Double>> sortedWeights = Sorter.sort(scores);

	Set<String> summary = new HashSet<String>();
	for(int i = 0; i < Math.min(L, sortedWeights.size()); i++) {
		Entry<String, Double> entry = sortedWeights.get(i);
		summary.add(entry.getKey());
	}
	return summary;
}
 
开发者ID:MKLab-ITI,项目名称:mgraph-summarization,代码行数:64,代码来源:TScanSummarizer.java

示例7: invert

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
@Override
public void invert(DenseMatrix64F A_inv) {
    A_inv.set(pinv);
}
 
开发者ID:kevoree,项目名称:kevoree-brain,代码行数:5,代码来源:SolvePseudoInverseSvd.java


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