org.encog.ml.data.basic
Class BasicMLComplexData
- java.lang.Object
-
- org.encog.ml.data.basic.BasicMLComplexData
-
- All Implemented Interfaces:
- java.lang.Cloneable, MLComplexData, MLData, CentroidFactory<MLData>
public class BasicMLComplexData extends java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(int index, ComplexNumber value)Add a complex number to the specified index.voidadd(int index, double value)Add a value to the specified index.voidclear()Clear any data to zero.MLDataclone()Clone this object.Centroid<MLData>createCentroid()Not supported.ComplexNumber[]getComplexData()ComplexNumbergetComplexData(int index)Get the complex data at the specified index.double[]getData()doublegetData(int index)Get the element specified index value.voidsetData(ComplexNumber[] theData)voidsetData(double[] theData)Set all of the data as an array of doubles.voidsetData(int index, ComplexNumber d)Set a data element to a complex number.voidsetData(int index, double d)Set the data at the specified index.intsize()java.lang.StringtoString()
-
-
-
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.
-
add
public void add(int index, ComplexNumber value)Add a complex number to the specified index.- Specified by:
addin interfaceMLComplexData- Parameters:
index- The index to use.value- The complex number value to add.
-
clone
public MLData clone()
Clone this object.
-
getData
public double[] getData()
-
getComplexData
public ComplexNumber[] getComplexData()
- Specified by:
getComplexDatain interfaceMLComplexData- Returns:
- The complex numbers.
-
getData
public double getData(int index)
Get the element specified index value.
-
getComplexData
public ComplexNumber getComplexData(int index)
Get the complex data at the specified index.- Specified by:
getComplexDatain interfaceMLComplexData- 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.
-
setData
public void setData(ComplexNumber[] theData)
- Specified by:
setDatain interfaceMLComplexData- 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.
-
setData
public void setData(int index, ComplexNumber d)Set a data element to a complex number.- Specified by:
setDatain interfaceMLComplexData- Parameters:
index- The index to set.d- The complex number.
-
size
public int size()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
createCentroid
public Centroid<MLData> createCentroid()
Not supported.- Specified by:
createCentroidin interfaceCentroidFactory<MLData>- Returns:
- Nothing.
-
-
DMelt 3.0 © DataMelt by jWork.ORG