org.encog.mathutil.matrices

## Class BiPolarUtil

- java.lang.Object
- - org.encog.mathutil.matrices.BiPolarUtil

-     public final class BiPolarUtil
      extends Object

  This class contains a number of utility methods used to work with bipolar numbers. A bipolar number is another way to represent binary numbers. The value of true is defined to be one, where as false is defined to be negative one.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static double` | `bipolar2double(boolean b)` Convert a boolean to a bipolar number.
    `static double[]` | `bipolar2double(boolean[] b)` Convert a boolean array to a bipolar array.
    `static double[][]` | `bipolar2double(boolean[][] b)`
    `static boolean` | `double2bipolar(double d)` Convert a bipolar value to a boolean.
    `static boolean[]` | `double2bipolar(double[] d)` Convert a bipolar array to booleans.
    `static boolean[][]` | `double2bipolar(double[][] d)` Convert a bipolar array to a boolean array.
    `static double` | `normalizeBinary(double d)` Normalize a binary number.
    `static double` | `toBinary(double d)` Convert bipolar to binary.
    `static double` | `toBiPolar(double d)` Convert binary to bipolar.
    `static double` | `toNormalizedBinary(double d)` Convert to binary and normalize.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### bipolar2double

          public static double bipolar2double(boolean b)

      Convert a boolean to a bipolar number.
      Parameters:
        `b` - A boolean value.
      Returns:
        A bipolar number.

    - #### bipolar2double

          public static double[] bipolar2double(boolean[] b)

      Convert a boolean array to a bipolar array.
      Parameters:
        `b` - A an array of boolean values.
      Returns:
        An array of bipolar values.

    - #### bipolar2double

          public static double[][] bipolar2double(boolean[][] b)

      Parameters:
        `b` - An array of boolean values.
      Returns:
        An array of bipolar values.

    - #### double2bipolar

          public static boolean double2bipolar(double d)

      Convert a bipolar value to a boolean.
      Parameters:
        `d` - A bipolar value.
      Returns:
        A boolean value.

    - #### double2bipolar

          public static boolean[] double2bipolar(double[] d)

      Convert a bipolar array to booleans.
      Parameters:
        `d` - A bipolar array.
      Returns:
        An array of booleans.

    - #### double2bipolar

          public static boolean[][] double2bipolar(double[][] d)

      Convert a bipolar array to a boolean array.
      Parameters:
        `d` - A bipolar array.
      Returns:
        A boolean array.

    - #### normalizeBinary

          public static double normalizeBinary(double d)

      Normalize a binary number. If the number is not zero then make it 1, if it is zero, leave it alone.
      Parameters:
        `d` - A number to normalize to binary.
      Returns:
        A binary digit.

    - #### toBinary

          public static double toBinary(double d)

      Convert bipolar to binary.
      Parameters:
        `d` - A bipolar number.
      Returns:
        A binary digit.

    - #### toBiPolar

          public static double toBiPolar(double d)

      Convert binary to bipolar.
      Parameters:
        `d` - A binary number.
      Returns:
        A bipolar number.

    - #### toNormalizedBinary

          public static double toNormalizedBinary(double d)

      Convert to binary and normalize.
      Parameters:
        `d` - A number to convert to binary.
      Returns:
        A normalized binary number.

Copyright © 2014. All Rights Reserved.