java.lang.Object
uk.ac.manchester.tornado.api.types.collections.VectorInt
All Implemented Interfaces:
Serializable, TornadoCollectionInterface<IntBuffer>, PrimitiveStorage<IntBuffer>

public final class VectorInt extends Object implements TornadoCollectionInterface<IntBuffer>
VectorInt relies on preview features of the Java platform:
Programs can only use VectorInt when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
See Also:
  • Constructor Details

    • VectorInt

      public VectorInt(int numElements, IntArray array)
      Creates a vector using the provided backing array.
      Parameters:
      numElements - number of elements
      array - reference to the input array
    • VectorInt

      public VectorInt(int numElements)
      Creates an empty vector with.
      Parameters:
      numElements - number of elements
    • VectorInt

      public VectorInt(IntArray storage)
      Creates an new vector from the provided storage.
      Parameters:
      storage - vector int array
  • Method Details

    • min

      public static int min(VectorInt v)
    • max

      public static int max(VectorInt v)
    • dot

      public static int dot(VectorInt a, VectorInt b)
      Perform dot-product.
      Returns:
      int value
    • getArray

      public IntArray getArray()
    • get

      public int get(int index)
      Returns the int at the given index of this vector.
      Parameters:
      index - index value
      Returns:
      int
    • set

      public void set(int index, int value)
      Sets the int at the given index of this vector.
      Parameters:
      index - index value
      value - value to be set in position index
    • set

      public void set(VectorInt values)
      Sets the elements of this vector to that of the provided vector.
      Parameters:
      values - assign an input vector int to the internal array
    • set

      public void set(int[] values)
      Sets the elements of this vector to that of the provided array.
      Parameters:
      values - assign an input vector int to the internal array
    • fill

      public void fill(int value)
      Sets all elements to value.
      Parameters:
      value - Fill input vector with value
    • subVector

      public VectorInt subVector(int start, int length)
      Returns slice of this vector.
      Parameters:
      start - starting index
      length - number of elements
      Returns:
      VectorInt
    • duplicate

      public VectorInt duplicate()
      Duplicates this vector.
      Returns:
      VectorInt
    • isEqual

      public boolean isEqual(VectorInt vector)
      Vector equality test.
      Parameters:
      vector - Input vector to compare
      Returns:
      true if vectors match
    • toString

      public String toString(String fmt)
      Prints the vector using the specified format string.
      Parameters:
      fmt - String Format
      Returns:
      String
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • loadFromBuffer

      public void loadFromBuffer(IntBuffer buffer)
      Specified by:
      loadFromBuffer in interface PrimitiveStorage<IntBuffer>
    • asBuffer

      public IntBuffer asBuffer()
      Specified by:
      asBuffer in interface PrimitiveStorage<IntBuffer>
    • size

      public int size()
      Specified by:
      size in interface PrimitiveStorage<IntBuffer>
    • getLength

      public int getLength()
    • clear

      public void clear()
    • getNumBytes

      public long getNumBytes()
      Specified by:
      getNumBytes in interface TornadoCollectionInterface<IntBuffer>
    • getNumBytesWithHeader

      public long getNumBytesWithHeader()
      Specified by:
      getNumBytesWithHeader in interface TornadoCollectionInterface<IntBuffer>
    • getSegment

      public MemorySegmentPREVIEW getSegment()
      Specified by:
      getSegment in interface TornadoCollectionInterface<IntBuffer>
    • getSegmentWithHeader

      public MemorySegmentPREVIEW getSegmentWithHeader()
      Specified by:
      getSegmentWithHeader in interface TornadoCollectionInterface<IntBuffer>