YAMP.Numerics.BlasL1.cDot C# (CSharp) 메소드

cDot() 공개 정적인 메소드

Returns the complex dot product (a, b).
public static cDot ( ScalarValue aStore, int aOffset, int aStride, ScalarValue bStore, int bOffset, int bStride, int count ) : ScalarValue
aStore YAMP.ScalarValue The first vector a.
aOffset int Offset in the vector a.
aStride int The offset between two elements of the vector a.
bStore YAMP.ScalarValue The second vector b.
bOffset int Offset in the vector a.
bStride int The offset between two elements of the vector a.
count int The number of elements to consider.
리턴 YAMP.ScalarValue
        public static ScalarValue cDot(ScalarValue[] aStore, int aOffset, int aStride, ScalarValue[] bStore, int bOffset, int bStride, int count)
        {
            double re = 0.0;
            double im = 0.0;
            int n = 0;
            int a = aOffset;
            int b = bOffset;

            while (n < count)
            {
                var re1 = aStore[a].Re;
                var im1 = aStore[a].Im;
                var re2 = bStore[b].Re;
                var im2 = bStore[b].Im;

                re += (re1 * re2 - im1 * im2);
                im += (re1 * im2 + im1 * re2);

                n++;
                a += aStride;
                b += bStride;
            }

            return new ScalarValue(re, im);
        }

Usage Example

예제 #1
0
        /// <summary>
        /// y = A * x + y, where x, y are vectors and A is a matrix.
        /// </summary>
        /// <param name="aStore">1 dim double array for A.</param>
        /// <param name="aOffset">Offset in the array for A.</param>
        /// <param name="aRowStride">Rows in A.</param>
        /// <param name="aColStride">Columns in A.</param>
        /// <param name="xStore">1 dim double array for x.</param>
        /// <param name="xOffset">Offset in the array for x.</param>
        /// <param name="xStride">Number of entries in x.</param>
        /// <param name="yStore">1 dim double array for y.</param>
        /// <param name="yOffset">Offset in the array for y.</param>
        /// <param name="yStride">Number of entries in y.</param>
        /// <param name="rows">Geometry information for the rows.</param>
        /// <param name="cols">Geometry information for the columns.</param>
        public static void cGemv(
            ScalarValue[] aStore, int aOffset, int aRowStride, int aColStride,
            ScalarValue[] xStore, int xOffset, int xStride,
            ScalarValue[] yStore, int yOffset, int yStride,
            int rows, int cols
            )
        {
            int aIndex = aOffset;
            int yIndex = yOffset;

            for (int n = 0; n < rows; n++)
            {
                yStore[yIndex] += BlasL1.cDot(aStore, aIndex, aColStride, xStore, xOffset, xStride, cols);
                aIndex         += aRowStride;
                yIndex         += yStride;
            }
        }
All Usage Examples Of YAMP.Numerics.BlasL1::cDot