plf
Class Function_2D

java.lang.Object
  extended by plf.Function_2D

public class Function_2D
extends java.lang.Object

This class allows the user to define a piecewise linear function over a 2-dimensional domain. Each dimension is divided into equally spaced intervals, but the separate dimensions can have different spacing and different numbers of points.


Constructor Summary
Function_2D(java.lang.String name, int[] dim_counts, double[] min_x_values, double[] max_x_values, double[] y_values)
          The constructor stores the function value defintions.
 
Method Summary
 double getValue(double[] x_values)
          Get the function value for a given input value.
 void Print()
          Formats the function definition into a string and prints it.
 java.lang.String toString()
          Formats the function definition into a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Function_2D

public Function_2D(java.lang.String name,
                   int[] dim_counts,
                   double[] min_x_values,
                   double[] max_x_values,
                   double[] y_values)
            throws java.lang.Exception
The constructor stores the function value defintions. The min_x-values and max_x_values represent the domain extents in each dimension for the function. The y_values must be the values for equally spaced x_values, including the bounds of the domain extents. This function assumes that the sequence of value pairs defines an adequate approximation of a continuous function over the intervals of x_values in all dimensions.

Parameters:
name - The name of the function represented.
dim_counts - The number of points per dimension axis.
min_x_values - The minimum x_values.
max_x_values - The maximum x_values.
y_values - The array of y-axis values.
Throws:
java.lang.Exception - if discrepencies are identified.
Method Detail

getValue

public double getValue(double[] x_values)
                throws java.lang.Exception
Get the function value for a given input value.

Parameters:
x_values - the arguments in each dimension to the function.
Returns:
the y_value approximation.
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Formats the function definition into a string.

Overrides:
toString in class java.lang.Object

Print

public void Print()
Formats the function definition into a string and prints it.