org.encog.ml.data.basic

## Class BasicMLComplexData

- java.lang.Object
- - org.encog.ml.data.basic.BasicMLComplexData

- All Implemented Interfaces:
    Cloneable, MLComplexData, MLData, CentroidFactory<MLData>

      public class BasicMLComplexData
      extends Object
      implements MLComplexData

  This class implements a data object that can hold complex numbers. It implements the interface MLData, so it can be used with nearly any Encog machine learning method. However, not all Encog machine learning methods are designed to work with complex numbers. A Encog machine learning method that does not support complex numbers will only be dealing with the real-number portion of the complex number.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicMLComplexData(ComplexNumber[] d)` Construct this object with the specified data.
    `BasicMLComplexData(double[] d)` Construct this object with the specified data.
    `BasicMLComplexData(int size)` Construct this object with blank data and a specified size.
    `BasicMLComplexData(MLData d)` Construct a new BasicMLData object from an existing one.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(int index, ComplexNumber value)` Add a complex number to the specified index.
    `void` | `add(int index, double value)` Add a value to the specified index.
    `void` | `clear()` Clear any data to zero.
    `MLData` | `clone()` Clone this object.
    `Centroid<MLData>` | `createCentroid()` Not supported.
    `ComplexNumber[]` | `getComplexData()`
    `ComplexNumber` | `getComplexData(int index)` Get the complex data at the specified index.
    `double[]` | `getData()`
    `double` | `getData(int index)` Get the element specified index value.
    `void` | `setData(ComplexNumber[] theData)`
    `void` | `setData(double[] theData)` Set all of the data as an array of doubles.
    `void` | `setData(int index, ComplexNumber d)` Set a data element to a complex number.
    `void` | `setData(int index, double d)` Set the data at the specified index.
    `int` | `size()`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### BasicMLComplexData

          public BasicMLComplexData(double[] d)

      Construct this object with the specified data. Use only real numbers.
      Parameters:
        `d` - The data to construct this object with.

    - #### BasicMLComplexData

          public BasicMLComplexData(ComplexNumber[] d)

      Construct this object with the specified data. Use complex numbers.
      Parameters:
        `d` - The data to construct this object with.

    - #### BasicMLComplexData

          public BasicMLComplexData(int size)

      Construct this object with blank data and a specified size.
      Parameters:
        `size` - The amount of data to store.

    - #### BasicMLComplexData

          public BasicMLComplexData(MLData d)

      Construct a new BasicMLData object from an existing one. This makes a copy of an array. If MLData is not complex, then only reals will be created.
      Parameters:
        `d` - The object to be copied.

  - ### Method Detail

    - #### add

          public void add(int index,
                 double value)

      Add a value to the specified index.
      Specified by:
        `add` in interface `MLData`
      Parameters:
        `index` - The index to add to.
        `value` - The value to add.

    - #### add

          public void add(int index,
                 ComplexNumber value)

      Add a complex number to the specified index.
      Specified by:
        `add` in interface `MLComplexData`
      Parameters:
        `index` - The index to use.
        `value` - The complex number value to add.

    - #### clear

          public void clear()

      Clear any data to zero.
      Specified by:
        `clear` in interface `MLData`

    - #### clone

          public MLData clone()

      Clone this object.
      Specified by:
        `clone` in interface `MLData`
      Overrides:
        `clone` in class `Object`
      Returns:
        A cloned version of this object.

    - #### getData

          public double[] getData()

      Specified by:
        `getData` in interface `MLData`
      Returns:
        All of the elements as an array.

    - #### getComplexData

          public ComplexNumber[] getComplexData()

      Specified by:
        `getComplexData` in interface `MLComplexData`
      Returns:
        The complex numbers.

    - #### getData

          public double getData(int index)

      Get the element specified index value.
      Specified by:
        `getData` in interface `MLData`
      Parameters:
        `index` - The index to read.
      Returns:
        The value at the specified inedx.

    - #### getComplexData

          public ComplexNumber getComplexData(int index)

      Get the complex data at the specified index.
      Specified by:
        `getComplexData` in interface `MLComplexData`
      Parameters:
        `index` - The index to get the complex data at.
      Returns:
        The complex data.

    - #### setData

          public void setData(double[] theData)

      Set all of the data as an array of doubles.
      Specified by:
        `setData` in interface `MLData`
      Parameters:
        `theData` - An array of doubles.

    - #### setData

          public void setData(ComplexNumber[] theData)

      Specified by:
        `setData` in interface `MLComplexData`
      Parameters:
        `theData` - Set the complex data array.

    - #### setData

          public void setData(int index,
                     double d)

      Set the data at the specified index. Note, this will only set the real part of the complex number.
      Specified by:
        `setData` in interface `MLData`
      Parameters:
        `index` - The index to to set.
        `d` - The numeric value to set.

    - #### setData

          public void setData(int index,
                     ComplexNumber d)

      Set a data element to a complex number.
      Specified by:
        `setData` in interface `MLComplexData`
      Parameters:
        `index` - The index to set.
        `d` - The complex number.

    - #### size

          public int size()

      Specified by:
        `size` in interface `MLData`
      Returns:
        How many elements are stored in this object.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### createCentroid

          public Centroid<MLData> createCentroid()

      Not supported.
      Specified by:
        `createCentroid` in interface `CentroidFactory<MLData>`
      Returns:
        Nothing.

Copyright © 2014. All Rights Reserved.