dDot() public static method

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.
return double
Beispiel #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;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Performs a matrix times matrix operation C = A * B with real matrices.
        /// </summary>
        /// <param name="aStore">The 1-dimensional array for the matrix A.</param>
        /// <param name="aOffset">The offset in the array for A.</param>
        /// <param name="aRowStride">The difference for skipping one row.</param>
        /// <param name="aColStride">The difference for skipping one column.</param>
        /// <param name="bStore">The 1-dimensional array for the matrix B.</param>
        /// <param name="bOffset">The offset in the array for B.</param>
        /// <param name="bRowStride">The difference for skipping one row.</param>
        /// <param name="bColStride">The difference for skipping one column.</param>
        /// <param name="cStore">The 1-dimensional array for the matrix C.</param>
        /// <param name="cOffset">The offset in the array for C.</param>
        /// <param name="cRowStride">The difference for skipping one row.</param>
        /// <param name="cColStride">The difference for skipping one column.</param>
        /// <param name="rowsA">The rows to handle in the matrix A.</param>
        /// <param name="colsB">The coluumns to handle in the matrix B.</param>
        /// <param name="length">The columns of A / rows of B - or length for the multiplication.</param>
        public static void dGemm(double[] aStore, int aOffset, int aRowStride, int aColStride,
                                 double[] bStore, int bOffset, int bRowStride, int bColStride,
                                 double[] cStore, int cOffset, int cRowStride, int cColStride,
                                 int rowsA, int colsB, int length)
        {
            int aIndex = aOffset;
            int cStart = cOffset;

            for (int n = 0; n < rowsA; n++)
            {
                int bIndex = bOffset;
                int cIndex = cStart;

                for (int m = 0; m < colsB; m++)
                {
                    cStore[cIndex] = BlasL1.dDot(aStore, aIndex, aColStride, bStore, bIndex, bRowStride, length);
                    bIndex        += bColStride;
                    cIndex        += cColStride;
                }

                aIndex += aRowStride;
                cStart += cRowStride;
            }
        }