uk.ac.gla.dcs.renaissance.kqpr
Class KernelVectorList<T extends KernelVector>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<T>
          extended by uk.ac.gla.dcs.renaissance.kqpr.KernelVectorList<T>
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>
Direct Known Subclasses:
SparseVectors

public abstract class KernelVectorList<T extends KernelVector>
extends AbstractList<T>

This class holds a list of vectors whose exact representation might not be known. All sub-classes must implement basic list operations (add, remove).

Author:
B. Piwowarski

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
KernelVectorList()
           
 
Method Summary
 boolean canLinearlyCombine()
          Returns true if the vectors can be linearly combined
abstract  double computeInnerProduct(int i, T vector)
          Computes the inner product between a given vector and the ith vector of the list
protected  bpiwowar.maths.matrix.DenseDoubleMatrix2D computeInnerProducts(KernelVectorList<T> other)
           
 double[] computeInnerProducts(T vector)
          Compute the inner products with each of the vectors.
 T linearCombination(double[] lambdas)
          Computes a linear combination.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

KernelVectorList

public KernelVectorList()
Method Detail

computeInnerProduct

public abstract double computeInnerProduct(int i,
                                           T vector)
Computes the inner product between a given vector and the ith vector of the list

Parameters:
i - The index of the vector in the list
vector - The vector provided
Returns:
The inner product between both vectors

computeInnerProducts

protected bpiwowar.maths.matrix.DenseDoubleMatrix2D computeInnerProducts(KernelVectorList<T> other)

computeInnerProducts

public double[] computeInnerProducts(T vector)
Compute the inner products with each of the vectors. This method might be re-implemented for efficiency reason, and by default calls iteratively #computeInnerProduct(int, Object).

Parameters:
vector - The vector with which the inner product is computed each time
Returns:
A series of inner products, one for each of the base vectors

canLinearlyCombine

public boolean canLinearlyCombine()
Returns true if the vectors can be linearly combined


linearCombination

public T linearCombination(double[] lambdas)
                                         throws UnsupportedOperationException
Computes a linear combination.

Returns:
a new BaseVectorList object
Throws:
UnsupportedOperationException - If the object does not support linear combinations. This is implied if canLinearlyCombine() returns false


Copyright © 2011. All Rights Reserved.