shared
Class MLJ

java.lang.Object
  |
  +--shared.MLJ

public class MLJ
extends java.lang.Object

This class contains methods and data members that were external to classes.


Field Summary
static double clampingEpsilon
          The clamping epsilon used to determine if a real value is significantly different from another value during clamping.
static double realEpsilon
          The clamping epsilon used to determine if a real value is significantly different from another value.
static double storedRealEpsilon
          The clamping epsilon used to determine if a real value is significantly different from another value.
 
Constructor Summary
MLJ()
           
 
Method Summary
static void Abort()
          Displays an error message stating an unexpected condition was reached.
static boolean approx_equal(double[][] lhs, double[][] rhs)
          Compares two matrices of double values for equality.
static boolean approx_equal(double[][] lhs, double[][] rhs, int precisionMultiplier)
          Compares two matrices of double values for equality, using the given precisionMultiplier to drive approximate comparisons at each element.
static boolean approx_equal(double[] lhs, double[] rhs)
          Compares two arrays of double values for equality.
static boolean approx_equal(double[] lhs, double[] rhs, int precisionMultiplier)
          Compares two arrays of doubles for equality, using the given precisionMultiplier to drive approximate comparisons at each element.
static boolean approx_equal(double lhs, double rhs)
          Compares two double values for equality.
static boolean approx_equal(double lhs, double rhs, int precMultiplier)
          Compares two double values for equality, using the given precisionMultiplier to drive approximate comparisons.
static boolean approx_equal(float lhs, float rhs)
          Compares two float values for equality.
static boolean approx_equal(float lhs, float rhs, int precMultiplier)
          Compares two float values for equality.
static boolean approx_equal(java.util.Vector a, java.util.Vector b)
          Checks if two Vectors of DoubleRefs are approximately equivalent in values.
static boolean approx_greater(double lhs, double rhs)
          Checks if the left value is greater than the right value.
static boolean approx_greater(double lhs, double rhs, int precMultiplier)
          Checks if the left value is greater than the right value.
static boolean approx_less(double lhs, double rhs)
          Checks if the left value is less than the right value.
static boolean approx_less(double lhs, double rhs, int precMultiplier)
          Checks if the left value is less than the right value.
static void ASSERT(boolean theItem, java.lang.String statement)
          If the boolean value given is FALSE, the statement given is displayed as part of an assertion error message.
static void clamp_above(DoubleRef source, double lowBound, java.lang.String additionalErrMsg)
          If the given source value is lower than the lower bound, the source value is changed to the lower bound value.
static void clamp_above(DoubleRef source, double lowBound, java.lang.String additionalErrMsg, int precMultiplier)
          If the given source value is lower than the lower bound, the source value is changed to the lower bound value.
static void clamp_below(DoubleRef source, double highBound, java.lang.String additionalErrMsg)
          If the given source value is higher than the higher bound, the source value is changed to the higher bound value.
static void clamp_below(DoubleRef source, double highBound, java.lang.String additionalErrMsg, int precMultiplier)
          If the given source value is higher than the higher bound, the source value is changed to the higher bound value.
static void clamp_to_range(DoubleRef source, double lowBound, double highBound, java.lang.String additionalErrMsg)
          If the given source value is lower than the lower bound, the source value is changed to the lower bound value.
static void clamp_to_range(DoubleRef source, double lowBound, double highBound, java.lang.String additionalErrMsg, int precMultiplier)
          If the given source value is lower than the lower bound, the source value is changed to the lower bound value.
static double log_bin(double number)
          Returns the binary log of the given value.
static double Mround(double x, int digits)
          Rounds the given value by the number of digits.
static java.lang.String numberToString(double value, int mantissa)
          Converts a numerical value to String form.
static java.lang.String numberToString(double value, int total_length, int mantissa)
          Converts a numerical value to String form.
static java.lang.String protect(java.lang.String stringToProtect, java.lang.String protChars)
          Substitutes characters with their protected versions.
static double square_real(double x)
          Squares the given real number.
static void verify_approx_equal(double lhs, double rhs, java.lang.String errMsg)
          Checks if the double values are approximately equal and displays an error message if they are not.
static void verify_strictly_greater(double lhs, double rhs, java.lang.String additionalErrMsg)
          Checks if the left value is significantly less than the right value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

realEpsilon

public static final double realEpsilon
The clamping epsilon used to determine if a real value is significantly different from another value.

storedRealEpsilon

public static final double storedRealEpsilon
The clamping epsilon used to determine if a real value is significantly different from another value.

clampingEpsilon

public static final double clampingEpsilon
The clamping epsilon used to determine if a real value is significantly different from another value during clamping.
Constructor Detail

MLJ

public MLJ()
Method Detail

clamp_above

