public class Vector
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
Vector(float[] values)
Initialisation with an array of doubles
|
Modifier and Type | Method and Description |
---|---|
float[] |
add(float[] values)
Sums the contents of vector to values and returns the result
This method does not modify the vector.
|
Vector |
add(Vector v)
Sums the contents of v to vector
This method does not modify the vector.
|
void |
addEquals(float[] values)
Sums the values to vector, modifying its contents.
|
void |
addEquals(Vector v)
Sums v2 to vector and store the result in the vector itself.
|
int |
argmax() |
int |
argmin() |
float[] |
divide(float value)
Divides the vector by a scalar and returns the resulting array.
|
void |
divideEquals(float value)
Divides the vector by a scalar and updates its value internally.
|
float |
dotProduct(float[] values)
Computes the dot product between the vector and an array of doubles.
|
float |
dotProduct(Vector v)
Computes the dot product between the vector and vector v2.
|
float[] |
get() |
float |
get(int index) |
int |
length() |
float |
magnitude()
Computes the magnitude of the vector (aka norm).
|
float |
max() |
float |
min() |
boolean |
sameCardinality(float[] v2)
Check if the vector and v2 have the same cardinality.
|
boolean |
sameCardinality(Vector v)
Check if the vector and v2 have the same cardinality.
|
float[] |
times(float value)
Multiplies the vector times a scalar and returns the result.
|
void |
timesEquals(float value)
Multiplies the vector times a scalar and updates its internal value.
|
public Vector(float[] values)
values
- public Vector add(Vector v)
v
- public float[] add(float[] values)
values
- public void addEquals(Vector v)
v
- public void addEquals(float[] values)
values
- public float dotProduct(Vector v)
v
- public float dotProduct(float[] values)
values
- public float[] times(float value)
value
- public void timesEquals(float value)
value
- public float[] divide(float value)
value
- public void divideEquals(float value)
value
- public float magnitude()
public float max()
public int argmax()
public float min()
public int argmin()
public float[] get()
public float get(int index)
index
- java.lang.NullPointerException
public int length()
public boolean sameCardinality(Vector v)
v
- public boolean sameCardinality(float[] v2)
v2
-