edu.ucla.belief
Class TableScaled

Object
  extended by Table
      extended by TableScaled
All Implemented Interfaces:
CPTInfo.ReadableWritableTable, Potential, Cloneable

public class TableScaled
extends Table


Field Summary
 
Fields inherited from class Table
FLAG_DEBUG, FLAG_DEBUG_STATE_MODIFICATION, ONE, ZERO
 
Constructor Summary
TableScaled(FiniteVariable[] vars, double scalar)
          Creates a new table that has a TableIndex generated from the variables supplied.
TableScaled(List variables, double scalar)
          Creates a new table that has a TableIndex generated from the variables supplied.
TableScaled(List variables, double[] values, double scalar)
          Creates a new table that has a TableIndex generated from the variables supplied.
TableScaled(Object[] vars, double[] values, double scalar)
          Creates a new table that has a TableIndex generated from the variables supplied.
TableScaled(Table t)
          Creates a copy of the table.
TableScaled(Table t, double scalar)
          Creates a copy of the table.
TableScaled(TableIndex index, double scalar)
          Creates a table with the supplied index.
TableScaled(TableIndex index, double[] values, double scalar)
          Creates a new Table.
 
Method Summary
 Object clone()
           
static Table createTable(TableIndex indx, double scalar)
           
static Table createTable(TableIndex indx, double[] data, double scalar, boolean scaleData)
           
 double[] dataclone()
          Will return a copy of the data array which has already been scaled to real probability values.
 Table expand(FiniteVariable var)
           
 void fill(double value)
           
 Table forget(Set vars)
           
 double getCP(int ind)
           
 double getCPScaled(int ind)
           
 double getCPScaled(int[] indices)
           
static Table innerProduct(Table t1, Table t2)
           
static double logsum(double lna, double lnb)
          Copied from edu.ucla.belief.recursiveconditioning.RCUtilities
 void makeUniform()
           
 Table multiply(Table t2)
           
static Table multiplyAll(Set tables)
           
 void multiplyInto(Table t2)
           
 void normalize(int conditionIndex)
           
 double scalar()
           
 void set(Table t)
          Copies the values from another compatible array.
 void setCP(int indx, double val)
           
 Table shrink(Map evidence)
           
static double sum(double[] values, double scalar, int startindex, int endindex)
           
 double toRealPr(double in)
           
 double[] toRealPr(double[] in)
           
static double[] toRealPr(double[] in, double scalar)
           
static double toRealPr(double in, double scalar)
           
 double toScaled(double in)
           
 double[] toScaled(double[] in)
           
static double[] toScaled(double[] in, double scalar)
           
static double toScaled(double in, double scalar)
           
 
Methods inherited from class Table
add, addInto, addIntoTrivial, addIntoTrivialScale, distanceMeasure, distanceMeasure, divide, divideInto, ensureCPTProperty, ensureNonsingular, entropy, epsilonEquals, forget, getCPLength, index, insertState, isSingular, isValidProbability, max, maxInd, min, multiply, myLog, normalize, normalize, parentStateInserted, parentStateRemoved, permute, printArr, printArr, printArr, printArr, printArrScaled, printArrUnScaled, project, random, removeState, replaceVariables, replaceVariables, satisfiesCPTProperty, scale, setValue, setValues, shrinkAll, sum, tableString, tableString, toString, value, value, valueElimination, variables
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableScaled

public TableScaled(Table t)
Creates a copy of the table. The values stored are replicated, not shared.


TableScaled

public TableScaled(Table t,
                   double scalar)
Creates a copy of the table. The values stored are replicated, not shared.

Since:
072803

TableScaled

public TableScaled(TableIndex index,
                   double scalar)
Creates a table with the supplied index.


TableScaled

public TableScaled(TableIndex index,
                   double[] values,
                   double scalar)
Creates a new Table.

Parameters:
index - This is used directly (not copied).
values - These are used directly (not copied).

TableScaled