public static void clamp_above(DoubleRef source,
                               double lowBound,
                               java.lang.String additionalErrMsg)
If the given source value is lower than the lower bound, the source value is changed to the lower bound value.
Parameters:
source - The value to be clamped.
lowBound - The lower bound.
additionalErrMsg - Message to be displayed if clamping occurs.

clamp_above

public static void clamp_above(DoubleRef source,
                               double lowBound,
                               java.lang.String additionalErrMsg,
                               int precMultiplier)
If the given source value is lower than the lower bound, the source value is changed to the lower bound value.
Parameters:
source - The value to be clamped.
lowBound - The lower bound.
additionalErrMsg - Message to be displayed if clamping occurs.
precMultiplier - The precision multiplier for real values that are close to the lower bound.

approx_equal

public static boolean approx_equal(double lhs,
                                   double rhs)
Compares two double values for equality.
Parameters:
lhs - The left value to be compared.
rhs - The right value to be compared.
Returns:
TRUE if approximately equal, FALSE if significantly different.

approx_equal

public static boolean approx_equal(double lhs,
                                   double rhs,
                                   int precMultiplier)
Compares two double values for equality, using the given precisionMultiplier to drive approximate comparisons.
Parameters:
lhs - The left value to be compared.
rhs - The right value to be compared.
precMultiplier - The precision multiplier for determining if a value is signifacntly different.
Returns:
TRUE if approximately equal, FALSE if significantly different.

approx_equal

public static boolean approx_equal(double[] lhs,
                                   double[] rhs)
Compares two arrays of double values for equality.
Parameters:
lhs - The left array to be compared.
rhs - The right array to be compared.
Returns:
TRUE if approximately equal, FALSE if significantly different.

approx_equal

public static boolean approx_equal(double[] lhs,
                                   double[] rhs,
                                   int precisionMultiplier)
Compares two arrays of doubles for equality, using the given precisionMultiplier to drive approximate comparisons at each element.
Parameters:
lhs - The left array to be compared.
rhs - The right array to be compared.
precisionMultiplier - The precision multiplier for determining if a value is signifacntly different.
Returns:
TRUE if approximately equal, FALSE if significantly different.

approx_equal

public static boolean approx_equal(double[][] lhs,
                                   double[][] rhs)
Compares two matrices of double values for equality.
Parameters:
lhs - The left matrix to be compared.
rhs - The right matrix to be compared.
Returns:
TRUE if approximately equal, FALSE if significantly different.

approx_equal

public static boolean approx_equal(double[][] lhs,
                                   double[][] rhs,
                                   int precisionMultiplier)
Compares two matrices of double values for equality, using the given precisionMultiplier to drive approximate comparisons at each element.
Parameters:
lhs - The left matrix to be compared.
rhs - The right matrix to be compared.
precisionMultiplier - The precision multiplier for determining if a value is signifacntly different.
Returns:
TRUE if approximately equal, FALSE if significantly different.

verify_approx_equal

public static void verify_approx_equal(double lhs,
                                       double rhs,
                                       java.lang.String errMsg)
Checks if the double values are approximately equal and displays an error message if they are not.
Parameters:
lhs - The left value to be compared.
rhs - The right value to be compared.
errMsg - The error message to be displayed.

clamp_to_range

public static void clamp_to_range(DoubleRef source,
                                  double lowBound,
                                  double highBound,
                                  java.lang.String additionalErrMsg)
If the given source value is lower than the lower bound, the source value is changed to the lower bound value. If the source value is above the higher bound, the higher bound is substituted.
Parameters:
source - The value to be clamped.
lowBound - The lower bound.
highBound - The higher bound.
additionalErrMsg - An additional error message to be displayed if clamping occurs.

clamp_to_range

public static void clamp_to_range(DoubleRef source,
                                  double lowBound,
                                  double highBound,
                                  java.lang.String additionalErrMsg,
                                  int precMultiplier)
If the given source value is lower than the lower bound, the source value is changed to the lower bound value. If the source value is above the higher bound, the higher bound is substituted. The precision multiplier is to determine to what precision checks for significant difference are conducted.
Parameters:
source - The value to be clamped.
lowBound - The lower bound.
highBound - The higher bound.
additionalErrMsg - An additional error message to be displayed if clamping occurs.
precMultiplier - The precision multiplier for real values that are close to the a bound.

clamp_below

public static void clamp_below(DoubleRef source,
                               double highBound,
                               java.lang.String additionalErrMsg)
If the given source value is higher than the higher bound, the source value is changed to the higher bound value.
Parameters:
source - The value to be clamped.
highBound - The higher bound.
additionalErrMsg - An additional error message to be displayed if clamping occurs.

clamp_below

