|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jscience.computing.kmeans.Coordinate
public class Coordinate
Represents a single sample of data.
Constructor Summary | |
---|---|
Coordinate(double[] coordinates)
Builds a new coordinate from a list of doubles. |
|
Coordinate(int dimension)
Constructs a coordinate initialized to origin in given dimension. |
|
Coordinate(java.lang.String sample)
Generates a single sample of data given a string description. |
Method Summary | |
---|---|
Coordinate |
add(Coordinate other)
Adds this coordinate to another one. |
int |
dimension()
Returns the dimension this sample exists in. |
double |
distance(Coordinate other)
Returns the squared euclidean distance between this point and another. |
boolean |
equals(java.lang.Object othercoordinate)
|
double |
get(int index)
For accessing the data in this sample. |
Coordinate |
scale(double scale)
Scales the coordinate using scalar multiplication. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Coordinate(java.lang.String sample)
sample
- A string containing a sequence of tokens, with one
real coordinate per token.public Coordinate(double[] coordinates)
coordinates
- A list of coordinates.public Coordinate(int dimension)
dimension
- The dimension of the coordinate to create.Method Detail |
---|
public boolean equals(java.lang.Object othercoordinate)
equals
in class java.lang.Object
othercoordinate
- The other coordinate to compare this one to.
public int dimension()
public double get(int index)
index
- The index to extract.
public double distance(Coordinate other)
other
- The other point.
public Coordinate add(Coordinate other)
other
- The other operand.
public Coordinate scale(double scale)
scale
- The value to scale all dimensions by.
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |