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 boolean
add(Vector left, Vector right, boolean ignoreOrientation)
Adds two vectors and stores the result in this instance.double
dot(Vector right)
Calculates the dot products of a vector with this instance.double
get(int i)
Read an entry in aVector
.int
getSize()
Returns the size of aVector
.boolean
set(int i, double value)
Set one element in aVector
.
-
-
-
Constructor Detail
-
Vector
public Vector(int n, boolean row)
Creates a newVector
withn
dimensions. Each entry is of typedouble
.- Parameters:
n
- Dimensionrow
-true
: vector hasn
rows and one column,false
: vector hasn
columns and one row.
-
Vector
public Vector(int n)
Creates a newVector
withn
dimensions. TheVector
has one row andn
columns.- 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:
false
if specified position is not within the vector.
-
get
public double get(int i)
Read an entry in aVector
. ReturnsDouble.NaN
if specified position is not within theVector
.- Parameters:
i
- Element number (1..n)- Returns:
- Entry at
i
orDouble.NaN
if 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. Returnsfalse
if the dimensions of the involved vectors do not fit.- Parameters:
left
- First input vectorright
- Second input vectorignoreOrientation
- Iftrue
the orientation (row vector - column vector) is not checked- Returns:
false
if 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.NaN
if the dimensions of the involved vectors do not fit.- Parameters:
right
- Input vector- Returns:
- Dot product or
Double.NaN
if dimensions of the involved vectors do not fit.
-
-