java.lang.Object
uk.ac.manchester.tornado.api.types.collections.VectorDouble
- All Implemented Interfaces:
Serializable,TornadoCollectionInterface<DoubleBuffer>,PrimitiveStorage<DoubleBuffer>
VectorDouble relies on preview features of the Java platform:
VectorDoublerefers 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
ConstructorsConstructorDescriptionVectorDouble(int numElements) Creates an empty vector with.VectorDouble(int numElements, DoubleArray array) VectorDouble(DoubleArray storage) Creates an new vector from the provided storage. -
Method Summary
Modifier and TypeMethodDescriptionasBuffer()voidclear()static doubledot(VectorDouble a, VectorDouble b) Perform dot product.Duplicates this vector.voidfill(double value) Sets all elements to value.doubleget(int index) Returns the double at the given index of this vector.getArray()intlonglongbooleanisEqual(VectorDouble vector) Vector equality test.voidloadFromBuffer(DoubleBuffer buffer) static doublemax(VectorDouble v) static doublemin(VectorDouble v) voidset(double[] values) Sets the elements of this vector to that of the provided array.voidset(int index, double value) Sets the double at the given index of this vector.voidset(VectorDouble 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
-
VectorDouble
-
VectorDouble
public VectorDouble(int numElements) Creates an empty vector with.- Parameters:
numElements- Number of elements
-
VectorDouble
Creates an new vector from the provided storage.- Parameters:
storage- vector to be stored
-
-
Method Details
-
min
-
max
-
dot
Perform dot product.- Returns:
- dot-product value
-
getArray
-
get
public double get(int index) Returns the double at the given index of this vector.- Parameters:
index- Position- Returns:
- value
-
set
public void set(int index, double value) Sets the double at the given index of this vector.- Parameters:
index- Positionvalue- value to be stored
-
set
Sets the elements of this vector to that of the provided vector.- Parameters:
values-
-
set
public void set(double[] values) Sets the elements of this vector to that of the provided array.- Parameters:
values- input vector to be stored
-
fill
public void fill(double value) Sets all elements to value.- Parameters:
value- input vector to be stored
-
subVector
Returns slice of this vector.- Parameters:
start- starting indexlength- number of elements- Returns:
- vector with elements updated
-
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<DoubleBuffer>
-
asBuffer
- Specified by:
asBufferin interfacePrimitiveStorage<DoubleBuffer>
-
size
public int size()- Specified by:
sizein interfacePrimitiveStorage<DoubleBuffer>
-
getLength
public int getLength() -
clear
public void clear() -
getNumBytes
public long getNumBytes()- Specified by:
getNumBytesin interfaceTornadoCollectionInterface<DoubleBuffer>
-
getNumBytesWithHeader
public long getNumBytesWithHeader()- Specified by:
getNumBytesWithHeaderin interfaceTornadoCollectionInterface<DoubleBuffer>
-
getSegment
- Specified by:
getSegmentin interfaceTornadoCollectionInterface<DoubleBuffer>
-
getSegmentWithHeader
- Specified by:
getSegmentWithHeaderin interfaceTornadoCollectionInterface<DoubleBuffer>
-
VectorDoublewhen preview features are enabled.