de.aitools.aq.algebra.vector
Class Vector

java.lang.Object
  extended by de.aitools.aq.algebra.vector.Representation
      extended by 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.
 
Constructor Summary
Vector()
           
Vector(double[] values)
           
Vector(int capacity)
           
Vector(Vector vector)
           
 
Method Summary
 void add(double[] values)
           
 void add(int index, double value)
           
 void add(Vector vector)
           
static Vector centroid(java.lang.Iterable<Vector> vectors)
           
 void compact()
           
 boolean contains(int index)
           
 double dot(double[] values)
           
 double dot(Vector vector)
           
 boolean equals(java.lang.Object obj)
           
 double get(int index)
           
 int[] indices()
           
 boolean isNormalized()
           
 java.util.Iterator<Vector.Entry> iterator()
           
 void multiply(double[] values)
           
 void multiply(Vector vector)
           
static Vector multiply(Vector vector, double[] values)
           
static Vector multiply(Vector v1, Vector v2)
           
 double norm2()
           
 void normalize()
           
 int range()
          Returns the upper bound of valid indices.
 void scale(double alpha)
           
 void set(int index, double value)
           
 int size()
          Returns the number of elements with existing mapping.
 java.lang.String toString()
           
 void zero()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector

public Vector()

Vector

public Vector(double[] values)

Vector

public Vector(int capacity)

Vector

public Vector(Vector vector)
Method Detail

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