org.uacalc.alg
Class BigProductAlgebra

java.lang.Object
  extended by org.uacalc.alg.GeneralAlgebra
      extended by org.uacalc.alg.BigProductAlgebra
All Implemented Interfaces:
Algebra

public class BigProductAlgebra
extends GeneralAlgebra
implements Algebra

This class represents the direct product of SmallAlgebras which is too big to be a SmallAlgebra. We use IntArray for the elements of the unverse. After we have a real element scheme, we'll use that.

Version:
$Id: BigProductAlgebra.java,v 1.36 2009/02/26 00:28:14 ralphfreese Exp $
Author:
Ralph Freese

Field Summary
protected  java.util.List<SmallAlgebra> algebras
           
protected  int cardinality
          -2 indicates the value has not been calculated; -1 that it is too big to be an int.
protected  java.util.List<IntArray> constants
           
protected  java.util.Map<IntArray,OperationSymbol> constantToSymbol
           
protected  int numberOfFactors
           
protected  int[] powers
           
protected  java.util.List<SmallAlgebra> rootAlgebras
           
protected  int[] sizes
           
 
Fields inherited from class org.uacalc.alg.GeneralAlgebra
con, description, monitor, name, operations, operationsMap, similarityType, size, sub, universe
 
Fields inherited from interface org.uacalc.alg.Algebra
CARDINALITY_COUNTABLE, CARDINALITY_COUNTABLY_INFINITE, CARDINALITY_FINITE, CARDINALITY_INFINITE, CARDINALITY_UNKNOWN
 
Constructor Summary
protected BigProductAlgebra()
           
  BigProductAlgebra(java.util.List<SmallAlgebra> algs)
          Construct the direct product of a List of SmallAlgebra's.
  BigProductAlgebra(java.util.List<SmallAlgebra> algs, int[] powers)
          Construct the direct product of a List of SmallAlgebra's raised to various powers.
  BigProductAlgebra(SmallAlgebra alg, int power)
          Construct the direct power of a SmallAlgebra.
protected BigProductAlgebra(java.lang.String name)
           
  BigProductAlgebra(java.lang.String name, java.util.List<SmallAlgebra> algs)
          Construct the direct product of a List of SmallAlgebra's.
  BigProductAlgebra(java.lang.String name, java.util.List<SmallAlgebra> algs, int[] powers)
          Construct the direct product of a List of SmallAlgebra's raised to various powers.
  BigProductAlgebra(java.lang.String name, SmallAlgebra alg, int power)
          Construct the direct power of a SmallAlgebra.
 
Method Summary
 int cardinality()
          If this is larger than an int, return -1.
 java.util.List<SmallAlgebra> factors()
           
 java.util.List<IntArray> getConstants()
           
 OperationSymbol getConstantSymbol(IntArray constant)
           
 Term getConstantTerm(IntArray constant)
           
 int getNumberOfFactors()
           
 int[] getPowers()
           
 boolean isPower()
          Test if this is a power of a single algebra.
static void main(java.lang.String[] args)
           
protected  void makeOperations()
          For speed we have make all operations on the coordinates into int operations with a lookup table.
 void makeOperationTables()
          Make operation tables to speed up the evaluation of operations at the cost using more space.
 SmallAlgebra projection(int k)
           
 BasicPartition projectionKernel(int k)
          Don't use this yet; it is not implemented.
 java.util.List<SmallAlgebra> rootFactors()
           
 java.util.List sgClose_old(java.util.List elems, int closedMark, java.util.Map termMap, java.lang.Object elt, ProgressReport report)
          Closure of elems under the operations.
 java.util.List<IntArray> sgClose(java.util.List<IntArray> elems)
          Closure of elems under the operations.
 java.util.List<IntArray> sgClose(java.util.List<IntArray> elems, int closedMark, java.util.Map<IntArray,Term> termMap)
          Closure of elems under the operations.
 java.util.List<IntArray> sgClose(java.util.List<IntArray> elems, int closedMark, java.util.Map<IntArray,Term> termMap, IntArray elt, ProgressReport report)
          Closure of elems under the operations.
 java.util.List<IntArray> sgClose(java.util.List<IntArray> elems, java.util.Map<IntArray,Term> termMap)
          Closure of elems under the operations.
 java.util.List<IntArray> sgClose(java.util.List<IntArray> elems, java.util.Map<IntArray,Term> termMap, IntArray elt)
          Closure of elems under the operations.
 java.util.List<IntArray> sgClose(java.util.List<IntArray> elems, java.util.Map<IntArray,Term> termMap, IntArray elt, ProgressReport report)
           
 java.util.List sgCloseXX(java.util.List elems, int closedMark, java.util.Map termMap, java.lang.Object elt)
          Closure of elems under the operations.
 java.util.SortedMap<java.lang.Integer,java.lang.Integer> sizeMultiplicities()
           
 
