/// <summary>Returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of symmetric matrix supplied in packed form. /// </summary> /// <param name="matrixNormType">The type of the matrix norm.</param> /// <param name="n">The order of the matrix.</param> /// <param name="ap">The specified symmetric matrix in packed form, i.e. either upper or lower triangle as specified in <paramref name="triangularMatrixType"/> with at least <paramref name="n"/> * (<paramref name="n"/> + 1) / 2 elements.</param> /// <param name="work">A workspace array which is referenced in the case of 1- or infinity-norm only. In this case the length must be at least <paramref name="n"/>.</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of the symmetric input matrix is stored.</param> /// <returns>The value of the specific matrix norm.</returns> public double dlansp(MatrixNormType matrixNormType, int n, double[] ap, double[] work, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix) { var norm = LAPACK.GetMatrixNormType(matrixNormType); var uplo = LAPACK.GetUplo(triangularMatrixType); return(_dlansp(ref norm, ref uplo, ref n, ap, work)); }
/// <summary>Computes the Bunch-Kaufman factorization of a Hermitian matrix using packed storage, i.e. A = P * U * D * conj(U') * conj(P') or A = P * L * D * conj(L') * conj(P'), where P is a permutation matrix, U and L are upper and /// lower triangular matrices with unit diagonal and D is a symmetric block-diagonal matrix with 1-by-1 and 2-by-2 diagonal blocks. U and L have 2-by-2 unit diagonal blocks corresponding to the 2-by-2 blocks of D. /// </summary> /// <param name="n">The order of the matrix.</param> /// <param name="aPacked">Either the upper or lower triangular part of matrix A in packed storage, i.e. at least <paramref name="n"/> * (<paramref name="n"/> + 1)/2 elements; overwritten by details of the block-diagonal matrix D and the multiplies used to obtain the factor U (or L).</param> /// <param name="iPivot">Contains details of the interchanges an the block structure of D, at least <paramref name="n"/> elements (output).</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of matrix A is stored and how matrix A is factored.</param> public void zhptrf(int n, Complex[] aPacked, int[] iPivot, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix) { int info; var uplo = LAPACK.GetUplo(triangularMatrixType); _zhptrf(ref uplo, ref n, aPacked, iPivot, out info); CheckForError(info, "zhptrf"); }
/// <summary>Computes the Cholesky factorization of a symmetric positive-definite matrix using packed storage, i.e. /// A = U' * U or A = L * L', where L is a lower triangular matrix and U is upper triangular. /// </summary> /// <param name="n">The order of the matrix.</param> /// <param name="aPacked">Either the upper or lower triangular part of matrix A in packed storage, i.e. at least <paramref name="n"/> * (<paramref name="n"/> + 1)/2 elements; overwritten by the upper or lower triangular matrix U, L respectively in packed storage.</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of matrix A is stored and how matrix A is factored.</param> public void dpptrf(int n, double[] aPacked, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix) { int info; var uplo = LAPACK.GetUplo(triangularMatrixType); _dpptrf(ref uplo, ref n, aPacked, out info); CheckForError(info, "dpptrf"); }
/// <summary>Computes the Cholesky decomposition of a Hermitian positive-definite matrix, i.e. A = conj(U') * U or A = L * conj(L'), where L is a lower triangular matrix and U is upper triangular. /// </summary> /// <param name="n">The order of the matrix.</param> /// <param name="a">The matrix A supplied column-by-column of dimension (<paramref name="n"/>; <paramref name="n"/>); overwritten by the upper or lower triangular matrix U, L respectively.</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of matrix A is stored and how matrix A is factored.</param> public void zpotrf(int n, Complex[] a, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix) { int info; var uplo = LAPACK.GetUplo(triangularMatrixType); _zpotrf(ref uplo, ref n, a, ref n, out info); CheckForError(info, "zpotrf"); }
/// <summary>Computes the Bunch-Kaufman factorization of a complex Hermitian matrix, i.e. A = P * U * D * conj(U') * conj(P') or A = P * L * D * conj(L') * conj(P'), where P is a permutation matrix, U and L are upper and /// lower triangular matrices with unit diagonal and D is a symmetric block-diagonal matrix with 1-by-1 and 2-by-2 diagonal blocks. U and L have 2-by-2 unit diagonal blocks corresponding to the 2-by-2 blocks of D. /// </summary> /// <param name="n">The order of the matrix.</param> /// <param name="a">The upper or the lower triangular part of the input matrix of dimension (<paramref name="n"/>; <paramref name="n"/>); overwritten by details of the block-diagonal matrix D and the multiplies used to obtain the factor U (or L).</param> /// <param name="iPivot">Contains details of the interchanges an the block structure of D, at least <paramref name="n"/> elements (output).</param> /// <param name="work">A workspace array of length at least <paramref name="n"/>.</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of matrix A is stored and how matrix A is factored.</param> public void zhetrf(int n, Complex[] a, int[] iPivot, Complex[] work, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix) { int info; int lwork = work.Length; var uplo = LAPACK.GetUplo(triangularMatrixType); _zhetrf(ref uplo, ref n, a, ref n, iPivot, work, ref lwork, out info); CheckForError(info, "zhetrf"); }
/// <summary>Computes the Cholesky factorization of a Hermitian positive-definite band matrix, i.e. i.e. A = conj(U') * U or A = L * conj(L'), where L is a lower triangular matrix and U is upper triangular. /// </summary> /// <param name="n">The order of the matrix.</param> /// <param name="kd">The number of superdiagonals or subdiagonals in the input matrix.</param> /// <param name="a">Either the upper or lower triangular part of the input matrix in band storage of dimension (<paramref name="kd"/> + 1; <paramref name="n"/>); overwritten by the upper or lower triangular matrix U, L respectively.</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of matrix A is stored and how matrix A is factored.</param> public void zpbtrf(int n, int kd, Complex[] a, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix) { int info; int lda = kd + 1; var uplo = LAPACK.GetUplo(triangularMatrixType); _zpbtrf(ref uplo, ref n, ref kd, a, ref lda, out info); CheckForError(info, "zpbtrf"); }
/// <summary>Computes the Cholesky factorization of a Hermitian positive-definite matrix using the Rectangular Full Packed (RFP) format, i.e. /// A = conj(U') * U or A = L * conj(L'), where L is a lower triangular matrix and U is upper triangular. /// </summary> /// <param name="n">The order of the matrix.</param> /// <param name="a">The matrix A in the RFP format, i.e. an array with at least <paramref name="n"/> * (<paramref name="n"/> + 1) / 2 elements; overwritten by the upper or lower triangular matrix U, L respectively.</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of matrix A is stored and how matrix A is factored.</param> /// <param name="transposeState">A value indicating whether <paramref name="a"/> represents matrix A or its transposed.</param> public void zpftrf(int n, Complex[] a, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix, BLAS.MatrixTransposeState transposeState = BLAS.MatrixTransposeState.NoTranspose) { int info; var trans = LAPACK.GetTrans(transposeState); var uplo = LAPACK.GetUplo(triangularMatrixType); _zpftrf(ref trans, ref uplo, ref n, a, out info); CheckForError(info, "zpftrf"); }
/// <summary>Gets a optimal workspace array length for the <c>zhetrf</c> function. /// </summary> /// <param name="n">The order of the matrix.</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of matrix A is stored and how matrix A is factored.</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 int zhetrfQuery(int n, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix) { var lwork = -1; var uplo = LAPACK.GetUplo(triangularMatrixType); unsafe { Complex *work = stackalloc Complex[1]; int info; _zhetrf(ref uplo, ref n, null, ref n, null, work, ref lwork, out info); CheckForError(info, "zhetrf"); return(((int)work[0].Real) + 1); } }
/// <summary>Gets a optimal workspace array length for the <c>dsytrf</c> function. /// </summary> /// <param name="n">The order of the matrix.</param> /// <param name="triangularMatrixType">A value indicating whether the upper or lower triangular part of matrix A is stored and how matrix A is factored.</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 int dsytrfQuery(int n, BLAS.TriangularMatrixType triangularMatrixType = BLAS.TriangularMatrixType.LowerTriangularMatrix) { var lwork = -1; var uplo = LAPACK.GetUplo(triangularMatrixType); unsafe { double *work = stackalloc double[1]; int info; _dsytrf(ref uplo, ref n, null, ref n, null, work, ref lwork, out info); CheckForError(info, "dsytrf"); return(((int)work[0]) + 1); } }