
public class Vector extends Object implements NumberVector<Double>
NumberVector.Factory<V extends NumberVector<? extends N>,N extends Number>| Modifier and Type | Field and Description | 
|---|---|
| protected double[] | elementsArray for internal storage of elements. | 
| private static String | ERR_DIMENSIONSError message (in assertions!) | 
| static String | ERR_MATRIX_INNERDIMError message (in assertions!) | 
| static String | ERR_VEC_DIMENSIONSError message (in assertions!) | 
| Constructor and Description | 
|---|
| Vector(double... values)Construct a vector from a given array. | 
| Vector(int m)Provides an m x 1 vector. | 
| Modifier and Type | Method and Description | 
|---|---|
| byte | byteValue(int dimension)Returns the value in the specified dimension as byte. | 
| Vector | clone() | 
| Vector | copy()Returns a copy of this vector. | 
| Vector | cross3D(Vector other)Cross product for 3d vectors, i.e. | 
| double | doubleValue(int dimension)Returns the value in the specified dimension as double. | 
| boolean | equals(Object obj) | 
| double | euclideanLength()Returns the length of this vector. | 
| float | floatValue(int dimension)Returns the value in the specified dimension as float. | 
| double | get(int i)Returns the value at the specified row. | 
| double[] | getArrayCopy()Copy the internal two-dimensional array. | 
| double[] | getArrayRef()Access the internal two-dimensional array. | 
| Vector | getColumnVector()Returns a Vector representing in one column and
  getDimensionality()rows the values of this NumberVector of V. | 
| int | getDimensionality()Returns the dimensionality of this vector. | 
| double | getMax(int dimension)Returns the maximum coordinate at the specified dimension. | 
| double | getMin(int dimension)Returns the minimum coordinate at the specified dimension. | 
| Double | getValue(int dimension)Deprecated.  | 
| int | hashCode() | 
| int | intValue(int dimension)Returns the value in the specified dimension as int. | 
| long | longValue(int dimension)Returns the value in the specified dimension as long. | 
| Vector | minus(Vector v)Returns this vector minus the specified vector v. | 
| Vector | minusEquals(double d)Subtract a constant value from all dimensions. | 
| Vector | minusEquals(Vector b)a = a - b. | 
| Vector | minusTimes(Vector v,
          double s)Returns this vector minus the specified vector v times s. | 
| Vector | minusTimesEquals(Vector b,
                double s)a = a - s * b. | 
| Vector | normalize()Normalizes this vector to the length of 1.0. | 
| Vector | plus(Vector v)Returns a new vector which is the result of this vector plus the specified
 vector. | 
| Vector | plusEquals(double d)Add a constant value to all dimensions. | 
| Vector | plusEquals(Vector b)a = a + b. | 
| Vector | plusTimes(Vector v,
         double s)Returns a new vector which is the result of this vector plus the specified
 vector times the given factor. | 
| Vector | plusTimesEquals(Vector b,
               double s)a = a + s * b. | 
| Vector | projection(Matrix v)Projects this row vector into the subspace formed by the specified matrix
 v. | 
| static Vector | randomNormalizedVector(int dimensionality)Returns a randomly created vector of length 1.0. | 
| Vector | rotate90Equals()Rotate vector by 90 degrees. | 
| Vector | set(int i,
   double value)Sets the value at the specified row. | 
| void | setZero()Reset the Vector to 0. | 
| short | shortValue(int dimension)Returns the value in the specified dimension as short. | 
| Vector | times(double s)Returns a new vector which is the result of this vector multiplied by the
 specified scalar. | 
| Matrix | times(Matrix B)Linear algebraic matrix multiplication, A * B. | 
| Vector | timesEquals(double s)Multiply a matrix by a scalar in place, A = s*A. | 
| Matrix | timesTranspose(Matrix B)Linear algebraic matrix multiplication, A * B^T. | 
| Matrix | timesTranspose(Vector B)Linear algebraic matrix multiplication, A * B^T. | 
| String | toString()Returns a string representation of this vector. | 
| String | toStringNoWhitespace()Returns a string representation of this vector without adding extra
 whitespace. | 
| Matrix | transposeTimes(Matrix B)Linear algebraic matrix multiplication, AT * B. | 
| double | transposeTimes(Vector B)Linear algebraic matrix multiplication, AT * B. | 
| double | transposeTimesTimes(Matrix B,
                   Vector c)Linear algebraic matrix multiplication, aT * B * c. | 
| static Vector | unitVector(int dimensionality,
          int i)Returns the ith unit vector of the specified dimensionality. | 
