/// <summary>Reduces a real symmetric matrix to tridiagonal form with Successive Bandwidth Reduction approach, i.e. A = Q * T * Q' and optionally multiplies matrix Z by Q, or simply forms Q.
        /// </summary>
        /// <param name="symmetricEigenvalueProblems">The <see cref="LapackEigenvalues.ISymmetricEigenvalueProblems"/> object.</param>
        /// <param name="job">A value indicating what kind of job to do by the LAPACK function.</param>
        /// <param name="n">The order of the matrix A.</param>
        /// <param name="kd">The bandwidth of the banded matrix B, for example 40 or 64.</param>
        /// <param name="a">The symmetric matrix provided column-by-column; depending on <paramref name="job"/> it will be overwritten by the banded matrix B and details of the orthogonal matrix Q to reduce A to B a specified by <paramref name="triangularMatrixType"/>.</param>
        /// <param name="d">The diagonal elements of the tridiagonal matrix; the array should have at least <paramref name="n"/> elements (output).</param>
        /// <param name="e">The off-diagonal elements of the tridiagonal matrix; the array should have at least <paramref name="n"/> - 1 elements (output).</param>
        /// <param name="tau">Further details of the orthogonal matrix; the array should have at least <paramref name="n"/> - <paramref name="kd"/> - 1  elements (output).</param>
        /// <param name="z">The matrix Z if <paramref name="job"/> indicates to take into account this parameter, if referenced it should have at least <paramref name="n"/> * <paramref name="n"/> elements and will be overwritten on exit by Z * Q.</param>
        /// <param name="work">A workspace array with at least (2 * <paramref name="kd"/> + 1) * <paramref name="n"/> + <paramref name="kd"/> elements.</param>
        /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of the symmetric input matrix is stored.</param>
        public static void dsyrdb(this LapackEigenvalues.ISymmetricEigenvalueProblems symmetricEigenvalueProblems, MklLapackEigenvalues.DsyrdbJob job, int n, int kd, double[] a, double[] d, double[] e, double[] tau, double[] z, double[] work, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix)
        {
            int info;
            var jobz  = GetJob(job);
            int lwork = work.Length;
            var uplo  = GetUplo(triangularMatrixType);

            _dsyrdb(ref jobz, ref uplo, ref n, ref kd, a, ref n, d, e, tau, z, ref n, work, ref lwork, out info);
            CheckForError(info, "dsyrdb");
        }
        /// <summary>Gets a optimal workspace array length for the <c>dsyrdb</c> function.
        /// </summary>
        /// <param name="symmetricEigenvalueProblems">The <see cref="LapackEigenvalues.ISymmetricEigenvalueProblems"/> object.</param>
        /// <param name="job">A value indicating what kind of job to do by the LAPACK function.</param>
        /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of the symmetric input matrix is stored.</param>
        /// <param name="n">The order of the matrix A.</param>
        /// <param name="kd">The bandwidth of the banded matrix B.</param>
        /// <returns>The optimal workspace array length.</returns>
        /// <remarks>The parameter <paramref name="triangularMatrixType"/> should not have an impact of the calculation of the optimal length of the workspace array.</remarks>
        public static int dsyrdbQuery(this LapackEigenvalues.ISymmetricEigenvalueProblems symmetricEigenvalueProblems, MklLapackEigenvalues.DsyrdbJob job, int n, int kd, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix)
        {
            var lwork = -1;
            var jobz  = GetJob(job);
            var uplo  = GetUplo(triangularMatrixType);

            unsafe
            {
                double *work = stackalloc double[1];
                int     info;

                _dsyrdb(ref jobz, ref uplo, ref n, ref kd, null, ref n, null, null, null, null, ref n, work, ref lwork, out info);
                CheckForError(info, "dsyrdb");

                return(((int)work[0]) + 1);
            }
        }
예제 #3
0
 /// <summary>Gets a optimal workspace array length for the <c>driver_dsyevr</c> function.
 /// </summary>
 /// <param name="symmetricEigenvalueProblems">The <see cref="LapackEigenvalues.ISymmetricEigenvalueProblems"/> object.</param>
 /// <param name="job">A value indicating what kind of job to do by the LAPACK function.</param>
 /// <param name="n">The order of the tridiagonal matrix.</param>
 /// <param name="liwork">The optimal workspace array length for parameter 'work'.</param>
 /// <param name="lwork">The optimal workspace array length for parameter 'iwork'.</param>
 /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of the Hermitian input matrix is stored.</param>
 /// <param name="abstol">The absolute error tolerance for the eigenvalues.</param>
 /// <remarks>The parameter <paramref name="triangularMatrixType"/> should not have an impact of the calculation of the optimal length of the workspace array.</remarks>
 public static void driver_dsyevrQuery(this LapackEigenvalues.ISymmetricEigenvalueProblems symmetricEigenvalueProblems, LapackEigenvalues.SymmetricGeneralJob job, int n, out int lwork, out int liwork, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix, double abstol = MachineConsts.Epsilon)
 {
     symmetricEigenvalueProblems.driver_dsyevrQuery(job, LapackEigenvalues.SymmetricEigenvaluesRange.All, n, 0, 0, 0, 0, out lwork, out liwork, triangularMatrixType, abstol);
 }
예제 #4
0
 /// <summary>Computes all eigenvalues and, optionally, eigenvectors of a real symmetric matrix using the Relatively Robust Representations.
 /// </summary>
 /// <param name="symmetricEigenvalueProblems">The <see cref="LapackEigenvalues.ISymmetricEigenvalueProblems"/> object.</param>
 /// <param name="job">A value indicating what kind of job to do by the LAPACK function.</param>
 /// <param name="n">The order of the tridiagonal matrix.</param>
 /// <param name="a">The symmetric matrix, i.e. containing either upper or lower triangular part of the symmetric matrix, as specified by <paramref name="triangularMatrixType"/>. The length should be at least <paramref name="n"/>^2; overwritten on exit.</param>
 /// <param name="m">The total number of eigenvalues found (output).</param>
 /// <param name="w">The first <paramref name="m"/> values contain the selected eigenvalues in ascending order; this array should have a length of at least <paramref name="n"/> (output).</param>
 /// <param name="z">If <paramref name="job"/> indicates to compute eigenvectors, the first <paramref name="m"/> columns of matrix Z contain the orthonormal eigenvectors.</param>
 /// <param name="isuppz">The support of the eigenvectors in matrix Z, that is the indices indicating the nonzero elements in z (output).</param>
 /// <param name="work">A workspace array with at least 26 * <paramref name="n"/> elements.</param>
 /// <param name="iwork">A workspace array with at least 10 * <paramref name="n"/> elements.</param>
 /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of the symmetric input matrix is stored.</param>
 /// <param name="abstol">The absolute error tolerance for the eigenvalues.</param>
 public static void driver_dsyevr(this LapackEigenvalues.ISymmetricEigenvalueProblems symmetricEigenvalueProblems, LapackEigenvalues.SymmetricGeneralJob job, int n, double[] a, out int m, double[] w, double[] z, int[] isuppz, double[] work, int[] iwork, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix, double abstol = MachineConsts.Epsilon)
 {
     symmetricEigenvalueProblems.driver_dsyevr(job, LapackEigenvalues.SymmetricEigenvaluesRange.All, n, a, 0, 0, 0, 0, out m, w, z, isuppz, work, iwork, triangularMatrixType, abstol);
 }