java.lang.Object
uk.ac.manchester.tornado.api.types.collections.VectorFloat
- All Implemented Interfaces:
Serializable,TornadoCollectionInterface<FloatBuffer>,PrimitiveStorage<FloatBuffer>
VectorFloat relies on preview features of the Java platform:
VectorFloatrefers 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
ConstructorsConstructorDescriptionVectorFloat(int numElements) Creates an empty vector with.VectorFloat(int numElements, FloatArray array) VectorFloat(FloatArray storage) Creates a new vector from the provided storage. -
Method Summary
Modifier and TypeMethodDescriptionasBuffer()voidclear()static floatdot(VectorFloat a, VectorFloat b) Performs Dot-product.Duplicates this vector.voidfill(float value) Sets all elements to value.floatget(int index) Returns the float at the given index of this vector.getArray()intlonglongbooleanisEqual(VectorFloat vector) Vector equality test.voidloadFromBuffer(FloatBuffer buffer) static floatmax(VectorFloat v) static floatmin(VectorFloat v) voidset(float[] values) Sets the elements of this vector to that of the provided array.voidset(int index, float value) Sets the float at the given index of this vector.voidset(VectorFloat values) Sets the elements of this vector to that of the provided vector.intsize()subVector(int start, int length) Returns slice of this vector.toString()Prints the vector using the specified format string.
-
Constructor Details
-
VectorFloat
-
VectorFloat
public VectorFloat(int numElements) Creates an empty vector with.- Parameters:
numElements- Number of elements
-
VectorFloat
Creates a new vector from the provided storage.- Parameters:
storage- Array to be stored
-
-
Method Details
-
min
-
max
-
dot
Performs Dot-product.- Returns:
- dot-product value
-
getArray
-
get
public float get(int index) Returns the float at the given index of this vector.- Parameters:
index- Position- Returns:
- value
-
set
public void set(int index, float value) Sets the float at the given index of this vector.- Parameters:
index- Positionvalue- Float value to be stored
-
set
Sets the elements of this vector to that of the provided vector.- Parameters:
values- VectorFloat4
-
set
public void set(float[] values) Sets the elements of this vector to that of the provided array.- Parameters:
values- Set input array as internal stored
-
fill
public void fill(float value) 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<FloatBuffer>
-
asBuffer
- Specified by:
asBufferin interfacePrimitiveStorage<FloatBuffer>
-
size
public int size()- Specified by:
sizein interfacePrimitiveStorage<FloatBuffer>
-
getLength
public int getLength() -
clear
public void clear() -
getNumBytes
public long getNumBytes()- Specified by:
getNumBytesin interfaceTornadoCollectionInterface<FloatBuffer>
-
getNumBytesWithHeader
public long getNumBytesWithHeader()- Specified by:
getNumBytesWithHeaderin interfaceTornadoCollectionInterface<FloatBuffer>
-
getSegment
- Specified by:
getSegmentin interfaceTornadoCollectionInterface<FloatBuffer>
-
getSegmentWithHeader
- Specified by:
getSegmentWithHeaderin interfaceTornadoCollectionInterface<FloatBuffer>
-
VectorFloatwhen preview features are enabled.