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

dDot() 공개 정적인 메소드

Returns the dot product (a, b).
public static dDot ( double aStore, int aOffset, int aStride, double bStore, int bOffset, int bStride, int count ) : double
aStore double The first vector a.
aOffset int Offset in the vector a.
aStride int The offset between two elements of the vector a.
bStore double 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.
리턴 double
        public static double dDot(double[] aStore, int aOffset, int aStride, double[] bStore, int bOffset, int bStride, int count)
        {
            double m = 0.0;
            int n = 0;
            int a = aOffset;
            int b = bOffset;

            while (n < count)
            {
                m += aStore[a] * bStore[b];
                n++;
                a += aStride;
                b += bStride;
            }

            return m;
        }

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 dGemv(
            double[] aStore, int aOffset, int aRowStride, int aColStride,
            double[] xStore, int xOffset, int xStride,
            double[] 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.dDot(aStore, aIndex, aColStride, xStore, xOffset, xStride, cols);
                aIndex         += aRowStride;
                yIndex         += yStride;
            }
        }
All Usage Examples Of YAMP.Numerics.BlasL1::dDot