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


Java DoubleMatrix1D.get方法代码示例

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


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

示例1: addFeatures3

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
private void addFeatures3(FeatureGenCache.AllFeatureCache.Flist vector, DoubleMatrix1D mat, boolean add) {
    for (Iterator<Feature> iter = vector.iterator(); iter.hasNext();) {
        Feature feature = iter.next();
        if (printFeatures)
            System.out.println(feature);
        int f = feature.index();
        double oldVal = mat.get(feature.y());
        if (add) {
            if (oldVal == DEFAULT_VALUE)
                oldVal = 0;
            mat.set(feature.y(),oldVal+lambda[f]*feature.value());
        } else {
            mat.set(feature.y(),oldVal-lambda[f]*feature.value()); 
        }
    }
}
 
开发者ID:fauconnier,项目名称:LaToe,代码行数:17,代码来源:FeatureStore.java

示例2: addFeatures

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
/**
 * @param vector
 * @param mat
 * @param add
 */
private void addFeatures(FeatureGenCache.AllFeatureCache.Flist vector, DoubleMatrix1D mat, boolean add) {
    if (vector.size()==0) {
        if (printFeatures) {System.out.println("No features");}
        return;
    }
    DoubleMatrix1D precomputedMat = vector.mat;
    for (int y = mat.size()-1; y >= 0; y--) {
        double val = precomputedMat.get(y);
        if (val == DEFAULT_VALUE) continue;
        double oldVal = mat.get(y);
        if (add) {
            if (oldVal==DEFAULT_VALUE) 
                oldVal = 0;
            mat.set(y,oldVal+val);
        } else
            mat.set(y,oldVal-val);
    }
    if (printFeatures) {
        for (Iterator<Feature> iter = vector.iterator(); iter.hasNext();) {
            Feature feature = iter.next();
            System.out.println(bfgen.featureName(feature.index()));
        }
    }
}
 
开发者ID:fauconnier,项目名称:LaToe,代码行数:30,代码来源:FeatureStore.java

示例3: DenseMultDenseTranspose

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
static public List<DoubleMatrix1D> DenseMultDenseTranspose(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 ColtDenseVector(p));
		}
	}
	if (B.get(0).size() != n)
		throw new IllegalArgumentException("Matrix2D inner dimensions must agree.");
	for (int i = 0; i < m; ++i) {
		DoubleMatrix1D vector1 = A.get(i);
		for (int j = 0; j < p; ++j) {
			DoubleMatrix1D vector2 = B.get(j);

			if (vector2.size() != vector1.size())
				throw new IllegalArgumentException("Matrix2D inner dimensions must agree.");
			double sum = 0.0;
			for (int k = 0; k < vector1.size(); ++k) {
				sum += vector1.get(k) * vector2.get(k);
			}
			C.get(i).setQuick(j, sum);
		}	
	}
	return C;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:31,代码来源:Matrix2DUtil.java

