Interface Vector
-
- All Known Implementing Classes:
VectorImpl
public interface VectorRepresents a mathematical vector.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Vectoradd(Vector v2)Add a vector to this vector.doubleget(int idx)Get the value of the vector at a specified position.intgetSize()Get the size of the vector.doublemax()The maximum value of the vector.intmaxIdx()Index at which the vector holds its maximum value.voidset(int idx, double value)Set the value at a specified position.Vectortimes(double val)Multiplication to a scalar.
-
-
-
Method Detail
-
add
Vector add(Vector v2)
Add a vector to this vector.- Parameters:
v2- The vector to add. Must be of same size.- Returns:
- The result of the operation.
-
times
Vector times(double val)
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.
-
-