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


Java TFloatArrayList.add方法代码示例

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


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

示例1: ConfiguredBusImpl

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
ConfiguredBusImpl(String id, VoltageLevelExt voltageLevel) {
    super(id, voltageLevel);
    network = voltageLevel.getNetwork().getRef();
    int stateArraySize = network.get().getStateManager().getStateArraySize();
    terminals = new ArrayList<>(stateArraySize);
    v = new TFloatArrayList(stateArraySize);
    angle = new TFloatArrayList(stateArraySize);
    connectedComponentNumber = new TIntArrayList(stateArraySize);
    synchronousComponentNumber = new TIntArrayList(stateArraySize);
    for (int i = 0; i < stateArraySize; i++) {
        terminals.add(new ArrayList<>());
        v.add(Float.NaN);
        angle.add(Float.NaN);
        connectedComponentNumber.add(-1);
        synchronousComponentNumber.add(-1);
    }
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:18,代码来源:ConfiguredBusImpl.java

示例2: getAudioOverview

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
/**
 * Refactors the overview to given another overview. If the number of
 * bins specified an overview that's finer than the actual overview the
 * original overview is returned. The output of this function will then
 * only return an array list of nBins or less.
 *
 * @param channel
 *            The channel to get
 * @param nBins
 *            The number of bins in the overview
 * @return A refactors overview
 */
public TFloatArrayList getAudioOverview(final int channel, final int nBins)
{
	if (nBins >= this.audioOverview[channel].size())
		return this.audioOverview[channel];

	final TFloatArrayList ii = new TFloatArrayList();
	final double scalar = (double) this.audioOverview[channel].size() / (double) nBins;
	for (int xx = 0; xx < nBins; xx++)
	{
		final int startBin = (int) (xx * scalar);
		final int endBin = (int) ((xx + 1) * scalar);
		float m = Integer.MIN_VALUE;
		for (int yy = startBin; yy < endBin; yy++)
			m = Math.max(m, this.audioOverview[channel].get(yy));
		ii.add(m);
	}
	return ii;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:31,代码来源:AudioOverviewVisualisation.java

示例3: parseLine

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
@Override
public boolean parseLine(String line) {
	if (fids == null){ //don't know 
		fids = new TIntArrayList(1024);
		weights = new TFloatArrayList(1024);
		head = new byte[4];
	}else{
		fids.resetQuick();
		weights.resetQuick();
	}
	NumericTokenizer nt = new NumericTokenizer();
	nt.load(line);
	BytesUtil.float2Bytes(nt.nextNumber().floatValue(), head);
	while(nt.hasNext()){
		FeatureWeight nextKeyWeight = nt.nextKeyWeight();
		fids.add(nextKeyWeight.getId());
		weights.add(nextKeyWeight.getWeight());
	}
	if (fids.size() == 0){
		return false;
	}
	return true;
}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:24,代码来源:NumberVector.java

示例4: parseLine

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
@Override
public boolean parseLine(String line) {
	if (fids == null){ //don't know 
		fids = new TIntArrayList(1024);
		weights = new TFloatArrayList(1024);
		head = new byte[4];
	}else{
		fids.resetQuick();
		weights.resetQuick();
	}
	NumericTokenizer nt = new NumericTokenizer();
	nt.load(line);
	BytesUtil.int2Byte(nt.nextNumber().intValue(), head);
	while(nt.hasNext()){
		FeatureWeight nextKeyWeight = nt.nextKeyWeight();
		fids.add(nextKeyWeight.getId());
		weights.add(nextKeyWeight.getWeight());
	}
	if (fids.size() == 0){
		return false;
	}
	return true;
}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:24,代码来源:LabelVector.java

示例5: parseLine

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
@Override
		public boolean parseLine(String line) {
			if (fids == null){ //don't know 
				fids = new TIntArrayList(1024);
				weights = new TFloatArrayList(1024);
			}else{
				fids.resetQuick();
				weights.resetQuick();
			}
			NumericTokenizer nt = new NumericTokenizer();
			nt.load(line);
			this.label = (Integer)(nt.nextNumber());
			while(nt.hasNext()){
//				long kv = nt.nextKeyValuePair();
				FeatureWeight nextKeyWeight = nt.nextKeyWeight();
//				int fid = nextKeyWeight.getId();
//				float weight = NumericTokenizer.extractWeight(kv);
				fids.add(nextKeyWeight.getId());
				weights.add(nextKeyWeight.getWeight());
			}
			if (fids.size() == 0){
				return false;
			}
			return true;
		}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:26,代码来源:Vector.java

示例6: loadVoltageLevels

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
@Override
protected VoltageLevelListI loadVoltageLevels() throws PAModelException 
{
	float[] baskv = _busCSV.getFloats("NominalKV");
	int nb = _busCSV.getRowCount();
	TFloatIntHashMap m = new TFloatIntHashMap();
	_vlkv = new TFloatArrayList();
	for(int i=0; i < nb; ++i)
	{
		m.putIfAbsent(baskv[i], m.size());
		if (m.size() != _vlkv.size()) _vlkv.add(baskv[i]);
	}
	_busvl = new int[nb];
	Arrays.fill(_busvl, -1);
	for(int i=0; i < nb; ++i)
	{ 
		_busvl[i] = m.get(baskv[i]);
	}
	return new VoltageLevelListI(_m, _busvl, m.size());
}
 
开发者ID:powerdata,项目名称:com.powerdata.openpa,代码行数:21,代码来源:PFlowPsmModelBldr.java

示例7: AbstractTerminal

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
AbstractTerminal(Ref<? extends MultiStateObject> network) {
    this.network = network;
    int stateArraySize = network.get().getStateManager().getStateArraySize();
    p = new TFloatArrayList(stateArraySize);
    q = new TFloatArrayList(stateArraySize);
    for (int i = 0; i < stateArraySize; i++) {
        p.add(Float.NaN);
        q.add(Float.NaN);
    }
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:11,代码来源:AbstractTerminal.java

示例8: NodeTerminal

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
NodeTerminal(Ref<? extends MultiStateObject> network, int node) {
    super(network);
    this.node = node;
    int stateArraySize = network.get().getStateManager().getStateArraySize();
    v = new TFloatArrayList(stateArraySize);
    angle = new TFloatArrayList(stateArraySize);
    connectedComponentNumber = new TIntArrayList(stateArraySize);
    synchronousComponentNumber = new TIntArrayList(stateArraySize);
    for (int i = 0; i < stateArraySize; i++) {
        v.add(Float.NaN);
        angle.add(Float.NaN);
        connectedComponentNumber.add(0);
        synchronousComponentNumber.add(0);
    }
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:16,代码来源:NodeTerminal.java

示例9: extractFeatureRaw

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
/**
 * Extract an orientation histogram and find the dominant orientations
 * by looking for peaks.
 * 
 * @param properties Properties describing the interest point in scale space.
 * @return an array of the angles of the dominant orientations [-PI to PI].
 */
@Override
public float [] extractFeatureRaw(GradientScaleSpaceImageExtractorProperties<FImage> properties) {
	//extract histogram
	float[] hist = getOriHistExtractor().extractFeatureRaw(properties);
	
	//find max
	float maxval = 0;
	for (int i = 0; i < getOriHistExtractor().numBins; i++)
		if (hist[i] > maxval)
			maxval = hist[i];

	float thresh = peakThreshold * maxval;
	
	//search for peaks within peakThreshold of the maximum
	TFloatArrayList dominantOrientations = new TFloatArrayList();
	for (int i = 0; i < getOriHistExtractor().numBins; i++) {
		float prevVal = hist[(i == 0 ? getOriHistExtractor().numBins - 1 : i - 1)];
		float nextVal = hist[(i == getOriHistExtractor().numBins - 1 ? 0 : i + 1)];
		float thisVal = hist[i];
		
		if (thisVal >= thresh && thisVal > prevVal && thisVal > nextVal) {
			//fit a parabola to the peak to find the position of the actual maximum
			float peakDelta = fitPeak(prevVal, thisVal, nextVal);
			float angle = 2.0f * (float)Math.PI * (i + 0.5f + peakDelta) / getOriHistExtractor().numBins - (float)Math.PI;
			
			dominantOrientations.add(angle);
		}
	}

	return dominantOrientations.toArray();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:39,代码来源:DominantOrientationExtractor.java

示例10: tf_iterator

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
/**
 * Returns a trove float iterator
 *
 * @return a trove float iterator
 */
public TFloatIterator tf_iterator() {
	final TFloatArrayList l = new TFloatArrayList();
	for (final float f : this.samples)
		l.add(f);
	return l.iterator();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:12,代码来源:FloatSampleBuffer.java

示例11: calculateBoundaryDistanceFromCentre

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
/**
 * Calculates the distance from the centroid of every pixel on the
 * 8-connected boundary of this component. Returns a {@link TFloatArrayList}
 * that contains the list of distances (in order of the boundary).
 *
 * @return A list ({@link TFloatArrayList}) of distances of boundary points
 *         to the centroid.
 */
public TFloatArrayList calculateBoundaryDistanceFromCentre() {
	final TFloatArrayList distances = new TFloatArrayList();
	final List<Pixel> bound = getInnerBoundary(ConnectMode.CONNECT_8);
	final double[] centroid = calculateCentroid();

	for (final Pixel p : bound) {
		final float dist = (float) Math.sqrt(((centroid[0] - p.x) * ((centroid[0] - p.x))) +
				((centroid[1] - p.y) * ((centroid[1] - p.y))));
		distances.add(dist);
	}

	return distances;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:22,代码来源:ConnectedComponent.java

示例12: swallow

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
@Override
public void swallow(Vector v) {
	if (v == null)
		return;
	if (fids == null){
		fids = new TIntArrayList();
		weights = new TFloatArrayList();
		head = ((GeneralVector)v).getHeader();
	}
	for(int i = 0 ; i < v.getSize(); i++){
		fids.add(v.getFId(i));
		weights.add(((GeneralVector)v).getWeight(i));
	}
}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:15,代码来源:LabelVector.java

示例13: swallow

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
@Override
public void swallow(Vector v) {
	if (v == null)
		return;
	if (fids == null){
		fids = new TIntArrayList();
		weights = new TFloatArrayList();
		label = v.getIntHeader();
	}
	for(int i = 0 ; i < v.getSize(); i++){
		fids.add(v.getFId(i));
		weights.add(v.getWeight(i));
	}
}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:15,代码来源:Vector.java

示例14: estimateModel

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
@Override
public void estimateModel(MBFImage... images) {	
	for (int i=0; i<ndims; i++) {
		mean[i] = 0;
		TFloatArrayList values = new TFloatArrayList();
		TIntIntHashMap freqs = new TIntIntHashMap();
		
		int count = 0;
		for (MBFImage im : images) {
			FImage band = im.getBand(i);
			
			for (int r=0; r<band.height; r++) {
				for (int c=0; c<band.width; c++) {
					float val = band.pixels[r][c];
					mean[i] += val;
					values.add(val);
					freqs.adjustOrPutValue(Math.round(val*255F), 1, 1);
					count++;
				}
			}
		}
		
		//mean
		mean[i] /= count;
		
		//median
		values.sort();
		int idx = values.size() / 2;
		if (values.size() % 2 == 0) {
			median[i] = (values.get(idx) + values.get(idx - 1)) / 2.0;
		} else {
			median[i] = values.get(idx);
		}

		//mode
		HashMax hm = new HashMax();
		freqs.forEachEntry(hm);
		mode[i] = hm.idx / 255.0;
		
		//range
		range[i] = values.get(values.size() - 1) - values.get(0);
		
		//variance
		variance[i] = 0;
		for (int j=0; j<values.size(); j++) {
			variance[i] += (values.get(j) - mean[i]) * (values.get(j) - mean[i]);
		}
		variance[i] = sqrt(variance[i] / values.size());
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:51,代码来源:BasicDescriptiveStatisticsModel.java

示例15: getPixelsInCircle

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
/**
 * Returns the values of pixels within a circle centres at cx, cy in the
 * image img, with a radius r.
 * 
 * @param cx
 *            The centre of the circle's x coordinate
 * @param cy
 *            The centre of the circle's y coordinate
 * @param r
 *            The radius of the circle
 * @param img
 *            The image from which to take pixels
 * @return A list of pixel values
 */
private static float[] getPixelsInCircle(int cx, int cy, double r, FImage img)
{
	final TFloatArrayList f = new TFloatArrayList();
	for (int i = (int) Math.ceil(cx - r); i < (int) Math.ceil(cx + r); i++)
	{
		final double ri = Math.sqrt(r * r - (i - cx) * (i - cx));
		for (int j = (int) Math.ceil(cy - ri); j < (int) Math.ceil(cy + ri); j++)
		{
			f.add(img.getPixel(i, j));
		}
	}
	return f.toArray();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:SUSANEdgeDetector.java


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