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


Java TFloatArrayList类代码示例

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


TFloatArrayList类属于gnu.trove.list.array包,在下文中一共展示了TFloatArrayList类的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: DanglingLineImpl

import gnu.trove.list.array.TFloatArrayList; //导入依赖的package包/类
DanglingLineImpl(Ref<? extends MultiStateObject> network, String id, String name, float p0, float q0, float r, float x, float g, float b, String ucteXnodeCode) {
    super(id, name);
    this.network = network;
    int stateArraySize = network.get().getStateManager().getStateArraySize();
    this.p0 = new TFloatArrayList(stateArraySize);
    this.q0 = new TFloatArrayList(stateArraySize);
    for (int i = 0; i < stateArraySize; i++) {
        this.p0.add(p0);
        this.q0.add(q0);
    }
    this.r = r;
    this.x = x;
    this.g = g;
    this.b = b;
    this.ucteXnodeCode = ucteXnodeCode;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:17,代码来源:DanglingLineImpl.java

示例3: GeneratorImpl

import gnu.trove.list.array.TFloatArrayList; //导入依赖的package包/类
GeneratorImpl(Ref<? extends MultiStateObject> ref,
              String id, String name, EnergySource energySource,
              float minP, float maxP,
              boolean voltageRegulatorOn, TerminalExt regulatingTerminal,
              float targetP, float targetQ, float targetV,
              float ratedS) {
    super(id, name);
    this.energySource = energySource;
    this.minP = minP;
    this.maxP = maxP;
    reactiveLimits = new MinMaxReactiveLimitsImpl(-Float.MAX_VALUE, Float.MAX_VALUE);
    this.regulatingTerminal = regulatingTerminal;
    this.ratedS = ratedS;
    int stateArraySize = ref.get().getStateManager().getStateArraySize();
    this.voltageRegulatorOn = new BitSet(stateArraySize);
    this.targetP = new TFloatArrayList(stateArraySize);
    this.targetQ = new TFloatArrayList(stateArraySize);
    this.targetV = new TFloatArrayList(stateArraySize);
    this.voltageRegulatorOn.set(0, stateArraySize, voltageRegulatorOn);
    for (int i = 0; i < stateArraySize; i++) {
        this.targetP.add(targetP);
        this.targetQ.add(targetQ);
        this.targetV.add(targetV);
    }
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:26,代码来源:GeneratorImpl.java

示例4: HvdcLineImpl

import gnu.trove.list.array.TFloatArrayList; //导入依赖的package包/类
HvdcLineImpl(String id, String name, float r, float nominalV, float maxP, ConvertersMode convertersMode, float activePowerSetpoint,
             AbstractHvdcConverterStation<?> converterStation1, AbstractHvdcConverterStation<?> converterStation2,
             Ref<NetworkImpl> networkRef) {
    super(id, name);
    this.r = r;
    this.nominalV = nominalV;
    this.maxP = maxP;
    int stateArraySize = networkRef.get().getStateManager().getStateArraySize();
    this.convertersMode = new BitSet(stateArraySize);
    this.convertersMode.set(0, stateArraySize, convertersMode == ConvertersMode.SIDE_1_RECTIFIER_SIDE_2_INVERTER);
    this.activePowerSetpoint = new TFloatArrayList(stateArraySize);
    this.activePowerSetpoint.fill(0, stateArraySize, activePowerSetpoint);
    this.converterStation1 = converterStation1;
    this.converterStation2 = converterStation2;
    this.networkRef = networkRef;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:17,代码来源:HvdcLineImpl.java

示例5: 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

示例6: getChannelPolygon

import gnu.trove.list.array.TFloatArrayList; //导入依赖的package包/类
/**
 * Returns a polygon representing the channel overview.
 *
 * @param channel
 *            The channel to get the polygon for
 * @param mirror
 *            whether to mirror the polygon
 * @param width
 *            The width of the overview to return
 * @return A polygon
 */
public Polygon getChannelPolygon(final int channel, final boolean mirror, final int width)
{
	final TFloatArrayList overview = this.getAudioOverview(channel, width);
	final int len = overview.size();
	final double scalar = width / (double) len;

	final ArrayList<Point2d> l = new ArrayList<Point2d>();
	for (int x = 0; x < len; x++)
		l.add(new Point2dImpl((float) (x * scalar), overview.get(x)));

	if (mirror)
	{
		for (int x = 1; x <= len; x++)
			l.add(new Point2dImpl((float) ((len - x) * scalar),
					-overview.get(len - x)));
	}

	// Store how long the given overview is in milliseconds
	AudioOverviewVisualisation.this.millisecondsInView = (long) (AudioOverviewVisualisation.this.numberOfProcessedSamples /
			this.af.getSampleRateKHz());

	return new Polygon(l);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:35,代码来源:AudioOverviewVisualisation.java

示例7: runDensityCalculation

import gnu.trove.list.array.TFloatArrayList; //导入依赖的package包/类
private int runDensityCalculation(ExecutorService threadPool, List<Future<?>> futures,
		final TFloatArrayList coordsX, final TFloatArrayList coordsY, final Statistics densityStats,
		final float radius, final Rectangle bounds, final int[] allDensity, final int allIndex)
{
	final int size = coordsX.size();
	final float[] xCoords = coordsX.toArray();
	final float[] yCoords = coordsY.toArray();
	coordsX.resetQuick();
	coordsY.resetQuick();
	futures.add(threadPool.submit(new Runnable()
	{
		public void run()
		{
			incrementProgress();
			final DensityManager dm = new DensityManager(xCoords, yCoords, bounds);
			final int[] density = dm.calculateDensity(radius, true);
			addDensity(densityStats, density);

			// Store the density for each result. This does not need to be synchronised 
			// since the indices in different threads are unique.
			for (int i = 0, index = allIndex; i < density.length; i++, index++)
				allDensity[index] = density[i];
		}
	}));
	return size;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:27,代码来源:CreateData.java

示例8: load

import gnu.trove.list.array.TFloatArrayList; //导入依赖的package包/类
public static VertexArray load(GLContext context, Path path) {
	try {
		// Create the lists to store the vertex data
		final TFloatList positions = new TFloatArrayList();
		final TFloatList texcoords = new TFloatArrayList();
		final TFloatList normals = new TFloatArrayList();
		final TIntList indices = new TIntArrayList();
		// Load the raw vertex data into the lists
		load(Files.lines(path), positions, texcoords, normals, indices);
		// Calculate the normals if the model does not have any
		if (normals.isEmpty()) {
			calculateNormals(positions, indices, normals);
		}
		// Create the vertex array object
		final VertexArray mesh = context.newVertexArray();
		mesh.create();
		mesh.setIndices(indices);
		mesh.addAttribute(0, POSITION_SIZE, positions);
		mesh.addAttribute(1, TEXCOORD_SIZE, texcoords);
		mesh.addAttribute(2, NORMAL_SIZE, normals);
		return mesh;
	} catch (IOException ex) {
		throw new IllegalArgumentException("Unable to load mesh: " + path, ex);
	}
}
 
开发者ID:thehutch,项目名称:Fusion,代码行数:26,代码来源:WavefrontOBJLoader.java

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: StaticVarCompensatorImpl

import gnu.trove.list.array.TFloatArrayList; //导入依赖的package包/类
StaticVarCompensatorImpl(String id, String name, float bMin, float bMax, float voltageSetPoint, float reactivePowerSetPoint,
                         RegulationMode regulationMode, Ref<? extends MultiStateObject> ref) {
    super(id, name);
    this.bMin = bMin;
    this.bMax = bMax;
    int stateArraySize = ref.get().getStateManager().getStateArraySize();
    this.voltageSetPoint = new TFloatArrayList(stateArraySize);
    this.reactivePowerSetPoint = new TFloatArrayList(stateArraySize);
    this.regulationMode = new TIntArrayList(stateArraySize);
    for (int i = 0; i < stateArraySize; i++) {
        this.voltageSetPoint.add(voltageSetPoint);
        this.reactivePowerSetPoint.add(reactivePowerSetPoint);
        this.regulationMode.add(regulationMode.ordinal());
    }
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:16,代码来源:StaticVarCompensatorImpl.java

示例14: LoadImpl

import gnu.trove.list.array.TFloatArrayList; //导入依赖的package包/类
LoadImpl(Ref<? extends MultiStateObject> network,
         String id, String name, LoadType loadType, float p0, float q0) {
    super(id, name);
    this.network = network;
    this.loadType = loadType;
    int stateArraySize = network.get().getStateManager().getStateArraySize();
    this.p0 = new TFloatArrayList(stateArraySize);
    this.q0 = new TFloatArrayList(stateArraySize);
    for (int i = 0; i < stateArraySize; i++) {
        this.p0.add(p0);
        this.q0.add(q0);
    }
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:14,代码来源:LoadImpl.java

示例15: 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


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