public TableScaled(List variables,
                   double scalar)
Creates a new table that has a TableIndex generated from the variables supplied.


TableScaled

public TableScaled(List variables,
                   double[] values,
                   double scalar)
Creates a new table that has a TableIndex generated from the variables supplied.

Parameters:
values - These are used directly (not copied).

TableScaled

public TableScaled(FiniteVariable[] vars,
                   double scalar)
Creates a new table that has a TableIndex generated from the variables supplied.


TableScaled

public TableScaled(Object[] vars,
                   double[] values,
                   double scalar)
Creates a new table that has a TableIndex generated from the variables supplied.

Parameters:
values - These are used directly (not copied).
Method Detail

scalar

public double scalar()
Overrides:
scalar in class Table

toScaled

public double toScaled(double in)

toScaled

public double[] toScaled(double[] in)

toScaled

public static double toScaled(double in,
                              double scalar)

toScaled

public static double[] toScaled(double[] in,
                                double scalar)

toRealPr

public double toRealPr(double in)

toRealPr

public double[] toRealPr(double[] in)

toRealPr

public static double toRealPr(double in,
                              double scalar)

toRealPr

public static double[] toRealPr(double[] in,
                                double scalar)

normalize

public void normalize(int conditionIndex)
               throws Exception
Overrides:
normalize in class Table
Throws:
Exception
Since:
110102

sum

public static double sum(double[] values,
                         double scalar,
                         int startindex,
                         int endindex)
                  throws Exception
Throws:
Exception
Since:
110102

makeUniform

public void makeUniform()
Overrides:
makeUniform in class Table
Since:
110102

clone

public Object clone()
Specified by:
clone in interface Potential
Overrides:
clone in class Table

dataclone

public double[] dataclone()
Will return a copy of the data array which has already been scaled to real probability values.

Overrides:
dataclone in class Table

getCP

public double getCP(int ind)
Specified by:
getCP in interface CPTInfo.ReadableWritableTable
Overrides:
getCP in class Table

getCPScaled

public double getCPScaled(int ind)
Overrides:
getCPScaled in class Table

getCPScaled

public double getCPScaled(int[] indices)
Overrides:
getCPScaled in class Table

setCP

public void setCP(int indx,
                  double val)
Specified by:
setCP in interface CPTInfo.ReadableWritableTable
Overrides:
setCP in class Table

fill

public void fill(double value)
Overrides:
fill in class Table

set

public void set(Table t)
Copies the values from another compatible array. The orderings of the two tables must be the same for it to work meaningfully.

Overrides:
set in class Table

multiplyInto

public void multiplyInto(Table t2)
Overrides:
multiplyInto in class Table

multiply

public Table multiply(Table t2)
Overrides:
multiply in class Table

multiplyAll

public static Table multiplyAll(Set tables)

expand

public Table expand(FiniteVariable var)
Overrides:
expand in class Table

forget

public Table forget(Set vars)
Overrides:
forget in class Table

logsum

public static final double logsum(double lna,
                                  double lnb)
Copied from edu.ucla.belief.recursiveconditioning.RCUtilities

Since:
20081110 Compute ln(a+b) from ln(a) and ln(b) using the log sum equation. Its possible that lna and/or lnb might be NaN, or pos/neg infin. If lna or lnb are NaN, the result is NaN. If lna=lnb=negInf, then (a=b=0 and ln(0)=negInf) return negInf. If lna=negInf or lnb=negInf return other one. If lna or lnb are posInf, then (a or b =posInf and ln(posInf=posInf) return posInf.

shrink

public Table shrink(Map evidence)
Overrides:
shrink in class Table

innerProduct

public static Table innerProduct(Table t1,
                                 Table t2)

createTable

public static Table createTable(TableIndex indx,
                                double[] data,
                                double scalar,
                                boolean scaleData)

createTable

public static Table createTable(TableIndex indx,
                                double scalar)


Copyright 2010 UCLA Automated Reasoning Group