uk.ac.gla.dcs.renaissance.kqpr
Class KernelVectorList<T extends KernelVector>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<T>
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
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 |
KernelVectorList
public KernelVectorList()
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 listvector
- 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.