Interface Vector
- All Known Implementing Classes:
VectorImpl
public interface Vector
Represents a mathematical vector.
-
Method Summary
Modifier and TypeMethodDescriptionAdd a vector to this vector.double
get
(int idx) Get the value of the vector at a specified position.int
getSize()
Get the size of the vector.double
max()
The maximum value of the vector.int
maxIdx()
Index at which the vector holds its maximum value.void
set
(int idx, double value) Set the value at a specified position.times
(double val) Multiplication to a scalar.
-
Method Details
-
add
Add a vector to this vector.- Parameters:
v2
- The vector to add. Must be of same size.- Returns:
- The result of the operation.
-
times
Multiplication to a scalar.- Parameters:
val
- The scalar to multiply with.- Returns:
- The result of the operation.
-
maxIdx
int maxIdx()Index at which the vector holds its maximum value.- Returns:
- The index.
-
max
double max()The maximum value of the vector.- Returns:
- The maximum value of the vector.
-
get
double get(int idx) Get the value of the vector at a specified position.- Parameters:
idx
-- Returns:
-
set
void set(int idx, double value) Set the value at a specified position.- Parameters:
idx
- The index where to set a new value.value
- The value to set to.
-
getSize
int getSize()Get the size of the vector.- Returns:
- Size of the vector.
-