Methods inherited from class org.uacalc.alg.GeneralAlgebra
con, constantOperations, getDescription, getMonitor, getName, getOperation, getOperationsMap, inputSize, isIdempotent, isSimilarTo, isTotal, isUnary, iterator, monitoring, operations, parent, parents, resetConAndSub, setDescription, setMonitor, setName, setOperations, setUniverse, similarityType, sub, universe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.uacalc.alg.Algebra
constantOperations, getDescription, getMonitor, getName, getOperation, getOperationsMap, inputSize, isIdempotent, isSimilarTo, isTotal, isUnary, iterator, monitoring, operations, setDescription, setMonitor, setName, similarityType, universe
 

Field Detail

algebras

protected java.util.List<SmallAlgebra> algebras

sizes

protected int[] sizes

numberOfFactors

protected int numberOfFactors

constants

protected java.util.List<IntArray> constants

constantToSymbol

protected java.util.Map<IntArray,OperationSymbol> constantToSymbol

cardinality

protected int cardinality
-2 indicates the value has not been calculated; -1 that it is too big to be an int.


rootAlgebras

protected java.util.List<SmallAlgebra> rootAlgebras

powers

protected int[] powers
Constructor Detail

BigProductAlgebra

protected BigProductAlgebra()

BigProductAlgebra

protected BigProductAlgebra(java.lang.String name)

BigProductAlgebra

public BigProductAlgebra(java.util.List<SmallAlgebra> algs)
Construct the direct product of a List of SmallAlgebra's.


BigProductAlgebra

public BigProductAlgebra(java.lang.String name,
                         java.util.List<SmallAlgebra> algs)
Construct the direct product of a List of SmallAlgebra's.


BigProductAlgebra

public BigProductAlgebra(SmallAlgebra alg,
                         int power)
Construct the direct power of a SmallAlgebra.


BigProductAlgebra

public BigProductAlgebra(java.lang.String name,
                         SmallAlgebra alg,
                         int power)
Construct the direct power of a SmallAlgebra.


BigProductAlgebra

public BigProductAlgebra(java.util.List<SmallAlgebra> algs,
                         int[] powers)
Construct the direct product of a List of SmallAlgebra's raised to various powers.

Parameters:
algs - a list of SmallAlgebras.
powers - an array of powers, one for each algebra in algs.

BigProductAlgebra

public BigProductAlgebra(java.lang.String name,
                         java.util.List<SmallAlgebra> algs,
                         int[] powers)
Construct the direct product of a List of SmallAlgebra's raised to various powers.

Parameters:
algs - a list of SmallAlgebras.
powers - an array of powers, one for each algebra in algs.
Method Detail

makeOperations

protected void makeOperations()
For speed we have make all operations on the coordinates into int operations with a lookup table. This could cause space problems. And we directly generate the Horner encoding for the lookup to speed things up.

If space becomes an issue, we could make sure if the valueTables for an operation on different coordinates happen to be equal, they are identical.


makeOperationTables

public void makeOperationTables()
Description copied from interface: Algebra
Make operation tables to speed up the evaluation of operations at the cost using more space.

Specified by:
makeOperationTables in interface Algebra
Overrides:
makeOperationTables in class GeneralAlgebra
See Also:
Operation.makeTable

getConstants

public java.util.List<IntArray> getConstants()

getConstantSymbol

public OperationSymbol getConstantSymbol(IntArray constant)

getConstantTerm

public Term getConstantTerm(IntArray constant)

cardinality

public int cardinality()
If this is larger than an int, return -1.

Specified by:
cardinality in interface Algebra
Overrides:
cardinality in class GeneralAlgebra
Returns:
the cardinality if possible, else a negative int

