Provides BLAS Level 1 Access, this level contains vector operations of the form y = a * x + y.
예제 #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;
            }
        }
예제 #2
0
        /// <summary>
        /// Performs a matrix times matrix operation C = A * B with complex matrices.
        /// </summary>
        /// <param name="aStore">The 1-dimensional complex 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 complex 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 complex 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 cGemm(ScalarValue[] aStore, int aOffset, int aRowStride, int aColStride,
                                 ScalarValue[] bStore, int bOffset, int bRowStride, int bColStride,
                                 ScalarValue[] 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.cDot(aStore, aIndex, aColStride, bStore, bIndex, bRowStride, length);
                    bIndex        += bColStride;
                    cIndex        += cColStride;
                }

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