コード例 #1
0
        internal void Dpotrs(StoredTriangle triangle, int orderA, int numRhs, double[] factorizedMatrixA, int offsetA,
                             int leadingDimA, double[] rhsB, int offsetB, int leadingDimB)
        {
            int info = DefaultInfo;

            Provider.Dpotrs(triangle.Translate(), orderA, numRhs, factorizedMatrixA, offsetA, leadingDimA,
                            rhsB, offsetB, leadingDimB, ref info);

            if (info < 0) // info can only be 0 or negative
            {
                // The indices of negative pivots must take into account the offset parameters
                if (info == -5)
                {
                    info = -6;
                }
                else if (info == -6)
                {
                    info = -7;
                }
                else if (info == -7)
                {
                    info = -9;
                }
                ProcessNegativeInfo(info);
            }
        }
コード例 #2
0
        /// <summary>
        /// If the return value is a non-negative int i, then the entry (i, i) of the factor U or L is 0 and the inverse could
        /// not be computed.
        /// </summary>
        internal int Dpotri(StoredTriangle triangle, int orderA, double[] factorizedMatrixA, int offsetA, int leadingDimA)
        {
            int info = DefaultInfo;

            Provider.Dpotri(triangle.Translate(), orderA, factorizedMatrixA, offsetA, leadingDimA, ref info);

            if (info < 0)
            {
                // The indices of negative pivots must take into account the offset parameters
                if (info == -4)
                {
                    info = -5;
                }
                ProcessNegativeInfo(info);
            }

            //TODO: is there the same problem as LU, i.e. can the last minor not be positive definite, while the info = 0?
            if (info > 0)
            {
                return(info - 1);
            }
            else
            {
                return(int.MinValue);
            }
        }
コード例 #3
0
        internal void Dsyev(EigensystemJob job, StoredTriangle triangle, int orderA, double[] matrixA, int offsetA,
                            int leadingDimA, double[] eigenvalues, int offsetEigenvalues)
        {
            int info = DefaultInfo;

            QueryWorkspaceAndExecute((work, offsetWork, lWork) => Provider.Dsyev(
                                         job.Translate(), triangle.Translate(), orderA, ref matrixA, offsetA, leadingDimA, ref eigenvalues,
                                         offsetEigenvalues, ref work, offsetWork, lWork, ref info));

            if (info > 0)
            {
                throw new LapackException($"The algorithm failed to converge. There were {info} elements of an intermediate"
                                          + " tridiagonal form which did not converge to zero");
            }
            else if (info < 0)
            {
                ProcessNegativeInfo(info);
            }
        }
コード例 #4
0
        /// <summary>
        /// If the return value is a non-negative int i, then the entry (i, i) of the factor U or L is 0 and the inverse could
        /// not be computed.
        /// </summary>
        internal int Dpptri(StoredTriangle triangle, int orderA, double[] factorizedMatrixA, int offsetA)
        {
            int info = DefaultInfo;

            Provider.Dpptri(triangle.Translate(), orderA, factorizedMatrixA, offsetA, ref info);

            if (info < 0)
            {
                ProcessNegativeInfo(info);
            }

            //TODO: is there the same problem as LU, i.e. can the last minor not be positive definite, while the info = 0?
            if (info > 0)
            {
                return(info - 1);
            }
            else
            {
                return(int.MinValue);
            }
        }
コード例 #5
0
 /// <summary>
 /// See http://www.dotnumerics.com/NumericalLibraries/LinearAlgebra/CSharpCodeFiles/dtrsv.aspx
 /// </summary>
 public void Dtrsv(StoredTriangle uplo, TransposeMatrix transA, DiagonalValues diag, int n,
                   double[] a, int offsetA, int ldA, double[] x, int offsetX, int incX)
 => dtrsv.Run(uplo.Translate(), transA.Translate(), diag.Translate(), n, a, offsetA, ldA, ref x, offsetX, incX);
コード例 #6
0
 /// <summary>
 /// See https://software.intel.com/en-us/mkl-developer-reference-fortran-trsv#D8733073-F041-4AA1-B82C-123DFA993AD7
 /// </summary>
 public void Dtrsv(StoredTriangle uplo, TransposeMatrix transA, DiagonalValues diag, int n,
                   double[] a, int offsetA, int ldA, double[] x, int offsetX, int incX)
 => Blas.Dtrsv(uplo.Translate(), transA.Translate(), diag.Translate(), ref n, ref a[offsetA], ref ldA,
               ref x[offsetX], ref incX);
コード例 #7
0
 /// <summary>
 /// See https://software.intel.com/en-us/mkl-developer-reference-fortran-spmv#16CB58C4-105B-486C-B6AA-42BB0C721A76
 /// </summary>
 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)
 => Blas.Dspmv(uplo.Translate(), ref n, ref alpha, ref a[offsetA],
               ref x[offsetX], ref incX, ref beta, ref y[offsetY], ref incY);