org.uacalc.util
Class Horner

java.lang.Object
  extended by org.uacalc.util.Horner

public final class Horner
extends java.lang.Object

This has static methods for the Horner encoding and its inverse.


Constructor Summary
protected Horner()
           
 
Method Summary
static int horner(int[] args, int size)
          Returns the Horner encoding of an int array representing an element from a direct product of algebras all with the same size, such as a direct power.
static int horner(int[] args, int[] sizes)
          Returns the Horner encoding of an int array representing an element from a direct product of algebras with various sizes.
static int horner(java.lang.Integer[] args, int size)
          Returns the Horner encoding of an int array representing an element from a direct product of algebras with the same size.
static int[] hornerInv(int k, int[] sizes)
          Returns the int array corresponding to this Horner encoding for a direct product of algebras with various sizes.
static int[] hornerInv(int k, int[] sizes, int[] dest)
          Returns the int array corresponding to this Horner encoding for a direct product of algebras with various sizes.
static int[] hornerInv(int k, int size, int length)
          Returns the int array corresponding to this Horner encoding for a direct product of algebras with the same size.
static int[] hornerInv(int k, int size, int len, int[] dest)
          Returns the int array corresponding to this Horner encoding for a direct product of algebras with the same size.
static int[] leftRightReverse(int[] values, int algSize, int arity)
          If values are the values of a function at [0,0, ...,0], [1,0,...,0], this gives the values in the order [0,0, ...,0], [0,0,...,1], ...
static void main(java.lang.String[] args)
           
static int[] reverseArray(int[] arr)
          A convenience method for generating a new array with the reverse order of the given array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Horner

protected Horner()
Method Detail

horner

public static final int horner(int[] args,
                               int[] sizes)
Returns the Horner encoding of an int array representing an element from a direct product of algebras with various sizes.

Parameters:
args - the element of the direct product.
sizes - the sizes of the algebras. It should have the same length as args.

hornerInv

public static final int[] hornerInv(int k,
                                    int[] sizes)
Returns the int array corresponding to this Horner encoding for a direct product of algebras with various sizes.

Parameters:
k - the Horner encoding of the element of the direct product.
sizes - the sizes of the algebras.

hornerInv

public static final int[] hornerInv(int k,
                                    int[] sizes,
                                    int[] dest)
Returns the int array corresponding to this Horner encoding for a direct product of algebras with various sizes.

Parameters:
k - the Horner encoding of the element of the direct product.
sizes - the sizes of the algebras.
dest - an array to hold the answer; if null a new array is made.

horner

public static final int horner(int[] args,
                               int size)
Returns the Horner encoding of an int array representing an element from a direct product of algebras all with the same size, such as a direct power.

Parameters:
args - the element of the direct product.
size - the size of the algebras.

hornerInv

public static final int[] hornerInv(int k,
                                    int size,
                                    int length)
Returns the int array corresponding to this Horner encoding for a direct product of algebras with the same size.

Parameters:
k - the Horner encoding of the element of the direct product.
size - the size of each algebra.
length - the number of algebras.

hornerInv

public static final int[] hornerInv(int k,
                                    int size,
                                    int len,
                                    int[] dest)
Returns the int array corresponding to this Horner encoding for a direct product of algebras with the same size.

Parameters:
k - the Horner encoding of the element of the direct product.
size - the size of each algebra.
len - the number of algebras.
dest - an array to hold the answer; if null a new array is made.

horner

public static final int horner(java.lang.Integer[] args,
                               int size)
Returns the Horner encoding of an int array representing an element from a direct product of algebras with the same size.

Parameters:
args - the element of the direct product.
size - the size of each algebra.

reverseArray

public static int[] reverseArray(int[] arr)
A convenience method for generating a new array with the reverse order of the given array.


leftRightReverse

public static int[] leftRightReverse(int[] values,
                                     int algSize,
                                     int arity)
If values are the values of a function at [0,0, ...,0], [1,0,...,0], this gives the values in the order [0,0, ...,0], [0,0,...,1], ... .


main

public static void main(java.lang.String[] args)


Copyright 2003 Ralph Freese. All Rights Reserved.