public static void clamp_below(DoubleRef source,
                               double highBound,
                               java.lang.String additionalErrMsg,
                               int precMultiplier)
If the given source value is higher than the higher bound, the source value is changed to the higher bound value.
Parameters:
source - The value to be clamped.
highBound - The higher bound.
additionalErrMsg - An additional error message to be displayed if clamping occurs.
precMultiplier - The precision multiplier for real values that are close to the higher bound.

verify_strictly_greater

public static void verify_strictly_greater(double lhs,
                                           double rhs,
                                           java.lang.String additionalErrMsg)
Checks if the left value is significantly less than the right value. If not an error message is displayed.
Parameters:
lhs - The left value.
rhs - The right value.
additionalErrMsg - An additional error message for display.

approx_equal

public static boolean approx_equal(float lhs,
                                   float rhs)
Compares two float values for equality.
Parameters:
lhs - The left value to be compared.
rhs - The right value to be compared.
Returns:
TRUE if approximately equal, FALSE if significantly different.

approx_equal

public static boolean approx_equal(float lhs,
                                   float rhs,
                                   int precMultiplier)
Compares two float values for equality. Uses the given precision multiplier to determine if there is significant difference.
Parameters:
lhs - The left value compared.
rhs - The right value compared.
precMultiplier - The precision multiplier for determining if a value is signifacntly different.
Returns:
TRUE if approximately equal, FALSE if significantly different.

log_bin

public static double log_bin(double number)
Returns the binary log of the given value.
Parameters:
number - The value for which a log is requested.
Returns:
The binary log value.

Abort

public static void Abort()
Displays an error message stating an unexpected condition was reached.

approx_greater

public static boolean approx_greater(double lhs,
                                     double rhs)
Checks if the left value is greater than the right value.
Parameters:
lhs - The left value compared.
rhs - The right value compared.
Returns:
TRUE if the left value is greater than the right value, FALSE otherwise.

approx_greater

public static boolean approx_greater(double lhs,
                                     double rhs,
                                     int precMultiplier)
Checks if the left value is greater than the right value. Uses a precision multiplier for determining significant difference.
Parameters:
lhs - The left value compared.
rhs - The right value compared.
precMultiplier - The precision multiplier for determining if a value is signifacntly different.
Returns:
TRUE if the left value is greater than the right value, FALSE otherwise.

approx_less

public static boolean approx_less(double lhs,
                                  double rhs)
Checks if the left value is less than the right value.
Parameters:
lhs - The left value compared.
rhs - The right value compared.
Returns:
TRUE if the left value is less than the right value, FALSE otherwise.

approx_less

public static boolean approx_less(double lhs,
                                  double rhs,
                                  int precMultiplier)
Checks if the left value is less than the right value. Uses a precision multiplier for determining significant difference.
Parameters:
lhs - The left value compared.
rhs - The right value compared.
precMultiplier - The precision multiplier for determining if a value is signifacntly different.
Returns:
TRUE if the left value is less than the right value, FALSE otherwise.

ASSERT

public static void ASSERT(boolean theItem,
                          java.lang.String statement)
If the boolean value given is FALSE, the statement given is displayed as part of an assertion error message.
Parameters:
theItem - FALSE if message displayed, TRUE otherwise.
statement - The statement to be displayed.

numberToString

public static java.lang.String numberToString(double value,
                                              int total_length,
                                              int mantissa)
Converts a numerical value to String form.
Parameters:
value - The value to be converted.
total_length - The total length of the resulting String.
mantissa - The length of the mantissa.
Returns:
A String representation of this numerical value with the required mantissa and total length.

numberToString

public static java.lang.String numberToString(double value,
                                              int mantissa)
Converts a numerical value to String form.
Parameters:
value - The value to be converted.
mantissa - The length of the mantissa.
Returns:
A String representation of this numerical value with the required mantissa and total length.

protect

public static java.lang.String protect(java.lang.String stringToProtect,
                                       java.lang.String protChars)
Substitutes characters with their protected versions.
Parameters:
stringToProtect - The String containing characters to be protected.
protChars - The characters to be protected.
Returns:
The String with characteres protected by '\\' characters.

square_real

public static double square_real(double x)
Squares the given real number.
Parameters:
x - The number to be squared.
Returns:
The square of the given number.

approx_equal

public static boolean approx_equal(java.util.Vector a,
                                   java.util.Vector b)
Checks if two Vectors of DoubleRefs are approximately equivalent in values.
Parameters:
a - The first Vector compared.
b - The second Vector compared.
Returns:
TRUE if the vectors are approximately equal, FALSE if not.

Mround

public static double Mround(double x,
                            int digits)
Rounds the given value by the number of digits.
Parameters:
x - The value to be rounded.
digits - The number of digits to be rounded off.
Returns:
The rounded value.