Package org.deepjava.runtime.util
Class Vector
- java.lang.Object
-
- org.deepjava.runtime.util.Matrix
-
- org.deepjava.runtime.util.Vector
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Vector left, Vector right, boolean ignoreOrientation)Adds two vectors and stores the result in this instance.doubledot(Vector right)Calculates the dot products of a vector with this instance.doubleget(int i)Read an entry in aVector.intgetSize()Returns the size of aVector.booleanset(int i, double value)Set one element in aVector.
-
-
-
Constructor Detail
-
Vector
public Vector(int n, boolean row)Creates a newVectorwithndimensions. Each entry is of typedouble.- Parameters:
n- Dimensionrow-true: vector hasnrows and one column,false: vector hasncolumns and one row.
-
Vector
public Vector(int n)
Creates a newVectorwithndimensions. TheVectorhas one row andncolumns.- Parameters:
n- Dimension
-
-
Method Detail
-
getSize
public int getSize()
Returns the size of aVector.- Returns:
- Dimension of the
Vector.
-
set
public boolean set(int i, double value)Set one element in aVector.- Parameters:
i- Element number (1..n)value- Value to set- Returns:
falseif specified position is not within the vector.
-
get
public double get(int i)
Read an entry in aVector. ReturnsDouble.NaNif specified position is not within theVector.- Parameters:
i- Element number (1..n)- Returns:
- Entry at
iorDouble.NaNif specified position is not within the vector.
-
add
public boolean add(Vector left, Vector right, boolean ignoreOrientation)
Adds two vectors and stores the result in this instance. Returnsfalseif the dimensions of the involved vectors do not fit.- Parameters:
left- First input vectorright- Second input vectorignoreOrientation- Iftruethe orientation (row vector - column vector) is not checked- Returns:
falseif dimensions of the involved vectors do not fit.
-
dot
public double dot(Vector right)
Calculates the dot products of a vector with this instance. ReturnsDouble.NaNif the dimensions of the involved vectors do not fit.- Parameters:
right- Input vector- Returns:
- Dot product or
Double.NaNif dimensions of the involved vectors do not fit.
-
-