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


Java DoubleArrayList.get方法代码示例

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


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

示例1: validierung

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
public void validierung(DoubleArrayList trendbereinigtezeitreihe, DoubleMatrix2D matrixPhi, int p) {

		double prognosewert = 0;
		double realisierungsWert = trendbereinigtezeitreihe.get(trendbereinigtezeitreihe.size() - 1);
		Trendgerade trend = new Trendgerade(new double[1]);
		realisierungsWert = realisierungsWert + trend.getValue(p);
		// Ein Durchlauf findet den Gewichtungsfaktor Phi und den dazu passenden
		// Vergangenheitswert.
		// Hier wird der Prognosewert für den Zeitpunkt 0 berechnet
		for (int t = 0; t < p; t++) {
			prognosewert = prognosewert
					+ (matrixPhi.get(t, 0) * trendbereinigtezeitreihe.get(trendbereinigtezeitreihe.size() - (t + 2)));
		}
		prognosewert = prognosewert + trend.getValue(p);
		// Berechnung der prozentualen Abweichung
		double h = prognosewert / (realisierungsWert / 100);
		// Die Variable abweichung enthält die Abweichung in %, abweichung =1
		// --> Die Abweichung beträgt 1%
		double abweichung = Math.abs(h - 100);
		setAbweichung(abweichung);
	}
 
开发者ID:DHBW-Karlsruhe,项目名称:businesshorizon2,代码行数:22,代码来源:AnalysisTimeseries.java

示例2: SparseMultSparseTranspose

import cern.colt.list.DoubleArrayList; //导入方法依赖的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

示例3: getSparseTranspose

import cern.colt.list.DoubleArrayList; //导入方法依赖的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

示例4: addNoise

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
public static void addNoise(DoubleMatrix2D s) {
  IntArrayList is = new IntArrayList();
  IntArrayList ks = new IntArrayList();
  DoubleArrayList vs = new DoubleArrayList();            
  s.getNonZeros(is, ks, vs);
  
  for (int j=0; j<is.size(); j++) {
    int i = is.get(j);
    int k = ks.get(j);
    double v = vs.get(j);
    v = v + (EPSILON * v + REALMIN100) * Math.random();
    s.setQuick(i, k, v);
  }    
}
 
开发者ID:lovro-i,项目名称:apro,代码行数:15,代码来源:Utils.java

示例5: quantileElements

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
 * Computes the specified quantile elements over the values previously added.
 * @param phis the quantiles for which elements are to be computed. Each phi must be in the interval (0.0,1.0]. <tt>phis</tt> must be sorted ascending.
 * @return the approximate quantile elements.
 */