factors

public java.util.List<SmallAlgebra> factors()

getPowers

public int[] getPowers()

isPower

public boolean isPower()
Test if this is a power of a single algebra.


rootFactors

public java.util.List<SmallAlgebra> rootFactors()

getNumberOfFactors

public int getNumberOfFactors()

projection

public SmallAlgebra projection(int k)

sizeMultiplicities

public java.util.SortedMap<java.lang.Integer,java.lang.Integer> sizeMultiplicities()

projectionKernel

public BasicPartition projectionKernel(int k)
Don't use this yet; it is not implemented.


sgClose

public java.util.List<IntArray> sgClose(java.util.List<IntArray> elems)
Closure of elems under the operations. (Worry about nullary ops later.)

Parameters:
elems - a List of IntArray's
Returns:
a List of IntArray's.

sgClose

public java.util.List<IntArray> sgClose(java.util.List<IntArray> elems,
                                        java.util.Map<IntArray,Term> termMap)
Closure of elems under the operations. (Worry about nullary ops later.)

Parameters:
elems - a List of IntArray's
termMap - a Map from the element to the corresponding term used to generated it. The generators should be already in the Map. In other words the termMap should have the same number of entries as elems.
Returns:
a List of IntArray's.

sgClose

public java.util.List<IntArray> sgClose(java.util.List<IntArray> elems,
                                        java.util.Map<IntArray,Term> termMap,
                                        IntArray elt)
Closure of elems under the operations. (Worry about nullary ops later.)

Parameters:
elems - a List of IntArray's
termMap - a Map from the element to the corresponding term used to generated it. The generators should be already in the Map. In other words the termMap should have the same number of entries as elems.
elt - an element to search for; if found return the closure found so far.
Returns:
a List of IntArray's.

sgClose

public java.util.List<IntArray> sgClose(java.util.List<IntArray> elems,
                                        java.util.Map<IntArray,Term> termMap,
                                        IntArray elt,
                                        ProgressReport report)

sgClose

public java.util.List<IntArray> sgClose(java.util.List<IntArray> elems,
                                        int closedMark,
                                        java.util.Map<IntArray,Term> termMap)
Closure of elems under the operations. (Worry about nullary ops later.)

Parameters:
elems - a List of IntArray's
termMap - a Map from the element to the corresponding term used to generated it. The generators should be already in the Map. In other words the termMap should have the same number of entries as elems.
Returns:
a List of IntArray's.

sgClose_old

public java.util.List sgClose_old(java.util.List elems,
                                  int closedMark,
                                  java.util.Map termMap,
                                  java.lang.Object elt,
                                  ProgressReport report)
Closure of elems under the operations. (Worry about nullary ops later.)

Parameters:
elems - a List of IntArray's
termMap - a Map from the element to the corresponding term used to generated it. The generators should be already in the Map. In other words the termMap should have the same number of entries as elems.
elt - an element to search for; if found return the closure found so far.
Returns:
a List of IntArray's.

sgCloseXX

public java.util.List sgCloseXX(java.util.List elems,
                                int closedMark,
                                java.util.Map termMap,
                                java.lang.Object elt)
Closure of elems under the operations. (Worry about nullary ops later.)

Parameters:
elems - a List of IntArray's
termMap - a Map from the element to the corresponding term used to generated it. The generators should be already in the Map. In other words the termMap should have the same number of entries as elems.
elt - an element to search for; if found return the closure found so far.
Returns:
a List of IntArray's.

sgClose

public java.util.List<IntArray> sgClose(java.util.List<IntArray> elems,
                                        int closedMark,
                                        java.util.Map<IntArray,Term> termMap,
                                        IntArray elt,
                                        ProgressReport report)
Closure of elems under the operations. (Worry about nullary ops later.)

Parameters:
elems - a List of IntArray's
termMap - a Map from the element to the corresponding term used to generated it. The generators should be already in the Map. In other words the termMap should have the same number of entries as elems.
elt - an element to search for; if found return the closure found so far.
Returns:
a List of IntArray's.

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        BadAlgebraFileException
Throws:
java.io.IOException
BadAlgebraFileException


Copyright 2003 Ralph Freese. All Rights Reserved.