/// <summary> /// Clear all values to zero. /// </summary> public void Clear() { for (int i = 0; i < _data.Length; i++) { _data[i] = new ComplexNumber(0, 0); } }
/// <summary> /// 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. /// </summary> /// <param name="d">The object to be copied.</param> public BasicMLComplexData(IMLData d) { if (d is IMLComplexData) { var c = (IMLComplexData) d; for (int i = 0; i < d.Count; i++) { _data[i] = new ComplexNumber(c.GetComplexData(i)); } } else { for (int i = 0; i < d.Count; i++) { _data[i] = new ComplexNumber(d[i], 0); } } }
/// <summary> /// Construct this object with the specified data. Use complex numbers. /// </summary> /// <param name="d">The data to construct this object with.</param> public BasicMLComplexData(ComplexNumber[] d) { _data = d; }
/// <summary> /// Access the data by index. /// </summary> /// <param name="x">The index to access.</param> /// <returns></returns> public virtual double this[int x] { get { return _data[x].Real; } set { _data[x] = new ComplexNumber(value, 0); } }
/// <summary> /// Set the complex data array. /// </summary> /// <param name="d">A new complex data array.</param> public void SetComplexData(ComplexNumber[] d) { _data = d; }
/// <summary> /// Set a data element to a complex number. /// </summary> /// <param name="index">The index to set.</param> /// <param name="d">The complex number.</param> public void SetComplexData(int index, ComplexNumber d) { _data[index] = d; }
/// <summary> /// Create a complex number from another complex number. /// </summary> /// <param name="other">The other complex number. </param> public ComplexNumber(ComplexNumber other) { _x = other.Real; _y = other.Imaginary; }
public ComplexNumber(ComplexNumber other) { this._x08db3aeabb253cb1 = other.Real; this._x1e218ceaee1bb583 = other.Imaginary; }