Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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];
            }
        }
Ejemplo n.º 5
0
        ///// <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);
        }
Ejemplo n.º 6
0
        /// <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);
        }
Ejemplo n.º 7
0
        /// <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);
        }
Ejemplo n.º 8
0
        /// <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);
        }
Ejemplo n.º 9
0
        /// <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;
        }
Ejemplo n.º 10
0
        ///// <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;
        }
Ejemplo n.º 11
0
        /// <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];
            }
        }
Ejemplo n.º 12
0
        /// <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;
        }
Ejemplo n.º 13
0
        /// <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;
        }
Ejemplo n.º 14
0
        /// <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;
        }
Ejemplo n.º 15
0
 public VectorComplexDebuggerDisplay(ComplexVector TheVector)
 {
     this.MeVector = TheVector;
 }
Ejemplo n.º 16
0
 public VectorComplexDebuggerDisplay(ComplexVector TheVector)
 {
     this.MeVector = TheVector;
 }