uk.ac.gla.dcs.renaissance.iqir
Class DensityMerger

java.lang.Object
  extended by uk.ac.gla.dcs.renaissance.iqir.DensityMerger

public class DensityMerger
extends Object

This class is a tool to merge different densities on a sparse space

Author:
B. Piwowarski

Constructor Summary
DensityMerger(boolean superpose)
          Initialise with no maximum rank
DensityMerger(boolean superpose, int maxRank)
          Build a new density merger
 
Method Summary
 void addDensity(String name, double weight, Density density, double logCardinality, bpiwowar.maths.matrix.DoubleMatrix1D sum)
          Add a density
 void addDensity(String name, double weight, int[] localToGobalTermIdMap, bpiwowar.maths.matrix.DiagonalDoubleMatrix mS, bpiwowar.maths.matrix.DoubleMatrix2D mU, double logCardinality, bpiwowar.maths.matrix.DoubleMatrix1D sum)
          Add a new density (represented as a set of weighted vectors), which should be normalised
 void addDensity(String name, WeightedVectorSet ds)
          Add a weighted vector set
 void computeMergedTracker(bpiwowar.log.TaskTimer timer)
          Do a series of rank one update that corresponds to the desired operation (mixture or mixture of superpositions)
 String getName()
          Get the name of the merged components
 double getTotalWeight()
          Return the sum of weights
 DensityTracker getTracker()
           
 boolean isEmpty()
          Returns true if the mixture is empty (i.e.
 boolean isMixtureOfSuperposition()
           
 Density merge(bpiwowar.log.TaskTimer timer)
          Merge the added densities
 WeightedVectorSet mergeWithSum(bpiwowar.log.TaskTimer timer)
          Compute the resulting density and the associated sum of vectors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DensityMerger

public DensityMerger(boolean superpose,
                     int maxRank)
Build a new density merger

Parameters:
superpose - Should we superpose the different densities?

DensityMerger

public DensityMerger(boolean superpose)
Initialise with no maximum rank

Parameters:
superpose -
Method Detail

isMixtureOfSuperposition

public boolean isMixtureOfSuperposition()

addDensity

public void addDensity(String name,
                       WeightedVectorSet ds)
Add a weighted vector set

Parameters:
name -
ds - The set

addDensity

public void addDensity(String name,
                       double weight,
                       Density density,
                       double logCardinality,
                       bpiwowar.maths.matrix.DoubleMatrix1D sum)
Add a density

Parameters:
name -
weight -
density -
logCardinality -
sum -

addDensity

public void addDensity(String name,
                       double weight,
                       int[] localToGobalTermIdMap,
                       bpiwowar.maths.matrix.DiagonalDoubleMatrix mS,
                       bpiwowar.maths.matrix.DoubleMatrix2D mU,
                       double logCardinality,
                       bpiwowar.maths.matrix.DoubleMatrix1D sum)
Add a new density (represented as a set of weighted vectors), which should be normalised

Parameters:
name -
localToGobalTermIdMap - Local to global term map
mS -
mU -
sum - The sum of vectors that were used to build this density
cardinality - The cardinality of the set used to build the density
weight - The weight associated to this density

getName

public String getName()
Get the name of the merged components


getTotalWeight

public double getTotalWeight()
Return the sum of weights


mergeWithSum

public WeightedVectorSet mergeWithSum(bpiwowar.log.TaskTimer timer)
Compute the resulting density and the associated sum of vectors

Parameters:
timer - The timer
Returns:
The new density

merge

public Density merge(bpiwowar.log.TaskTimer timer)
Merge the added densities

Parameters:
timer -
Returns:

computeMergedTracker

public void computeMergedTracker(bpiwowar.log.TaskTimer timer)
Do a series of rank one update that corresponds to the desired operation (mixture or mixture of superpositions)

Parameters:
timer - The timer for time related informations

getTracker

public DensityTracker getTracker()
Returns:
the tracker

isEmpty

public boolean isEmpty()
Returns true if the mixture is empty (i.e. nothing to mix)



Copyright © 2011. All Rights Reserved.