|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.math.Matrix marf.math.Vector
public class Vector
Algebraic operations on vectors.
NOTE: this class has the same considerations as
marf.math.Matrix
.
Matrix
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class marf.math.Matrix |
---|
Matrix.Direction |
Field Summary | |
---|---|
static int |
DEFAULT_VECTOR_LENGTH
Default vector's length is 3 elements. |
Fields inherited from class marf.math.Matrix |
---|
adMatrix, DEFAULT_COLS, DEFAULT_ERROR_DELTA, DEFAULT_ROWS, iCols, iRows |
Constructor Summary | |
---|---|
Vector()
Constructs a vector of default length of 3. |
|
Vector(double[] padVectorData)
Constructs a vector out of a raw array of doubles. |
|
Vector(double[] pad1DMatrix,
boolean pbTransposed)
Allows having a transposed vector upon construction. |
|
Vector(int piVectorLength)
Constructs a vector with the specified length. |
|
Vector(Matrix poMatrix)
Constructs a vector out of a matrix and forces the rows dimension to 1 and "flattens" the matrix to have the number of columns as the same number of elements in the original matrix. |
|
Vector(Vector poVector)
Constructs a vector from another vector; a-la copy conctructor. |
Method Summary | |
---|---|
Vector |
add(Vector poVector)
V1 = this + V. |
static Vector |
add(Vector poLHSVector,
Vector poRHSVector)
V3 = V1 + V2. |
java.lang.Object |
clone()
Implements Clonable interface. |
static Vector |
getCrossProduct(Vector poLHSVector,
Vector poRHSVector)
Calculates the cross product of two vectors, V3 = V1 x V2. |
static double |
getDotProduct(Vector poLHSVector,
Vector poRHSVector)
Calculates the dot product of two vectors, d = V1 * V2. |
double |
getElement(int piPosition)
Allows getting the value of vector's element at specified position. |
static Vector |
getInnerProduct(Vector poLHSVector,
Vector poRHSVector)
Calculates an inner product of two vectors, V3 = V1 * V2. |
double |
getLength()
Retrieves the mathematical length of the vector. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
Vector |
getUnitVector()
Returns a unit-vector representation of this vector. |
static Vector |
i()
Creates a unit-vector "i". |
boolean |
isOrthogonal(Vector poVector)
Tells whether this and the parameter vectors are orthogonal or not. |
static Vector |
j()
Creates a unit-vector "j". |
static Vector |
k()
Creates a unit-vector "k". |
void |
normalize()
Normalizes the vector's components by its length. |
void |
setElement(int piPosition,
double pdValue)
Allows setting the value of vector's element at specified position. |
Methods inherited from class marf.math.Matrix |
---|
add, add, add, applyAdd, applyMinus, applyMultiply, applyMultiply, crop, crop, cutColumn, cutFirstColumn, cutFirstRow, cutLastColumn, cutLastRow, cutRow, display, divide, divide, divide, equals, equals, equals, exhaustMatrix, extend, extend, extend, getCols, getColumn, getDeterminant, getElement, getElements, getMatrix2D, getMatrixArray, getNewMatrix, getNewMatrix, getRow, getRows, inverse, isIdentity, isNearlyIdentity, isNearlyIdentity, isReduced, loadColumn, loadRow, makeIdentity, minus, minus, minus, minus, minusUnary, multiply, multiply, multiply, multiply, multiply, multiply, multiply, pow, pow, rotate, rotate, rotate, rowOperation, rowOperation, rowReduce, scale, scale, scale, setAll, setAll, setAllRandom, setCols, setElement, setMatrix2D, setMatrixArray, setRows, shear, shear, shear, size, toString, translate, translate, translate, transpose |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_VECTOR_LENGTH
Constructor Detail |
---|
public Vector()
public Vector(int piVectorLength)
piVectorLength
- require vector lengthpublic Vector(Vector poVector)
poVector
- a vector to make a copy ofpublic Vector(Matrix poMatrix)
poMatrix
- base matrix to construct the vector frompublic Vector(double[] padVectorData)
padVectorData
- source data for the vectorpublic Vector(double[] pad1DMatrix, boolean pbTransposed)
pad1DMatrix
- vector datapbTransposed
- true
if the transposed vector is desiredMethod Detail |
---|
public final double getElement(int piPosition)
piPosition
- index to get the element from
public void setElement(int piPosition, double pdValue)
piPosition
- index to set the element atpdValue
- the element's valuepublic double getLength()
public Vector add(Vector poVector)
poVector
- V
public static Vector add(Vector poLHSVector, Vector poRHSVector)
poLHSVector
- V1poRHSVector
- V2
public final Vector getUnitVector()
public static Vector getInnerProduct(Vector poLHSVector, Vector poRHSVector)
poLHSVector
- first vector, V1poRHSVector
- second vector, V2
public static Vector getCrossProduct(Vector poLHSVector, Vector poRHSVector)
poLHSVector
- first vector, V1poRHSVector
- second vector, V2
public static double getDotProduct(Vector poLHSVector, Vector poRHSVector)
poLHSVector
- first vector, V1poRHSVector
- second vector, V2
public boolean isOrthogonal(Vector poVector)
poVector
- another vector to compare to
true
if the vectors are orthogonalpublic void normalize()
public static final Vector i()
public static final Vector j()
public static final Vector k()
public java.lang.Object clone()
clone
in class Matrix
Object.clone()
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |