public FloatColumn append(float i) { data.add(i); return this; }
@Override public FloatColumn bottom(final int n) { FloatArrayList bottom = new FloatArrayList(); float[] values = data.toFloatArray(); FloatArrays.parallelQuickSort(values); for (int i = 0; i < n && i < values.length; i++) { bottom.add(values[i]); } return new FloatColumn(name() + "[Bottoms " + n + "]", bottom); }
@Override public FloatColumn top(int n) { FloatArrayList top = new FloatArrayList(); float[] values = data.toFloatArray(); FloatArrays.parallelQuickSort(values, descendingComparator); for (int i = 0; i < n && i < values.length; i++) { top.add(values[i]); } return new FloatColumn(name() + "[Top " + n + "]", top); }
/** * Returns a new FloatColumn containing a value for each value in this column, truncating if necessary. * * A widening primitive conversion from an int to a float does not lose information about the overall magnitude * of a numeric value. It may, however, result in loss of precision - that is, the result may lose some of the * least significant bits of the value. In this case, the resulting floating-point value will be a correctly * rounded version of the integer value, using IEEE 754 round-to-nearest mode. * * Despite the fact that a loss of precision may occur, a widening primitive conversion never results in a * run-time exception. * * A missing value in the receiver is converted to a missing value in the result */ @Override public FloatColumn asFloatColumn() { FloatArrayList values = new FloatArrayList(); for (int d : data) { values.add(d); } values.trim(); return FloatColumn.create(this.name(), values.elements()); }
/** * Returns a new FloatColumn containing a value for each value in this column, truncating if necessary. * * A widening primitive conversion from an int to a float does not lose information about the overall magnitude * of a numeric value. It may, however, result in loss of precision - that is, the result may lose some of the * least significant bits of the value. In this case, the resulting floating-point value will be a correctly * rounded version of the integer value, using IEEE 754 round-to-nearest mode. * * Despite the fact that a loss of precision may occur, a widening primitive conversion never results in a * run-time exception. * * A missing value in the receiver is converted to a missing value in the result */ @Override public FloatColumn asFloatColumn() { FloatArrayList values = new FloatArrayList(); for (int d : data) { values.add(d); } values.trim(); return FloatColumn.create(this.name(), values.elements()); }
/** * Returns a new FloatColumn containing a value for each value in this column, truncating if necessary. * * A narrowing primitive conversion such as this one may lose information about the overall magnitude of a * numeric value and may also lose precision and range. Specifically, if the value is too small (a negative value * of large magnitude or negative infinity), the result is the smallest representable value of type float. * * Similarly, if the value is too large (a positive value of large magnitude or positive infinity), the result is the * largest representable value of type float. * * Despite the fact that overflow, underflow, or other loss of information may occur, a narrowing primitive * conversion never results in a run-time exception. * * A missing value in the receiver is converted to a missing value in the result */ @Override public FloatColumn asFloatColumn() { FloatArrayList values = new FloatArrayList(); for (double d : data) { values.add((float) d); } values.trim(); return FloatColumn.create(this.name(), values.elements()); } }
/** * Returns a new FloatColumn containing a value for each value in this column * * A widening primitive conversion from a long to a float does not lose information about the overall magnitude * of a numeric value. It may, however, result in loss of precision - that is, the result may lose some of the * least significant bits of the value. In this case, the resulting floating-point value will be a correctly * rounded version of the integer value, using IEEE 754 round-to-nearest mode. * * Despite the fact that a loss of precision may occur, a widening primitive conversion never results in a * run-time exception. * * A missing value in the receiver is converted to a missing value in the result */ @Override public FloatColumn asFloatColumn() { FloatArrayList values = new FloatArrayList(); for (long d : data) { values.add(d); } values.trim(); return FloatColumn.create(this.name(), values.elements()); }
private void runQuery(Query query, int execType) throws Exception { System.out.println("Executing Query: " + query.getQueryString()); System.out.println("Num iterations=" + NUM_ITERATIONS); System.out.println(); boolean indexed = execType == INDEXED; for (int i = 0; i < DATA_SET_SIZES.length; i++) { int num = DATA_SET_SIZES[i]; populate(num, indexed); System.out.println("Executing (" + execTypeStrings[execType] + ")..."); long startTime = NanoTimer.getTime(); SelectResults results = null; for (int j = 0; j < NUM_ITERATIONS; j++) { results = (SelectResults) query.execute(); } long totalTime = NanoTimer.getTime() - startTime; System.out.println("results size =" + results.size()); float aveTime = totalTime / NUM_ITERATIONS / 1e6f; System.out.println("ave execution time=" + aveTime + " ms"); this.results[execType].add(aveTime); System.out.println(); } System.out.println("--------------------------------------------"); }
private void populate(int numPortfolios, boolean indexed) throws CacheException, QueryException { System.out.println("Populating Cache with " + numPortfolios + " Portfolios"); if (this.region != null) { this.region.localDestroyRegion(); } this.region = cache.createRegion("portfolios", this.regionAttributes); for (int i = 0; i < numPortfolios; i++) { this.region.put(String.valueOf(i), new Portfolio(i)); } if (indexed) { System.out.println("Creating index..."); long startNanos = NanoTimer.getTime(); this.qs.createIndex("portfolios", IndexType.FUNCTIONAL, "type", "/portfolios"); float createTime = (NanoTimer.getTime() - startNanos) / 1e6f; System.out.println("Index created in " + createTime + " ms."); this.results[INDEX_CREATE].add(createTime); } }
@Override public void add(float k) { FloatArrayList.this.add(pos++, k); last = -1; } @Override
/** * Adds the given double to this column, after casting it to a float */ public void add(double d) { data.add((float) d); }
@Override public void addFloat(float value) { list.add(value); } };
public void addPixelValuesBands(float valueB4Band, float valueB8Band, float valueB11Band){ this.sumValueB4Band += valueB4Band; this.sumValueB8Band += valueB8Band; this.sumValueB11Band += valueB11Band; this.standardDeviationPixelValues.add(valueB8Band); }
@Override public boolean add(String o) { return ((FloatArrayList) _innerList).add(parse(o)); }
@Override public VectorWriter.VectorLine getNextVectorLine() throws IOException { int sampleId = inputStream.readInt(); long exampleId = inputStream.readLong(); int vectorId = inputStream.readInt(); int numElements = inputStream.readInt(); FloatArrayList vectorElements = new FloatArrayList(numElements); for (int i = 0; i < numElements; i++) { vectorElements.add(inputStream.readFloat()); } return new VectorWriter.VectorLine(sampleId, exampleId, vectorId, vectorElements); }
public FloatArrayList toFloatArray() { FloatArrayList output = new FloatArrayList(data.size()); for (short aData : data) { output.add(aData); } return output; }
public FloatArrayList toFloatArray() { FloatArrayList output = new FloatArrayList(data.size()); for (long aData : data) { output.add(aData); } return output; }
public FloatArrayList toFloatArray() { FloatArrayList output = new FloatArrayList(data.size()); for (int aData : data) { output.add(aData); } return output; }
@Override public FloatColumn bottom(final int n) { FloatArrayList bottom = new FloatArrayList(); float[] values = data.toFloatArray(); FloatArrays.parallelQuickSort(values); for (int i = 0; i < n && i < values.length; i++) { bottom.add(values[i]); } return new FloatColumn(name() + "[Bottoms " + n + "]", bottom); }
@Override public FloatColumn top(int n) { FloatArrayList top = new FloatArrayList(); float[] values = data.toFloatArray(); FloatArrays.parallelQuickSort(values, descendingComparator); for (int i = 0; i < n && i < values.length; i++) { top.add(values[i]); } return new FloatColumn(name() + "[Top " + n + "]", top); }