public DoubleArrayList quantileElements(DoubleArrayList phis) {
	if (precomputeEpsilon<=0.0) return super.quantileElements(phis);
	
	int quantilesToPrecompute = (int) Utils.epsilonCeiling(1.0 / precomputeEpsilon);
	/*
	if (phis.size() > quantilesToPrecompute) {
		// illegal use case!
		// we compute results, but loose explicit approximation guarantees.
		return super.quantileElements(phis);
	}
	*/
 
	//select that quantile from the precomputed set that corresponds to a position closest to phi.
	phis = phis.copy();
	double e = precomputeEpsilon;
	for (int index=phis.size(); --index >= 0;) {
		double phi = phis.get(index);
		int i = (int) Math.round( ((2.0*phi/e) - 1.0 ) / 2.0); // finds closest
		i = Math.min(quantilesToPrecompute-1, Math.max(0,i));
		double augmentedPhi = (e/2.0)*(1+2*i);
		phis.set(index,augmentedPhi);				
	}
	
	return super.quantileElements(phis);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:31,代码来源:UnknownDoubleQuantileEstimator.java

示例6: toString

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
 * Returns a string representation of the receiver, containing
 * the String representation of each key-value pair, sorted ascending by key.
 */
public String toString() {
	DoubleArrayList theKeys = keys();
	theKeys.sort();

	StringBuffer buf = new StringBuffer();
	buf.append("[");
	int maxIndex = theKeys.size() - 1;
	for (int i = 0; i <= maxIndex; i++) {
		double key = theKeys.get(i);
	    buf.append(String.valueOf(key));
		buf.append("->");
	    buf.append(String.valueOf(get(key)));
		if (i < maxIndex) buf.append(", ");
	}
	buf.append("]");
	return buf.toString();
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:22,代码来源:AbstractDoubleIntMap.java

示例7: toStringByValue

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
 * Returns a string representation of the receiver, containing
 * the String representation of each key-value pair, sorted ascending by value.
 */
public String toStringByValue() {
	DoubleArrayList theKeys = new DoubleArrayList();
	keysSortedByValue(theKeys);

	StringBuffer buf = new StringBuffer();
	buf.append("[");
	int maxIndex = theKeys.size() - 1;
	for (int i = 0; i <= maxIndex; i++) {
		double key = theKeys.get(i);
	    buf.append(String.valueOf(key));
		buf.append("->");
	    buf.append(String.valueOf(get(key)));
		if (i < maxIndex) buf.append(", ");
	}
	buf.append("]");
	return buf.toString();
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:22,代码来源:AbstractDoubleIntMap.java

示例8: restore

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
public List<DoubleMatrix1D> restore()
{
	if (doc2graphidx == null)
		return ans;
	if (ans.size() == 0)
		return ans;
	Map<Integer, Integer> graphidx2doc = new HashMap<Integer, Integer>();
	for (Entry<Integer, Integer> entry: doc2graphidx.entrySet())
	{
		graphidx2doc.put(entry.getValue(), entry.getKey());
	}
	List<DoubleMatrix1D> mat  = new ArrayList<DoubleMatrix1D>();
	for(int i = 0; i < doc_num; i++)
		mat.add(new ColtSparseVector(doc_num));
	for (int i = 0; i < ans.size(); i++)
	{
		DoubleMatrix1D shrinked_vec = ans.get(i), vec = mat.get(graphidx2doc.get(i));
		IntArrayList indexList = new IntArrayList();
		DoubleArrayList valueList = new DoubleArrayList();
		shrinked_vec.getNonZeros(indexList, valueList);
		for (int k = 0; k < indexList.size(); k++)
		{
			int idx = indexList.get(k);
			double value = valueList.get(k);
			vec.setQuick(graphidx2doc.get(idx), value);
		}
	}
	return mat;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:30,代码来源:MetaPathInstanceCnt.java

示例9: SparseMultSparse

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
static public List<DoubleMatrix1D> SparseMultSparse(List<DoubleMatrix1D> A,
		List<DoubleMatrix1D> B) {
	int m = A.size();
	int n = A.get(0).size();
	int p = B.get(0).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.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.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(index).getQuick(j); 
				if (value1 != 0 || value2 != 0) { 
					sum += value1 * value2;
				}
			}
			C.get(i).setQuick(j, sum);
		}	
	}
	return C;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:36,代码来源:Matrix2DUtil.java

示例10: getSqrSum

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
public static double getSqrSum(DoubleArrayList valueList)
{
	double sum =0, tmp ;
	for (int i = 0; i < valueList.size(); i++)
	{
		tmp = valueList.get(i);
		sum += tmp * tmp;
	}
	
	return sum;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:12,代码来源:Matrix2DUtil.java

示例11: load_metapath

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
double[] load_metapath(MetaPath metaPath)
{
	mat = null;
	try {
		String suffix = "/" + (metaPath.path.size()-1) + "/" + metaPath.toString() + ".mat";
		mat = (List<DoubleMatrix1D>) ObjectWriter.readObject(MatDir + suffix);
		if (mat == null)
		{
			System.err.println("err metapath:" + metaPath);
			return null;
		}
	} catch (Exception e) {
		e.printStackTrace();
	}

	IntArrayList indexArrayList = new IntArrayList();
	DoubleArrayList valueArrayList = new DoubleArrayList();
	if (doc_num == 0 && mat.size() > 0)
		doc_num = mat.size();
	double[] hasInstance = new double[doc_num];
	if (mat.size() > 0)
	{
		for (int i = 0; i < doc_num ; i++)
		{
			mat.get(i).getNonZeros(indexArrayList, valueArrayList);
			for (int j = 0; j < valueArrayList.size(); j++)
				if (valueArrayList.get(j) > 0.0001 &&  i != j)
				{
					hasInstance[i] = 1;
					break;
				}
		}
		return hasInstance;	
	} else {
		System.err.println("err metapath:" + metaPath);
		return null;
	}
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:40,代码来源:calcMI.java

示例12: performExperiment

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
 * Performs one experiment
 * @param algorithm
 * @param benchmarkMeasure
 * @param dataset
 * @param measure
 * @param criterion
 * @param suppressionLimit
 * @throws IOException
 */
private static void performExperiment(BenchmarkDataset dataset,
                                      BenchmarkQualityMeasure measure,
                                      BenchmarkPrivacyModel criterion,
                                      double suppressionLimit) throws IOException {
    
    System.out.println("Performing experiment 3 - " + dataset + "/" + measure + "/" +criterion + "/" + suppressionLimit);
    
    // Perform
    BenchmarkResults run = BenchmarkEnvironment.getBenchmarkResults(BenchmarkAlgorithm.LIGHTNING, dataset, measure, criterion, 600 * 1000, suppressionLimit);
    DoubleArrayList trackRecord = run.trackRecord;
    
    // Check if completed
    boolean complete = run.executionTime < 600 * 1000;
    
    // Min and max
    double min = trackRecord.get(1);
    double max = trackRecord.get(trackRecord.size()-1);

    // For each step
    double previous = Double.MAX_VALUE;
    for (int i = 0; i < trackRecord.size(); i += 2) {
        
        // Normalize
        double utility = min == max ? 1d : (trackRecord.get(i + 1) - min) / (max - min);
        
        // Ignore steps in which utility did not change
        if (utility == -0d) utility = +0d;
        if (utility != previous) {
            previous = utility; 
            BENCHMARK.addRun(measure.toString(), criterion.toString(), String.valueOf(suppressionLimit), dataset.toString());
            BENCHMARK.addValue(TIME, trackRecord.get(i));
            BENCHMARK.addValue(QUALITY, utility);
            BENCHMARK.addValue(COMPLETE, complete);
        }
    }
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:47,代码来源:BenchmarkExperiment3.java

示例13: binaryMultiSearch

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
 * Finds the first and last indexes of a specific element within a sorted list.
 * @return int[]
 * @param list cern.colt.list.DoubleArrayList
 * @param element the element to search for
 */
protected static IntArrayList binaryMultiSearch(DoubleArrayList list, double element) {
	int index = list.binarySearch(element);
	if (index<0) return null; //not found

	int from = index-1;
	while (from>=0 && list.get(from)==element) from--;
	from++;
	
	int to = index+1;
	while (to<list.size() && list.get(to)==element) to++;
	to--;
	
	return new IntArrayList(new int[] {from,to});
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:21,代码来源:QuantileFinderTest.java

示例14: covariance2

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
private static double covariance2(DoubleArrayList data1, DoubleArrayList data2) {
	int size = data1.size();
	double mean1 = Descriptive.mean(data1);
	double mean2 = Descriptive.mean(data2);
	double covariance = 0.0D;
	for (int i = 0; i < size; i++) {
		double x = data1.get(i);
		double y = data2.get(i);

		covariance += (x - mean1) * (y - mean2);
	}

	return covariance / (double) (size-1);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:15,代码来源:Descriptive.java


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