/// <summary> /// Conjugate this vector. /// </summary> /// <returns> /// Vector r[i] = Real(this[i]) - Imaginary(this[i]) /// </returns> public ComplexVector Conjugate() { ComplexVector conjVect = new ComplexVector(this._Data.Length); Complex[] v = conjVect.Data; for (int i = 0; i < v.Length; i++) { v[i] = this._Data[i].Conjugate; } return(conjVect); }
/// <summary> /// Multiply a scalar to all elements of this vector. /// </summary> /// <param name="c">The complex number.</param> /// <returns> /// VectorComplex r[i] = this[i] * c /// </returns> public ComplexVector Multiply(Complex c) { ComplexVector v = new ComplexVector(this._Type, this.Length); Complex[] vData = v.Data; for (int i = 0; i < vData.Length; i++) { vData[i] = this._Data[i] * c; } return(v); }
/// <summary> /// Unary minus this vector. /// </summary> /// <returns> /// Vector r[i] = -this[i] /// </returns> public ComplexVector UnaryMinus() { ComplexVector v = new ComplexVector(this._Type, this.Length); Complex[] vData = v.Data; for (int i = 0; i < vData.Length; i++) { vData[i] -= this._Data[i]; } return(v); }
/// <summary> /// In place add a VectorComplex. /// </summary> /// <param name="B">The vector B.</param> public void SubtractInplace(ComplexVector B) { if (B.Type != this.Type || B.Length != this.Length) { throw new System.ArgumentException("Vector dimensions or type are not valid."); } for (int i = 0; i < this._Data.Length; i++) { this._Data[i] -= B[i]; } }
///// <summary>Vector multiplication.</summary> //public static Complex operator *(VectorComplex A, VectorComplex B) //{ // if (A.Type != VectorType.Row || B.Type != VectorType.Column || B.Length != A.Length) // { // throw new System.ArgumentException("Vector dimensions or type are not valid."); // } // Complex C = new Complex(0.0, 0.0); // Complex[] AData = A.Data; // Complex[] BData = B.Data; // for (int i = 0; i < AData.Length; i++) // { // C += AData[i] * BData[i]; // } // return C; //} ///// <summary> ///// The dot product ///// </summary> ///// <param name="A"></param> ///// <returns>The dot product of A.</returns> //public static double DotProduct(Vector A ) //{ // double C = 0.0; // double[] AData = A.Data; // for (int i = 0; i < AData.Length; i++) // { // C += AData[i] * AData[i]; // } // return C; //} /// <summary> /// Transposed vector. /// </summary> /// <returns></returns> public ComplexVector Transpose() { ComplexVector AT = new ComplexVector(this._Data); if (this._Type == VectorType.Column) { AT.Type = VectorType.Row; } else { AT.Type = VectorType.Column; } return(AT); }
/// <summary> /// Subtract a VectorComplex. /// </summary> /// <param name="B">The vector B.</param> /// <returns> /// VectorComplex r[i] = this[i] - B[i] /// </returns> public ComplexVector Subtract(ComplexVector B) { if (B.Type != this.Type || B.Length != this.Length) { throw new System.ArgumentException("Vector dimensions or type are not valid."); } ComplexVector r = new ComplexVector(this._Type, this.Length); Complex[] rData = r.Data; for (int i = 0; i < rData.Length; i++) { rData[i] = this._Data[i] - B[i]; } return(r); }
/// <summary> /// Gets the row vectors of this matrix. /// </summary> /// <returns>The row vectors.</returns> public ComplexVector[] GetRowVectors() { ComplexVector[] rowVects = new ComplexVector[this.RowCount]; Complex[] VectData; for (int i = 0; i < this._RowCount; i++) { rowVects[i] = new ComplexVector(VectorType.Row, this._ColumnCount); VectData = rowVects[i].Data; for (int j = 0; j < VectData.Length; j++) { VectData[j] = this._Data[i + j * this._RowCount]; } } return(rowVects); }
/// <summary> /// Gets the column vectors of this matrix. /// </summary> /// <returns>The columns vectors.</returns> public ComplexVector[] GetColumnVectors() { ComplexVector[] columnVects = new ComplexVector[this._ColumnCount]; Complex[] VectData; for (int j = 0; j < this._ColumnCount; j++) { columnVects[j] = new ComplexVector(VectorType.Column, this._RowCount); VectData = columnVects[j].Data; for (int i = 0; i < VectData.Length; i++) { VectData[i] = this._Data[i + j * this._RowCount]; } } return(columnVects); }
/// <summary> /// Unary minus this vector. /// </summary> /// <returns> /// Vector r[i] = -this[i] /// </returns> public ComplexVector UnaryMinus() { ComplexVector v = new ComplexVector(this._Type, this.Length); Complex[] vData = v.Data; for (int i = 0; i < vData.Length; i++) { vData[i] -= this._Data[i]; } return v; }
///// <summary>Vector multiplication.</summary> //public static Complex operator *(VectorComplex A, VectorComplex B) //{ // if (A.Type != VectorType.Row || B.Type != VectorType.Column || B.Length != A.Length) // { // throw new System.ArgumentException("Vector dimensions or type are not valid."); // } // Complex C = new Complex(0.0, 0.0); // Complex[] AData = A.Data; // Complex[] BData = B.Data; // for (int i = 0; i < AData.Length; i++) // { // C += AData[i] * BData[i]; // } // return C; //} ///// <summary> ///// The dot product ///// </summary> ///// <param name="A"></param> ///// <returns>The dot product of A.</returns> //public static double DotProduct(Vector A ) //{ // double C = 0.0; // double[] AData = A.Data; // for (int i = 0; i < AData.Length; i++) // { // C += AData[i] * AData[i]; // } // return C; //} /// <summary> /// Transposed vector. /// </summary> /// <returns></returns> public ComplexVector Transpose() { ComplexVector AT = new ComplexVector(this._Data); if (this._Type == VectorType.Column) AT.Type = VectorType.Row; else AT.Type = VectorType.Column; return AT; }
/// <summary> /// Subtract a VectorComplex. /// </summary> /// <param name="B">The vector B.</param> /// <returns> /// VectorComplex r[i] = this[i] - B[i] /// </returns> public ComplexVector Subtract(ComplexVector B) { if (B.Type != this.Type || B.Length != this.Length) { throw new System.ArgumentException("Vector dimensions or type are not valid."); } ComplexVector r = new ComplexVector(this._Type, this.Length); Complex[] rData = r.Data; for (int i = 0; i < rData.Length; i++) { rData[i] = this._Data[i] - B[i]; } return r; }
/// <summary> /// Subtract a scalar to all elements of this vector. /// </summary> /// <param name="c">The complex number.</param> /// <returns> /// VectorComplex r[i] = this[i] - c /// </returns> public ComplexVector Subtract(Complex c) { ComplexVector v = new ComplexVector(this._Type, this.Length); Complex[] vData = v.Data; for (int i = 0; i < vData.Length; i++) { vData[i] = this._Data[i] - c; } return v; }
/// <summary> /// Conjugate this vector. /// </summary> /// <returns> /// Vector r[i] = Real(this[i]) - Imaginary(this[i]) /// </returns> public ComplexVector Conjugate() { ComplexVector conjVect= new ComplexVector(this._Data.Length); Complex[] v = conjVect.Data; for (int i = 0; i < v.Length; i++) { v[i] = this._Data[i].Conjugate; } return conjVect; }
public VectorComplexDebuggerDisplay(ComplexVector TheVector) { this.MeVector = TheVector; }