FloatArrayList
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using it.unimi.dsi.fastutil.floats.FloatArrayList (Showing top 20 results out of 315)

  • Common ways to obtain FloatArrayList
private void myMethod () {
FloatArrayList f =
  • new FloatArrayList()
  • new FloatArrayList(capacity)
  • Smart code suggestions by Codota
}
origin: jtablesaw/tablesaw

@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);
}
origin: jtablesaw/tablesaw

@Override
public int size() {
  return data.size();
}
origin: jtablesaw/tablesaw

public FloatColumn set(int i, float val) {
  data.set(i, val);
  return this;
}
origin: jtablesaw/tablesaw

/**
 * 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());
}
origin: jtablesaw/tablesaw

@Override
public FloatColumn lag(int n) {
  final int srcPos = n >= 0 ? 0 : 0 - n;
  final float[] dest = new float[size()];
  final int destPos = n <= 0 ? 0 : n;
  final int length = n >= 0 ? size() - n : size() + n;
  for (int i = 0; i < size(); i++) {
    dest[i] = FloatColumnType.missingValueIndicator();
  }
  float[] array = data.toFloatArray();
  System.arraycopy(array, srcPos, dest, destPos, length);
  return new FloatColumn(name() + " lag(" + n + ")", new FloatArrayList(dest));
}
origin: org.datavec/datavec-dataframe

public FloatArrayList toFloatArray() {
  FloatArrayList output = new FloatArrayList(data.size());
  for (long aData : data) {
    output.add(aData);
  }
  return output;
}
origin: senbox-org/s2tbx

private void execute(){
  Spectrum spec;
  FloatArrayList pixelsValues = new FloatArrayList();
  FloatArrayList meanValues = new FloatArrayList();
  for (String sourceBand : this.sourceBands) {
    pixelsValues.clear();
    Band band = this.sourceProduct.getBand(sourceBand);
    for (int intIndex = 0; intIndex < this.spectrumClassReferencePixels.getXPixelPositions().size(); intIndex++) {
      int x = this.spectrumClassReferencePixels.getXPixelPositions().getInt(intIndex);
      int y = this.spectrumClassReferencePixels.getYPixelPositions().getInt(intIndex);
      pixelsValues.add(band.getSampleFloat(x, y));
    }
    double sum = 0;
    for (float value : pixelsValues) {
      sum += value;
    }
    meanValues.add((float) sum / pixelsValues.size());
  }
  spec = new Spectrum(spectrumClassReferencePixels.getClassName(), meanValues.toFloatArray(new float[meanValues.size()]));
  this.spectrumContainer.addElements(spec);
}
origin: jtablesaw/tablesaw

public static FloatColumn create(final String name) {
  return new FloatColumn(name, new FloatArrayList());
}
origin: jtablesaw/tablesaw

public FloatColumn append(float i) {
  data.add(i);
  return this;
}
origin: org.datavec/datavec-dataframe

public double[] toDoubleArray() {
  double[] output = new double[data.size()];
  for (int i = 0; i < data.size(); i++) {
    output[i] = data.getFloat(i);
  }
  return output;
}
origin: org.datavec/datavec-dataframe

public static FloatColumn create(String name, FloatArrayList floats) {
  FloatColumn column = new FloatColumn(name, floats.size());
  column.data = new FloatArrayList(floats.size());
  column.data.addAll(floats);
  return column;
}
origin: CampagneLaboratory/variationanalysis

public Features(int numFeatures) {
  this.values = new FloatArrayList(numFeatures);
  this.values.size(numFeatures);
}
origin: org.apache.giraph/giraph-core

/**
 * Add the vector specified. This is a vector addition that does an
 * element-by-element addition.
 *
 * @param other the vector to add.
 */
public void add(FloatDenseVector other) {
 if (isSingleton) {
  throw new RuntimeException("Cannot add to singleton vector");
 }
 if (other.isSingleton) {
  ensureCapacity(other.singletonIndex + 1);
  entries.set(other.singletonIndex, entries.getFloat(other.singletonIndex) +
    other.singletonValue);
 } else {
  ensureCapacity(other.entries.size());
  for (int i = 0; i < other.entries.size(); ++i) {
   entries.set(i, entries.getFloat(i) + other.entries.getFloat(i));
  }
 }
}
origin: jtablesaw/tablesaw

/**
 * Returns a float representation of the data at the given index. Some precision may be lost, and if the value is
 * to large to be cast to a float, an exception is thrown.
 *
 * @throws  ClassCastException if the value can't be cast to ta float
 */
