de.aitools.aq.algebra.vector
Class Vector
java.lang.Object
de.aitools.aq.algebra.vector.Representation
de.aitools.aq.algebra.vector.Vector
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<Vector.Entry>
public class Vector
- extends Representation
- implements java.lang.Iterable<Vector.Entry>, java.io.Serializable
- Author:
- martin.potthast@uni-weimar.de, martin.trenkmann@uni-weimar.de
- See Also:
- Serialized Form
Nested Class Summary |
static interface |
Vector.Entry
Entry type returned by the vector iterator's next method. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Vector
public Vector()
Vector
public Vector(double[] values)
Vector
public Vector(int capacity)
Vector
public Vector(Vector vector)
add
public void add(int index,
double value)
add
public void add(double[] values)
add
public void add(Vector vector)
centroid
public static Vector centroid(java.lang.Iterable<Vector> vectors)
compact
public void compact()
contains
public boolean contains(int index)
dot
public double dot(double[] values)
dot
public double dot(Vector vector)
get
public double get(int index)
indices
public int[] indices()
isNormalized
public boolean isNormalized()
iterator
public java.util.Iterator<Vector.Entry> iterator()
- Specified by:
iterator
in interface java.lang.Iterable<Vector.Entry>
multiply
public void multiply(double[] values)
multiply
public void multiply(Vector vector)
norm2
public double norm2()
normalize
public void normalize()
range
public int range()
- Returns the upper bound of valid indices. This value is equal to the
greatest valid index +1. All keys returned within an iteration by
Map.Entry.getKey()
are smaller.
- Returns:
- a range value which is max_index +1.
scale
public void scale(double alpha)
set
public void set(int index,
double value)
size
public int size()
- Returns the number of elements with existing mapping. This number is
equal to the number of times you can call
Iterator.next()
on the
iterator returned by iterator()
.
- Returns:
- the number of existing mappings.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
zero
public void zero()
multiply
public static Vector multiply(Vector vector,
double[] values)
multiply
public static Vector multiply(Vector v1,
Vector v2)
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object