edu.iu.pcl.absurdist.common
Class CorrespondenceVector

java.lang.Object
  |
  +--edu.iu.pcl.absurdist.common.CorrespondenceVector
All Implemented Interfaces:
java.lang.Cloneable

public class CorrespondenceVector
extends java.lang.Object
implements java.lang.Cloneable

An instance of this class can be used to store a correspondence matrix between the two systems, or any other object of the same dimension


Field Summary
 double[][] d
           
 int m
           
 int n
           
 
Constructor Summary
CorrespondenceVector(double[][] arr)
          Creates a CorrepspondenceVector structure "wrapped around" an existing data array.
CorrespondenceVector(int n, int m)
          Creates a CorrepspondenceVector structure of the specified sizes
 
Method Summary
 double allSum()
           
 java.lang.Object clone()
          Prepares a copy of this matrix
 double[] colSum()
          Lazy evaluation for f(b)=C(All,b)=sum_a{C(a,b)}
 void daxpy(double alpha, CorrespondenceVector v)
          this += alpha * v
 double dp(CorrespondenceVector v)
          Dot product
 void flush()
          Flushes the "cached" values of row and column sums.
 double[][] getMatrix()
           
 double[] rowSum()
          Lazy evaluation for f(a)=C(a,All)=sum_b{C(a,b)}
 double sum_1_far(int a, int x, int[] neiPlusX)
           
 double sum_far_1(int a, int x, int[] neiPlusA)
           
 double sum_far_far(int a, int x, int[] neiPlusA, int[] neiPlusX)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d

public double[][] d

n

public final int n

m

public final int m
Constructor Detail

CorrespondenceVector

public CorrespondenceVector(int n,
                            int m)
Creates a CorrepspondenceVector structure of the specified sizes


CorrespondenceVector

public CorrespondenceVector(double[][] arr)
Creates a CorrepspondenceVector structure "wrapped around" an existing data array. Does *not* copy the data.

Parameters:
arr - a properly allocated rectangualr array.
Method Detail

clone

public java.lang.Object clone()
Prepares a copy of this matrix

Overrides:
clone in class java.lang.Object

flush

public void flush()
Flushes the "cached" values of row and column sums. You must call this method every time when you change the stored values.


getMatrix

public double[][] getMatrix()

rowSum

public double[] rowSum()
Lazy evaluation for f(a)=C(a,All)=sum_b{C(a,b)}


colSum

public double[] colSum()
Lazy evaluation for f(b)=C(All,b)=sum_a{C(a,b)}


allSum

public double allSum()
Returns:
sum_{a,b} C(a,b)

sum_1_far

public double sum_1_far(int a,
                        int x,
                        int[] neiPlusX)
Returns:
sum_{y in B \({x}+Nei(x)) } C(a,x)

sum_far_1

public double sum_far_1(int a,
                        int x,
                        int[] neiPlusA)
Returns:
sum_{b in A \({a}+Nei(a)) } C(b,x)

sum_far_far

public double sum_far_far(int a,
                          int x,
                          int[] neiPlusA,
                          int[] neiPlusX)
Returns:
sum_{b in A \({a}+Nei(a)) } sum_{y in B \({x}+Nei(x)) } C(b,y)

dp

public double dp(CorrespondenceVector v)
Dot product


daxpy

public void daxpy(double alpha,
                  CorrespondenceVector v)
this += alpha * v