public float getFloat(int row) {
  return data.getFloat(row);
}
origin: CampagneLaboratory/variationanalysis

private FloatArrayList getModelInternalActivations(INDArray testFeatures) {
  FloatArrayList floats = new FloatArrayList();
  predictiveModel.feedForward(testFeatures).stream().forEach(indArray -> floats.addAll(FloatArrayList.wrap(indArray.data().asFloat())));
  return floats;
}
origin: emorynlp/nlp4j

  static public void add(FloatArrayList list, int index, float inc)
  {
    list.set(index, list.getFloat(index)+inc);
  }
}
origin: CampagneLaboratory/variationanalysis

public void prepareToNormalize(RecordType record, int indexOfRecord) {
  mean = 0;
  stdev = 0;
  int count = 0;
  delegate.prepareToNormalize(record, indexOfRecord);
  values.clear();
  for (int i = 0; i < numberOfFeatures(); i++) {
    final float v = delegate.produceFeature(record, i);
    values.add(v);
    mean += v;
    count += 1;
  }
  mean /= count;
  double variance = 0;
  for (double value : values) {
    final double difference = value - mean;
    variance += difference * difference;
  }
  stdev = Math.sqrt(variance);
  delegate.prepareToNormalize(record, indexOfRecord);
  normalizedCalled = true;
}
origin: edu.emory.mathcs.nlp/nlp4j-common

  static public void add(FloatArrayList list, int index, float inc)
  {
    list.set(index, list.get(index)+inc);
  }
}
origin: org.gephi/graphstore

private void serializeList(final DataOutput out, final List list) throws IOException {
  Class oCls = list.getClass();
  if (oCls.equals(IntArrayList.class)) {
    serialize(out, ((IntArrayList) list).toIntArray());
  } else if (oCls.equals(FloatArrayList.class)) {
    serialize(out, ((FloatArrayList) list).toFloatArray());
  } else if (oCls.equals(DoubleArrayList.class)) {
    serialize(out, ((DoubleArrayList) list).toDoubleArray());
  } else if (oCls.equals(ShortArrayList.class)) {
    serialize(out, ((ShortArrayList) list).toShortArray());
  } else if (oCls.equals(ByteArrayList.class)) {
    serialize(out, ((ByteArrayList) list).toByteArray());
  } else if (oCls.equals(LongArrayList.class)) {
    serialize(out, ((LongArrayList) list).toLongArray());
  } else if (oCls.equals(BooleanArrayList.class)) {
    serialize(out, ((BooleanArrayList) list).toBooleanArray());
  } else if (oCls.equals(CharArrayList.class)) {
    serialize(out, ((CharArrayList) list).toCharArray());
  } else {
    serialize(out, list.size());
    for (Object obj : list) {
      serialize(out, obj);
    }
  }
}
origin: CampagneLaboratory/variationanalysis

float[] vectorElementsArray = new float[vectorLine.getVectorElements().size()];
vectorElementsArray = vectorLine.getVectorElements().toArray(vectorElementsArray);
int[] vectorShape = vectorProperties.getVectors()[vectorLine.getVectorId()].getVectorDimension();
vectorArrays[vectorIndexInArray] = Nd4j.create(vectorElementsArray, vectorShape, 'c');
it.unimi.dsi.fastutil.floatsFloatArrayList

Javadoc

A type-specific array-based list; provides some additional methods that use polymorphism to avoid (un)boxing.

This class implements a lightweight, fast, open, optimized, reuse-oriented version of array-based lists. Instances of this class represent a list with an array that is enlarged as needed when new entries are created (by doubling its current length), but is never made smaller (even on a #clear()). A family of #trim() lets you control the size of the backing array; this is particularly useful if you reuse instances of this class. Range checks are equivalent to those of java.util's classes, but they are delayed as much as possible. The backing array is exposed by the #elements() method.

This class implements the bulk methods removeElements(), addElements() and getElements() using high-performance system calls (e.g., System#arraycopy(Object,int,Object,int,int) instead of expensive loops.

Most used methods

  • <init>
    Creates a new array list using a given array. This constructor is only meant to be used by the wrapp
  • add
  • size
  • set
  • getFloat
  • toFloatArray
  • clear
  • elements
    Returns the backing array of this list.
  • trim
    Trims the backing array if it is too large. If the current array length is smaller than or equal to
  • addAll
  • get
  • iterator
  • get,
  • iterator,
  • wrap,
  • clone,
  • contains,
  • ensureIndex,
  • equals,
  • grow,
  • hashCode,
  • indexOf

Popular in Java

  • Making http post requests using okhttp
  • getSharedPreferences (Context)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)