protected final double[] elements
public static final String ERR_VEC_DIMENSIONS
public static final String ERR_MATRIX_INNERDIM
private static final String ERR_DIMENSIONS
public Vector(double... values)
values - array of doublespublic Vector(int m)
m - the number of rowspublic static final Vector randomNormalizedVector(int dimensionality)
dimensionality - dimensionalitypublic static final Vector unitVector(int dimensionality, int i)
dimensionality - the dimensionality of the vectori - the indexpublic final Vector copy()
public final double[] getArrayRef()
public final double[] getArrayCopy()
public final int getDimensionality()
getDimensionality in interface FeatureVector<Double>getDimensionality in interface SpatialComparablepublic final double get(int i)
i - the row indexpublic final Vector set(int i, double value)
i - the row indexvalue - the value to be setpublic final Vector plus(Vector v)
v - the vector to be addedpublic final Vector plusTimes(Vector v, double s)
v - the vector to be addeds - the scalarpublic final Vector plusEquals(Vector b)
b - another vectorpublic final Vector plusTimesEquals(Vector b, double s)
b - another vectors - Scalarpublic final Vector plusEquals(double d)
d - Value to addpublic final Vector minus(Vector v)
v - the vector to be subtracted from this vectorpublic final Vector minusTimes(Vector v, double s)
v - the vector to be subtracted from this vectors - the scaling factorpublic final Vector minusEquals(Vector b)
b - another vectorpublic final Vector minusTimesEquals(Vector b, double s)
b - another vectors - Scalarpublic final Vector minusEquals(double d)
d - Value to subtractpublic final Vector times(double s)
s - the scalar to be multipliedpublic final Vector timesEquals(double s)
s - scalarpublic final Matrix times(Matrix B)
B - another matrixpublic final Matrix transposeTimes(Matrix B)
B - another matrixpublic final double transposeTimesTimes(Matrix B, Vector c)
B - matrixc - vector on the rightpublic final double transposeTimes(Vector B)
B - another vectorpublic final Matrix timesTranspose(Matrix B)
B - another matrixpublic final Matrix timesTranspose(Vector B)
B - another matrixpublic final double euclideanLength()
public final Vector normalize()
public final Vector projection(Matrix v)
v - the subspace matrixpublic final String toString()
toString in interface FeatureVector<Double>toString in class Objectpublic final String toStringNoWhitespace()
public void setZero()
public Vector rotate90Equals()
public Vector cross3D(Vector other)
this x otherother - Other vectorpublic double getMin(int dimension)
SpatialComparablegetMin in interface SpatialComparabledimension - the dimension for which the coordinate should be returned,
        where 0 ≤ dimension < getDimensionality()public double getMax(int dimension)
SpatialComparablegetMax in interface SpatialComparabledimension - the dimension for which the coordinate should be returned,
        where 0 ≤ dimension < getDimensionality()@Deprecated public Double getValue(int dimension)
FeatureVectorgetValue in interface FeatureVector<Double>getValue in interface NumberVector<Double>dimension - the desired dimension, where 1 ≤ dimension ≤
        this.getDimensionality()public double doubleValue(int dimension)
NumberVectorgetValue(dim).doubleValue(), but usually this is much more
 efficient due to boxing/unboxing cost.doubleValue in interface NumberVector<Double>dimension - the desired dimension, where 0 ≤ dimension <
        this.getDimensionality()public float floatValue(int dimension)
NumberVectorgetValue(dim).floatValue(), but usually this is much more efficient
 due to boxing/unboxing cost.floatValue in interface NumberVector<Double>dimension - the desired dimension, where 0 ≤ dimension <
        this.getDimensionality()public int intValue(int dimension)
NumberVectorgetValue(dim).intValue(), but usually this is much more efficient
 due to boxing/unboxing cost.intValue in interface NumberVector<Double>dimension - the desired dimension, where 0 ≤ dimension <
        this.getDimensionality()public long longValue(int dimension)
NumberVectorgetValue(dim).longValue(), but usually this is much more efficient
 due to boxing/unboxing cost.longValue in interface NumberVector<Double>dimension - the desired dimension, where 0 ≤ dimension <
        this.getDimensionality()public short shortValue(int dimension)
NumberVectorgetValue(dim).shortValue(), but usually this is much more efficient
 due to boxing/unboxing cost.shortValue in interface NumberVector<Double>dimension - the desired dimension, where 0 ≤ dimension <
        this.getDimensionality()public byte byteValue(int dimension)
NumberVectorgetValue(dim).byteValue(), but usually this is much more efficient
 due to boxing/unboxing cost.byteValue in interface NumberVector<Double>dimension - the desired dimension, where 0 ≤ dimension <
        this.getDimensionality()public Vector getColumnVector()
NumberVectorgetDimensionality() rows the values of this NumberVector of V.getColumnVector in interface NumberVector<Double>getDimensionality() rows the values of this
         NumberVector of V