java.lang.Object
uk.ac.manchester.tornado.api.types.collections.VectorHalf
- All Implemented Interfaces:
Serializable,TornadoCollectionInterface<ShortBuffer>,PrimitiveStorage<ShortBuffer>
VectorHalf relies on preview features of the Java platform:
VectorHalfrefers to one or more preview APIs:MemorySegment.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionVectorHalf(int numElements) Creates an empty vector with.VectorHalf(int numElements, HalfFloatArray array) VectorHalf(HalfFloatArray storage) Creates a new vector from the provided storage. -
Method Summary
Modifier and TypeMethodDescriptionasBuffer()voidclear()static HalfFloatdot(VectorHalf a, VectorHalf b) Performs Dot-product.Duplicates this vector.voidSets all elements to value.get(int index) Returns the half float at the given index of this vector.getArray()intlonglongbooleanisEqual(VectorHalf vector) Vector equality test.voidloadFromBuffer(ShortBuffer buffer) voidSets the half float at the given index of this vector.voidset(VectorHalf values) Sets the elements of this vector to that of the provided vector.voidSets the elements of this vector to that of the provided array.intsize()subVector(int start, int length) Returns slice of this vector.toString()Prints the vector using the specified format string.
-
Constructor Details
-
VectorHalf
-
VectorHalf
public VectorHalf(int numElements) Creates an empty vector with.- Parameters:
numElements- Number of elements
-
VectorHalf
Creates a new vector from the provided storage.- Parameters:
storage- Array to be stored
-
-
Method Details
-
dot
Performs Dot-product.- Returns:
- dot-product value
-
getArray
-
get
Returns the half float at the given index of this vector.- Parameters:
index- Position- Returns:
- value
-
set
Sets the half float at the given index of this vector.- Parameters:
index- Positionvalue- Half float value to be stored
-
set
Sets the elements of this vector to that of the provided vector.- Parameters:
values-VectorHalf
-
set
Sets the elements of this vector to that of the provided array.- Parameters:
values- Set input array as internal stored
-
fill
Sets all elements to value.- Parameters:
value- Fill input array with value
-
subVector
Returns slice of this vector.- Parameters:
start- starting indexlength- number of elements
-
duplicate
Duplicates this vector. -
isEqual
Vector equality test.- Parameters:
vector- input vector- Returns:
- true if vectors match
-
toString
Prints the vector using the specified format string.- Parameters:
fmt- String Format- Returns:
- String
-
toString
-
loadFromBuffer
- Specified by:
loadFromBufferin interfacePrimitiveStorage<ShortBuffer>
-
asBuffer
- Specified by:
asBufferin interfacePrimitiveStorage<ShortBuffer>
-
size
public int size()- Specified by:
sizein interfacePrimitiveStorage<ShortBuffer>
-
getLength
public int getLength() -
clear
public void clear() -
getNumBytes
public long getNumBytes()- Specified by:
getNumBytesin interfaceTornadoCollectionInterface<ShortBuffer>
-
getNumBytesWithHeader
public long getNumBytesWithHeader()- Specified by:
getNumBytesWithHeaderin interfaceTornadoCollectionInterface<ShortBuffer>
-
getSegment
- Specified by:
getSegmentin interfaceTornadoCollectionInterface<ShortBuffer>
-
getSegmentWithHeader
- Specified by:
getSegmentWithHeaderin interfaceTornadoCollectionInterface<ShortBuffer>
-
VectorHalfwhen preview features are enabled.