|
|
|||||||||||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||||||||||
java.lang.Objectde.lmu.ifi.dbs.elki.math.linearalgebra.Matrix
de.lmu.ifi.dbs.elki.math.linearalgebra.Vector
public class Vector
Provides a vector object that encapsulates an m x 1 - matrix object.
| Field Summary | |
|---|---|
private static long |
serialVersionUID
Serial version |
| Fields inherited from class de.lmu.ifi.dbs.elki.math.linearalgebra.Matrix |
|---|
DELTA |
| Constructor Summary | |
|---|---|
Vector(double[] values)
Construct a vector from a given array. |
|
Vector(int m)
Provides an m x 1 vector. |
|
| Method Summary | |
|---|---|
private void |
checkDimensions(Vector v)
Check if this.getDimensionality() == v.getDimensionality(). |
Vector |
copy()
Returns a copy of this vector. |
double |
get(int i)
Returns the value at the specified row. |
int |
getDimensionality()
Returns the dimensionality of this vector. |
Vector |
inverseVector()
Inverts every element of the vector. |
double |
length()
Returns the length of this vector. |
Vector |
minus(Vector v)
Returns this vector minus the specified vector v. |
void |
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. |
static Vector |
randomNormalizedVector(int dimensionality)
Returns a randomly created vector of length 1.0 |
double |
scalarProduct(Vector v)
Returns the scalar product of this vector and the specified vector v. |
void |
set(int i,
double value)
Sets the value at the specified row. |
Vector |
sqrtVector()
Square roots every element of the vector. |
Vector |
times(double s)
Returns a new vector which is the result of this vector multiplied by the specified scalar. |
String |
toString()
Returns a string representation of this vector. |
String |
toString(NumberFormat nf)
Returns a string representation of this vector. |
String |
toStringNoWhitespace()
Returns a string representation of this vector without adding extra whitespace |
static Vector |
unitVector(int dimensionality,
int i)
Returns the ith unit vector of the specified dimensionality. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
| Constructor Detail |
|---|
public Vector(double[] values)
values - array of doublespublic Vector(int m)
m - the number of rows| Method Detail |
|---|
public double get(int i)
i - the row index
public void set(int i,
double value)
i - the row indexvalue - the value to be setpublic Vector inverseVector()
public Vector sqrtVector()
public Vector minus(Vector v)
v - the vector to be subtracted from this vector
public double scalarProduct(Vector v)
v - the vector
public double length()
public int getDimensionality()
public void normalize()
public Vector plus(Vector v)
v - the vector to be added
public Vector times(double s)
times in class Matrixs - the scalar to be multiplied
public static Vector randomNormalizedVector(int dimensionality)
dimensionality - dimensionality
public static Vector unitVector(int dimensionality,
int i)
dimensionality - the dimensionality of the vectori - the index
public Vector copy()
copy in class Matrixpublic String toStringNoWhitespace()
public String toString()
toString in class Matrixpublic String toString(NumberFormat nf)
toString in class Matrixnf - a NumberFormat to specify the output precision
private void checkDimensions(Vector v)
IllegalArgumentException - if the dimensions do not agree
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||