示例4: getPred

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
private IntArrayList getPred(int col, boolean noLoop)
{
    IntArrayList ialPred = new IntArrayList();
    DoubleMatrix1D dm = relations.getCausalFollowerMatrix().viewColumn(col);
    for (int i = 0; i < nme; i++)
    {
        if (noLoop && relations.getOneLengthLoopsInfo().get(i) > 0)
            continue;
        if (dm.get(i) > 0)
            ialPred.add(i);
    }
    return ialPred;
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:14,代码来源:ModifiedAlphaSharpProcessMiner.java

示例5: getSucc

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
private IntArrayList getSucc(int row, boolean noLoop)
{
    IntArrayList ialPred = new IntArrayList();
    DoubleMatrix1D dm = relations.getCausalFollowerMatrix().viewRow(row);
    for (int i = 0; i < nme; i++)
    {
        if (noLoop && relations.getOneLengthLoopsInfo().get(i) > 0)
            continue;
        if (dm.get(i) > 0)
            ialPred.add(i);
    }
    return ialPred;
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:14,代码来源:ModifiedAlphaSharpProcessMiner.java

示例6: adjustL1LRelation

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
private void adjustL1LRelation(LogReader log) {
		// TODO Auto-generated method stub
		DoubleMatrix1D l1l = relations.getOneLengthLoopsInfo();		
		int size = relations.getLogEvents().size();
		
        LogAbstraction abstraction = new LogAbstractionImpl(log);
        DoubleMatrix2D directSuccession, twoStepCloseIn;
		try {
			directSuccession = abstraction.getFollowerInfo(1);
			twoStepCloseIn = abstraction.getCloseInInfo(2);
			
			for (int i=0; i<l1l.size(); i++)		
				if (l1l.get(i) > 0)
				{									
					for (int j=0; j<size; j++)
					{
//						if (i == j)
//							continue;
						//casual
//						if (relations.getCausalFollowerMatrix().get(i, j)>0 && twoStepCloseIn.get(i, j) >0)
//							relations.getCausalFollowerMatrix().set(i, j, 0);
						
						//没想清楚原因,但是的确只需要修改掉并行的部分就可以了擦
						//parallel
						if (relations.getParallelMatrix().get(i, j)>0 && twoStepCloseIn.get(i, j) >0)
						{
							relations.getParallelMatrix().set(i, j, 0);
							relations.getParallelMatrix().set(j, i, 0);
						}
					}
					
				}
		} 
		catch (IOException e)
		{			
			e.printStackTrace();
		}
		
	}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:40,代码来源:ModifiedAlphaSharpProcessMiner.java

示例7: bipartiteMatchingFull

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
public static boolean bipartiteMatchingFull(SparseDoubleMatrix2D candidateList, int[] signatureDepths, int[] functionDepths, int depth) {
	UndirectedGraph<String, DefaultEdge> g = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);
	
	List<String> signatureIdcs = new ArrayList<String>();
	for(int i=0; i<signatureDepths.length; ++i) {
		signatureIdcs.add("s"+i);
		g.addVertex("s"+i);
	}

	List<String> functionIdcs = new ArrayList<String>();
	for(int j=0; j<functionDepths.length; ++j) {
		functionIdcs.add("f"+j);
		g.addVertex("f"+j);
	}

	for(int i=0; i<signatureDepths.length; ++i) {
		DoubleMatrix1D row = candidateList.viewRow(i);

		for(int j=0; j<row.size(); ++j) {
			if(row.get(j) != 0) {
				g.addEdge("s"+i, "f"+j);
			}
		}
	}

	Set<String> p1 = new HashSet<String>(signatureIdcs);
       Set<String> p2 = new HashSet<String>(functionIdcs);

	HopcroftKarpBipartiteMatching<String, DefaultEdge> alg = 
		new HopcroftKarpBipartiteMatching<String, DefaultEdge>(g, p1, p2);

	Set<DefaultEdge> match = alg.getMatching();

	//System.out.println(g.toString());
	//System.out.println(match);
	if(match.size() == signatureDepths.length)
		return true;
	else
		return false;

}
 
开发者ID:douggard,项目名称:CFGScanDroid,代码行数:42,代码来源:ScanningAlgorithm.java

示例8: bipartiteMatchingDepth

import cern.colt.matrix.DoubleMatrix1D; //导入方法依赖的package包/类
public static boolean bipartiteMatchingDepth(SparseDoubleMatrix2D candidateList, int[] signatureDepths, int[] functionDepths, int depth) {
	UndirectedGraph<String, DefaultEdge> g = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);
	List<String> signatureIdcs = new ArrayList<String>();
	int signatureNodesAtDepth = 0;
	for(int i=0; i<signatureDepths.length; ++i) {
		if(signatureDepths[i] == depth) {
			signatureIdcs.add("s"+i);
			g.addVertex("s"+i);
			//System.out.println("bpm:\ts"+i);
			signatureNodesAtDepth++;
		}
	}

	List<String> functionIdcs = new ArrayList<String>();
	for(int j=0; j<functionDepths.length; ++j) {
		if(functionDepths[j] == depth) {
			functionIdcs.add("f"+j);
			g.addVertex("f"+j);
			//System.out.println("bpm:\tf"+j);
		}
	}

	for(int i=0; i<signatureDepths.length; ++i) {
		if(signatureDepths[i] == depth) {
			DoubleMatrix1D row = candidateList.viewRow(i);

			for(int j=0; j<row.size(); ++j) {
				if(row.get(j) == 1.0 && functionDepths[j] == depth) {
					g.addEdge("s"+i, "f"+j);
				}
			}
		}
	}

	Set<String> p1 = new HashSet<String>(signatureIdcs);
       Set<String> p2 = new HashSet<String>(functionIdcs);

	HopcroftKarpBipartiteMatching<String, DefaultEdge> alg = 
		new HopcroftKarpBipartiteMatching<String, DefaultEdge>(g, p1, p2);

	Set<DefaultEdge> match = alg.getMatching();

	// System.out.println(g.toString());
	// System.out.println(match);
	if(match.size() == signatureNodesAtDepth)
		return true;
	else
		return false;

}
 
开发者ID:douggard,项目名称:CFGScanDroid,代码行数:51,代码来源:ScanningAlgorithm.java


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