|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.VectorG
public class VectorG
The definition of a N-dimensional vector. Normally, one uses the daugther classes, if appropriate. The base class is only a container for an N-dimensinal double array.
| Nested Class Summary | |
|---|---|
static class |
VectorG.CloneTest
Testing cloning. |
static class |
VectorG.EuclidianMetric
|
private static class |
VectorG.IComp
Special index comparator. |
static class |
VectorG.LengthComparator
Compares the length of two vectors. |
static interface |
VectorG.Metric
Interface for distance matching. |
| Field Summary | |
|---|---|
protected double[] |
a
|
| Constructor Summary | |
|---|---|
protected |
VectorG()
Empty constructor. |
|
VectorG(double[] a)
Constructs a new, n-dimensional vector. |
|
VectorG(Double[] d)
Constructs a new, n-dimensional vector. |
|
VectorG(int n)
Constructs a new nvector with the specified dimension. |
| Method Summary | ||
|---|---|---|
static VectorG |
add(VectorG s1,
VectorG s2,
VectorG dest)
Returns the addition of two vectors with equal dimension. |
|
Object |
clone()
Returns a clone of this VectorG. |
|
int |
dimension()
Returns the dimension of the vector. |
|
static Matrix |
direct(VectorG a,
VectorG b)
Returns the direct product of this vector with the argumental vector. |
|
static VectorG |
directDivide(VectorG a,
VectorG b)
Direct multiplication of the components of two vectors. |
|
static VectorG |
directMultiply(VectorG a,
VectorG b)
Direct multiplication of the components of two vectors. |
|
static double |
dot(VectorG a,
VectorG b)
Returns the scalar product of this vector with the target vector. |
|
static VectorG[] |
doubleParse(String doubletokenize)
Double-tokenizes a string such that the input is split on the semicolon (actually the OUTERLIST separator of StringTool) and each of these splits is used to parse a single vector out of it. |
|
static boolean |
equalData(VectorG[] a1,
VectorG[] a2)
Compares two arrays of vectors. |
|
boolean |
equals(Object that)
Checks for equality. |
|
static VectorG |
fillFrom(VectorG src,
VectorG dest)
Fills the destination vector into the source vector, starting from index 0. |
|
static VectorG |
fillFrom(VectorG src,
VectorG dest,
int off)
Fills the destination vector into the source vector, starting from the specified index. |
|
static VectorG |
fromDoubles(List<Double> l)
|
|
static VectorG |
fromString(String tostr)
Inversion of the toString method. |
|
double |
get(int index)
Returns coordinate with specified index. |
|
double[] |
getAsArray()
Returns the coordinates as an array of doubles. |
|
double |
getLength()
Returns the length of the vector. |
|
int |
hashCode()
A hash code for this vector. |
|
static Map<Integer,Integer> |
match(List<VectorG> l1,
List<VectorG> l2,
double diff)
Match two list of vectors in the sense that a vector of the first list is termed equal to a vector of the second list, if its VectorG.Metric.arclength(vec_math.VectorG, vec_math.VectorG) distance lies below the specified threshold. |
|
static Map<Integer,Integer> |
match(List<VectorG> l1,
List<VectorG> l2,
VectorG.Metric gij,
double diff)
Match two list of vectors in the sense that a vector of the first list is termed equal to a vector of the second list, if its VectorG.Metric.arclength(vec_math.VectorG, vec_math.VectorG) distance lies below the specified threshold. |
|
static VectorG |
multiply(double lambda,
VectorG s1,
VectorG dest)
Multiplies this vector with a scalar. |
|
static VectorG |
parse(String comma)
Parses an VectorG from a comma-separated list of doubles. |
|
static int |
search(VectorG[] sorted,
int index,
double max)
Returns the integer such that |
|
static int[] |
searchMinMax(VectorG[] data,
int coor)
Returns the index of the minimum and maximum vector component in the specified array. |
|
void |
set(int index,
double value)
Sets the coordinate with the specified index. |
|
static
|
sort(T[] unsorted,
int index)
Data must be sorted according to given indices values. |
|
static
|
sortToLength(T[] unsorted)
An array of vectors is sorted according to their length. |
|
static VectorG |
subtract(VectorG s1,
VectorG s2,
VectorG dest)
Returns the subtraction of two vectors with equal dimension. |
|
String |
toString()
Converts this vector into a String. |
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected double[] a
| Constructor Detail |
|---|
protected VectorG()
public VectorG(int n)
public VectorG(double[] a)
public VectorG(Double[] d)
| Method Detail |
|---|
public static VectorG parse(String comma)
public static VectorG fromDoubles(List<Double> l)
throws ParseException
ParseException
public static VectorG fromString(String tostr)
throws ParseException
ParseExceptionpublic static VectorG[] doubleParse(String doubletokenize)
StringTool.OUTERLISTpublic double get(int index)
index - Index in coordinate arraypublic double[] getAsArray()
public void set(int index,
double value)
index - Index in coordinate array.value - New valuepublic int dimension()
public static VectorG fillFrom(VectorG src,
VectorG dest)
public static VectorG fillFrom(VectorG src,
VectorG dest,
int off)
public static VectorG multiply(double lambda,
VectorG s1,
VectorG dest)
public static double dot(VectorG a,
VectorG b)
a⋅b = δijaibi
IllegalArgumentException - If the dimension of the two vectors are not identical.public double getLength()
public static Matrix direct(VectorG a,
VectorG b)
(a⊗b)ij=aibjNote that the direct product is not commutative.
public static VectorG directMultiply(VectorG a,
VectorG b)
v_i=v1_i*v2_i,
public static VectorG directDivide(VectorG a,
VectorG b)
v_i=v1_i/v2_i,
public static VectorG add(VectorG s1,
VectorG s2,
VectorG dest)
public static VectorG subtract(VectorG s1,
VectorG s2,
VectorG dest)
public boolean equals(Object that)
equals in class Objectthat - The VectorG to check.public String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic Object clone()
clone in class Object
public static <T extends VectorG> T[] sort(T[] unsorted,
int index)
public static <T extends VectorG> T[] sortToLength(T[] unsorted)
public static boolean equalData(VectorG[] a1,
VectorG[] a2)
public static int search(VectorG[] sorted,
int index,
double max)
VectorG[index]>=f&&VectorG[index-1]<for -1.
public static int[] searchMinMax(VectorG[] data,
int coor)
coor - Search is performed on this vector index, 0 to dimension-1.
public static Map<Integer,Integer> match(List<VectorG> l1,
List<VectorG> l2,
double diff)
VectorG.Metric.arclength(vec_math.VectorG, vec_math.VectorG) distance lies below the specified threshold. If
more than a single vector matches, the one with the smalles arclength is
considered the match. This version uses the default euclidian metric g=1
ds&pow2;=dxμ dxμ
public static Map<Integer,Integer> match(List<VectorG> l1,
List<VectorG> l2,
VectorG.Metric gij,
double diff)
VectorG.Metric.arclength(vec_math.VectorG, vec_math.VectorG) distance lies below the specified threshold. If
more than a single vector matches, the one with the smalles arclength is
considered the match. This version uses a general metric gij
ds&pow2;= gijdxi dxj
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||