Beispiel #1
0
        public void Dspmv(StoredTriangle uplo, int n,
                          double alpha, double[] a, int offsetA, double[] x, int offsetX, int incX,
                          double beta, double[] y, int offsetY, int incY)
        {
            // y = alpha * L * x + beta * y
            CblasLevel2Implementations.LowerTimesVectorPackedRowMajor(
                CblasLevel2Implementations.Diagonal.Regular, n, alpha, a, offsetA, x, offsetX, incX, beta, y, offsetY, incY);

            // y = alpha * U * x + y, where U has 0 diagonal
            CblasLevel2Implementations.UpperTimesVectorPackedColMajor(
                CblasLevel2Implementations.Diagonal.Zero, n, alpha, a, offsetA, x, offsetX, incX, 1.0, y, offsetY, incY);
        }
Beispiel #2
0
        public void Dtpmv(StoredTriangle uplo, TransposeMatrix transA, DiagonalValues diag, int n,
                          double[] a, int offsetA, double[] x, int offsetX, int incX)
        {
            // The copy may be avoidable in trangular operations, if we start the dot products from the bottom
            var input = new double[x.Length];

            Array.Copy(x, input, x.Length);

            CblasLevel2Implementations.Diagonal managedDiag = (diag == DiagonalValues.NonUnit) ?
                                                              CblasLevel2Implementations.Diagonal.Regular : CblasLevel2Implementations.Diagonal.Unit;
            if (UseUpperImplementation(uplo, transA))
            {
                CblasLevel2Implementations.UpperTimesVectorPackedColMajor(
                    managedDiag, n, 1.0, a, offsetA, input, offsetX, incX, 0.0, x, offsetX, incX);
            }
            else
            {
                CblasLevel2Implementations.LowerTimesVectorPackedRowMajor(
                    managedDiag, n, 1.0, a, offsetA, input, offsetX, incX, 0.0, x, offsetX, incX);
            }
        }