From 75d4c408aaf2b9e9485266297d599329931e8737 Mon Sep 17 00:00:00 2001 From: Typhaceae Date: Tue, 30 Dec 2025 20:28:58 +0800 Subject: [PATCH 1/3] Switch from xPPTRF to xPOTRF to improve TurbSim speed on macOS --- .../src/NetLib/lapack/NWTC_LAPACK.f90 | 280 +++++++++++------- 1 file changed, 169 insertions(+), 111 deletions(-) diff --git a/modules/nwtc-library/src/NetLib/lapack/NWTC_LAPACK.f90 b/modules/nwtc-library/src/NetLib/lapack/NWTC_LAPACK.f90 index bf48d3626..a9e898f8b 100644 --- a/modules/nwtc-library/src/NetLib/lapack/NWTC_LAPACK.f90 +++ b/modules/nwtc-library/src/NetLib/lapack/NWTC_LAPACK.f90 @@ -1412,127 +1412,185 @@ END SUBROUTINE LAPACK_SPOSV !> Compute the Cholesky factorization of a real symmetric positive definite matrix A stored in packed format. !! use LAPACK_PPTRF (nwtc_lapack::lapack_pptrf) instead of this specific function. SUBROUTINE LAPACK_DPPTRF (UPLO, N, AP, ErrStat, ErrMsg) - - ! DPPTRF computes the Cholesky factorization of a real symmetric - ! positive definite matrix A stored in packed format. - ! - ! The factorization has the form - ! A = U**T * U, if UPLO = 'U', or - ! A = L * L**T, if UPLO = 'L', - ! where U is an upper triangular matrix and L is lower triangular. - - ! passed parameters - - INTEGER, intent(in ) :: N !< The order of the matrix A. N >= 0. - - ! .. Array Arguments .. - REAL(R8Ki) ,intent(inout) :: AP( : ) !< AP is REAL array, dimension (N*(N+1)/2) - !! On entry, the upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A - !! is stored in the array AP as follows: - !! if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; - !! if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. - !! See below for further details. - !! On exit, if INFO = 0, the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, in the same storage format as A. - !! - !! Further details: - !! The packed storage scheme is illustrated by the following example - !! when N = 4, UPLO = 'U': - !! - !! Two-dimensional storage of the symmetric matrix A: - !! - !! a11 a12 a13 a14 - !! a22 a23 a24 - !! a33 a34 (aij = aji) - !! a44 - !! - !! Packed storage of the upper triangle of A: - !! - !! AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ] - - - INTEGER(IntKi), intent( out) :: ErrStat !< Error level - CHARACTER(*), intent( out) :: ErrMsg !< Message describing error - CHARACTER(1), intent(in ) :: UPLO !< 'U': Upper triangle of A is stored; 'L': Lower triangle of A is stored. - - - - ! local variables - INTEGER :: INFO ! = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; - ! > 0: if INFO = i, the leading minor of order i is not positive definite, and the factorization could not be completed. - - - ErrStat = ErrID_None - ErrMsg = "" - - CALL DPPTRF (UPLO, N, AP, INFO) - - IF (INFO /= 0) THEN - ErrStat = ErrID_FATAL - WRITE( ErrMsg, * ) INFO - IF (INFO < 0) THEN - ErrMsg = "LAPACK_DPPTRF: illegal value in argument "//TRIM(ErrMsg)//"." + ! DPPTRF computes the Cholesky factorization of a real symmetric + ! positive definite matrix A stored in packed format. + ! + ! Internally, packed storage is converted to full storage and DPOTRF + ! is called. The result is converted back to packed storage. + ! + ! The factorization has the form + ! A = U**T * U, if UPLO = 'U', or + ! A = L * L**T, if UPLO = 'L'. + + INTEGER, INTENT(IN ) :: N + REAL(R8Ki), INTENT(INOUT) :: AP(:) + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(1), INTENT(IN ) :: UPLO + + REAL(R8Ki), ALLOCATABLE :: A(:,:) + INTEGER :: I, J, IDX, INFO + + ErrStat = ErrID_None + ErrMsg = "" + + IF (N <= 0) RETURN + + ALLOCATE(A(N,N)) + A = 0.0_R8Ki + + IF (UPLO == 'U') THEN + IDX = 0 + DO J = 1, N + DO I = 1, J + IDX = IDX + 1 + A(I,J) = AP(IDX) + END DO + END DO + ELSE IF (UPLO == 'L') THEN + IDX = 0 + DO J = 1, N + DO I = J, N + IDX = IDX + 1 + A(I,J) = AP(IDX) + END DO + END DO ELSE - ErrMsg = 'LAPACK_DPPTRF: Leading minor order '//TRIM(ErrMsg)//' of A is not positive definite, so Cholesky factorization could not be completed.' + ErrStat = ErrID_FATAL + ErrMsg = "LAPACK_DPPTRF: invalid UPLO value." + DEALLOCATE(A) + RETURN END IF - END IF - - - RETURN - END SUBROUTINE LAPACK_DPPTRF + + CALL DPOTRF (UPLO, N, A, N, INFO) + + IF (INFO /= 0) THEN + ErrStat = ErrID_FATAL + WRITE(ErrMsg,*) INFO + IF (INFO < 0) THEN + ErrMsg = "LAPACK_DPPTRF: illegal value in argument "//TRIM(ErrMsg)//"." + ELSE + ErrMsg = "LAPACK_DPPTRF: Leading minor of order "//TRIM(ErrMsg)// & + " of A is not positive definite, so Cholesky factorization could not be completed." + END IF + DEALLOCATE(A) + RETURN + END IF + + IF (UPLO == 'U') THEN + IDX = 0 + DO J = 1, N + DO I = 1, J + IDX = IDX + 1 + AP(IDX) = A(I,J) + END DO + END DO + ELSE + IDX = 0 + DO J = 1, N + DO I = J, N + IDX = IDX + 1 + AP(IDX) = A(I,J) + END DO + END DO + END IF + + DEALLOCATE(A) + RETURN + + END SUBROUTINE LAPACK_DPPTRF !======================================================================= !> Compute the Cholesky factorization of a real symmetric positive definite matrix A stored in packed format. !! use LAPACK_PPTRF (nwtc_lapack::lapack_pptrf) instead of this specific function. SUBROUTINE LAPACK_SPPTRF (UPLO, N, AP, ErrStat, ErrMsg) - - ! SPPTRF computes the Cholesky factorization of a real symmetric - ! positive definite matrix A stored in packed format. - ! - ! The factorization has the form - ! A = U**T * U, if UPLO = 'U', or - ! A = L * L**T, if UPLO = 'L', - ! where U is an upper triangular matrix and L is lower triangular. - - ! passed parameters - - INTEGER, intent(in ) :: N !< The order of the matrix A. N >= 0. - - ! .. Array Arguments .. - REAL(SiKi) ,intent(inout) :: AP( : ) !< AP is REAL array, dimension (N*(N+1)/2) - !! On entry, the upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A - !! is stored in the array AP as follows: - !! if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; - !! if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. - !! See LAPACK_DPPTRF for further details. - !! On exit, if INFO = 0, the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, in the same storage format as A. - - INTEGER(IntKi), intent( out) :: ErrStat !< Error level - CHARACTER(*), intent( out) :: ErrMsg !< Message describing error - CHARACTER(1), intent(in ) :: UPLO !< 'U': Upper triangle of A is stored; 'L': Lower triangle of A is stored. - - ! local variables - INTEGER :: INFO ! = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; - ! > 0: if INFO = i, the leading minor of order i is not positive definite, and the factorization could not be completed - - - ErrStat = ErrID_None - ErrMsg = "" - - CALL SPPTRF (UPLO, N, AP, INFO) - - IF (INFO /= 0) THEN - ErrStat = ErrID_FATAL - WRITE( ErrMsg, * ) INFO - IF (INFO < 0) THEN - ErrMsg = "LAPACK_SPPTRF: illegal value in argument "//TRIM(ErrMsg)//"." + ! SPPTRF computes the Cholesky factorization of a real symmetric + ! positive definite matrix A stored in packed format. + ! + ! Internally, packed storage is converted to full storage and SPOTRF + ! is called. The result is converted back to packed storage. + ! + ! The factorization has the form + ! A = U**T * U, if UPLO = 'U', or + ! A = L * L**T, if UPLO = 'L'. + + INTEGER, INTENT(IN ) :: N + REAL(SiKi), INTENT(INOUT) :: AP(:) + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(1), INTENT(IN ) :: UPLO + + REAL(SiKi), ALLOCATABLE :: A(:,:) + INTEGER :: I, J, IDX, INFO + + ErrStat = ErrID_None + ErrMsg = "" + + IF (N <= 0) RETURN + + ALLOCATE(A(N,N)) + A = 0.0_SiKi + + IF (UPLO == 'U') THEN + IDX = 0 + DO J = 1, N + DO I = 1, J + IDX = IDX + 1 + A(I,J) = AP(IDX) + END DO + END DO + ELSE IF (UPLO == 'L') THEN + IDX = 0 + DO J = 1, N + DO I = J, N + IDX = IDX + 1 + A(I,J) = AP(IDX) + END DO + END DO ELSE - ErrMsg = 'LAPACK_SPPTRF: Leading minor order '//TRIM(ErrMsg)//' of A is not positive definite, so Cholesky factorization could not be completed.' + ErrStat = ErrID_FATAL + ErrMsg = "LAPACK_SPPTRF: invalid UPLO value." + DEALLOCATE(A) + RETURN END IF - END IF - - - RETURN + + CALL SPOTRF (UPLO, N, A, N, INFO) + + IF (INFO /= 0) THEN + ErrStat = ErrID_FATAL + WRITE(ErrMsg,*) INFO + IF (INFO < 0) THEN + ErrMsg = "LAPACK_SPPTRF: illegal value in argument "//TRIM(ErrMsg)//"." + ELSE + ErrMsg = "LAPACK_SPPTRF: Leading minor of order "//TRIM(ErrMsg)// & + " of A is not positive definite, so Cholesky factorization could not be completed." + END IF + DEALLOCATE(A) + RETURN + END IF + + IF (UPLO == 'U') THEN + IDX = 0 + DO J = 1, N + DO I = 1, J + IDX = IDX + 1 + AP(IDX) = A(I,J) + END DO + END DO + ELSE + IDX = 0 + DO J = 1, N + DO I = J, N + IDX = IDX + 1 + AP(IDX) = A(I,J) + END DO + END DO + END IF + + DEALLOCATE(A) + RETURN + END SUBROUTINE LAPACK_SPPTRF !======================================================================= !> Compute singular value decomposition (SVD) for a general matrix, A. From bed151b6fd8843086d546a8ee4a57b80e84af526 Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Mon, 2 Mar 2026 16:50:58 -0700 Subject: [PATCH 2/3] nwtclib: update xPOTRF routines, re-add xPPTRF routines commit 75d4c408a changed the xPPTRF routines to call the xPOTRF lapack routines, but we want to keep both. --- .../src/NetLib/lapack/NWTC_LAPACK.f90 | 158 ++++++++++++++++-- 1 file changed, 145 insertions(+), 13 deletions(-) diff --git a/modules/nwtc-library/src/NetLib/lapack/NWTC_LAPACK.f90 b/modules/nwtc-library/src/NetLib/lapack/NWTC_LAPACK.f90 index a9e898f8b..3561c9816 100644 --- a/modules/nwtc-library/src/NetLib/lapack/NWTC_LAPACK.f90 +++ b/modules/nwtc-library/src/NetLib/lapack/NWTC_LAPACK.f90 @@ -77,6 +77,12 @@ MODULE NWTC_LAPACK MODULE PROCEDURE LAPACK_sposv END INTERFACE + !> Compute the Cholesky factorization of a real symmetric positive definite matrix A stored in packed format (internally handled as unpacked). + INTERFACE LAPACK_potrf + MODULE PROCEDURE LAPACK_dpotrf + MODULE PROCEDURE LAPACK_spotrf + END INTERFACE + !> Compute the Cholesky factorization of a real symmetric positive definite matrix A stored in packed format. INTERFACE LAPACK_pptrf MODULE PROCEDURE LAPACK_dpptrf @@ -1410,10 +1416,10 @@ SUBROUTINE LAPACK_SPOSV (UPLO, N, NRHS, A, B, ErrStat, ErrMsg) END SUBROUTINE LAPACK_SPOSV !======================================================================= !> Compute the Cholesky factorization of a real symmetric positive definite matrix A stored in packed format. -!! use LAPACK_PPTRF (nwtc_lapack::lapack_pptrf) instead of this specific function. - SUBROUTINE LAPACK_DPPTRF (UPLO, N, AP, ErrStat, ErrMsg) +!! use LAPACK_POTRF (nwtc_lapack::lapack_potrf) instead of this specific function. + SUBROUTINE LAPACK_DPOTRF (UPLO, N, AP, ErrStat, ErrMsg) - ! DPPTRF computes the Cholesky factorization of a real symmetric + ! DPOTRF computes the Cholesky factorization of a real symmetric ! positive definite matrix A stored in packed format. ! ! Internally, packed storage is converted to full storage and DPOTRF @@ -1458,7 +1464,7 @@ SUBROUTINE LAPACK_DPPTRF (UPLO, N, AP, ErrStat, ErrMsg) END DO ELSE ErrStat = ErrID_FATAL - ErrMsg = "LAPACK_DPPTRF: invalid UPLO value." + ErrMsg = "LAPACK_DPOTRF: invalid UPLO value." DEALLOCATE(A) RETURN END IF @@ -1469,9 +1475,9 @@ SUBROUTINE LAPACK_DPPTRF (UPLO, N, AP, ErrStat, ErrMsg) ErrStat = ErrID_FATAL WRITE(ErrMsg,*) INFO IF (INFO < 0) THEN - ErrMsg = "LAPACK_DPPTRF: illegal value in argument "//TRIM(ErrMsg)//"." + ErrMsg = "LAPACK_DPOTRF: illegal value in argument "//TRIM(ErrMsg)//"." ELSE - ErrMsg = "LAPACK_DPPTRF: Leading minor of order "//TRIM(ErrMsg)// & + ErrMsg = "LAPACK_DPOTRF: Leading minor of order "//TRIM(ErrMsg)// & " of A is not positive definite, so Cholesky factorization could not be completed." END IF DEALLOCATE(A) @@ -1499,13 +1505,13 @@ SUBROUTINE LAPACK_DPPTRF (UPLO, N, AP, ErrStat, ErrMsg) DEALLOCATE(A) RETURN - END SUBROUTINE LAPACK_DPPTRF + END SUBROUTINE LAPACK_DPOTRF !======================================================================= !> Compute the Cholesky factorization of a real symmetric positive definite matrix A stored in packed format. -!! use LAPACK_PPTRF (nwtc_lapack::lapack_pptrf) instead of this specific function. - SUBROUTINE LAPACK_SPPTRF (UPLO, N, AP, ErrStat, ErrMsg) +!! use LAPACK_POTRF (nwtc_lapack::lapack_potrf) instead of this specific function. + SUBROUTINE LAPACK_SPOTRF (UPLO, N, AP, ErrStat, ErrMsg) - ! SPPTRF computes the Cholesky factorization of a real symmetric + ! SPOTRF computes the Cholesky factorization of a real symmetric ! positive definite matrix A stored in packed format. ! ! Internally, packed storage is converted to full storage and SPOTRF @@ -1550,7 +1556,7 @@ SUBROUTINE LAPACK_SPPTRF (UPLO, N, AP, ErrStat, ErrMsg) END DO ELSE ErrStat = ErrID_FATAL - ErrMsg = "LAPACK_SPPTRF: invalid UPLO value." + ErrMsg = "LAPACK_SPOTRF: invalid UPLO value." DEALLOCATE(A) RETURN END IF @@ -1561,9 +1567,9 @@ SUBROUTINE LAPACK_SPPTRF (UPLO, N, AP, ErrStat, ErrMsg) ErrStat = ErrID_FATAL WRITE(ErrMsg,*) INFO IF (INFO < 0) THEN - ErrMsg = "LAPACK_SPPTRF: illegal value in argument "//TRIM(ErrMsg)//"." + ErrMsg = "LAPACK_SPOTRF: illegal value in argument "//TRIM(ErrMsg)//"." ELSE - ErrMsg = "LAPACK_SPPTRF: Leading minor of order "//TRIM(ErrMsg)// & + ErrMsg = "LAPACK_SPOTRF: Leading minor of order "//TRIM(ErrMsg)// & " of A is not positive definite, so Cholesky factorization could not be completed." END IF DEALLOCATE(A) @@ -1591,6 +1597,132 @@ SUBROUTINE LAPACK_SPPTRF (UPLO, N, AP, ErrStat, ErrMsg) DEALLOCATE(A) RETURN + END SUBROUTINE LAPACK_SPOTRF +!======================================================================= +!> Compute the Cholesky factorization of a real symmetric positive definite matrix A stored in packed format. +!! use LAPACK_PPTRF (nwtc_lapack::lapack_pptrf) instead of this specific function. + SUBROUTINE LAPACK_DPPTRF (UPLO, N, AP, ErrStat, ErrMsg) + + ! DPPTRF computes the Cholesky factorization of a real symmetric + ! positive definite matrix A stored in packed format. + ! + ! The factorization has the form + ! A = U**T * U, if UPLO = 'U', or + ! A = L * L**T, if UPLO = 'L', + ! where U is an upper triangular matrix and L is lower triangular. + + + ! passed parameters + + INTEGER, intent(in ) :: N !< The order of the matrix A. N >= 0. + + ! .. Array Arguments .. + REAL(R8Ki) ,intent(inout) :: AP( : ) !< AP is REAL array, dimension (N*(N+1)/2) + !! On entry, the upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A + !! is stored in the array AP as follows: + !! if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; + !! if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. + !! See below for further details. + !! On exit, if INFO = 0, the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, in the same storage format as A. + !! + !! Further details: + !! The packed storage scheme is illustrated by the following example + !! when N = 4, UPLO = 'U': + !! + !! Two-dimensional storage of the symmetric matrix A: + !! + !! a11 a12 a13 a14 + !! a22 a23 a24 + !! a33 a34 (aij = aji) + !! a44 + !! + !! Packed storage of the upper triangle of A: + !! + !! AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ] + + + INTEGER(IntKi), intent( out) :: ErrStat !< Error level + CHARACTER(*), intent( out) :: ErrMsg !< Message describing error + CHARACTER(1), intent(in ) :: UPLO !< 'U': Upper triangle of A is stored; 'L': Lower triangle of A is stored. + + + + ! local variables + INTEGER :: INFO ! = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; + ! > 0: if INFO = i, the leading minor of order i is not positive definite, and the factorization could not be completed. + + + ErrStat = ErrID_None + ErrMsg = "" + + CALL DPPTRF (UPLO, N, AP, INFO) + + IF (INFO /= 0) THEN + ErrStat = ErrID_FATAL + WRITE( ErrMsg, * ) INFO + IF (INFO < 0) THEN + ErrMsg = "LAPACK_DPPTRF: illegal value in argument "//TRIM(ErrMsg)//"." + ELSE + ErrMsg = 'LAPACK_DPPTRF: Leading minor order '//TRIM(ErrMsg)//' of A is not positive definite, so Cholesky factorization could not be completed.' + END IF + END IF + + + RETURN + END SUBROUTINE LAPACK_DPPTRF +!======================================================================= +!> Compute the Cholesky factorization of a real symmetric positive definite matrix A stored in packed format. +!! use LAPACK_PPTRF (nwtc_lapack::lapack_pptrf) instead of this specific function. + SUBROUTINE LAPACK_SPPTRF (UPLO, N, AP, ErrStat, ErrMsg) + + ! SPPTRF computes the Cholesky factorization of a real symmetric + ! positive definite matrix A stored in packed format. + ! + ! The factorization has the form + ! A = U**T * U, if UPLO = 'U', or + ! A = L * L**T, if UPLO = 'L', + ! where U is an upper triangular matrix and L is lower triangular. + + + ! passed parameters + + INTEGER, intent(in ) :: N !< The order of the matrix A. N >= 0. + + ! .. Array Arguments .. + REAL(SiKi) ,intent(inout) :: AP( : ) !< AP is REAL array, dimension (N*(N+1)/2) + !! On entry, the upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A + !! is stored in the array AP as follows: + !! if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; + !! if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. + !! See LAPACK_DPPTRF for further details. + !! On exit, if INFO = 0, the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T, in the same storage format as A. + + INTEGER(IntKi), intent( out) :: ErrStat !< Error level + CHARACTER(*), intent( out) :: ErrMsg !< Message describing error + CHARACTER(1), intent(in ) :: UPLO !< 'U': Upper triangle of A is stored; 'L': Lower triangle of A is stored. + + ! local variables + INTEGER :: INFO ! = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; + ! > 0: if INFO = i, the leading minor of order i is not positive definite, and the factorization could not be completed + + + ErrStat = ErrID_None + ErrMsg = "" + + CALL SPPTRF (UPLO, N, AP, INFO) + + IF (INFO /= 0) THEN + ErrStat = ErrID_FATAL + WRITE( ErrMsg, * ) INFO + IF (INFO < 0) THEN + ErrMsg = "LAPACK_SPPTRF: illegal value in argument "//TRIM(ErrMsg)//"." + ELSE + ErrMsg = 'LAPACK_SPPTRF: Leading minor order '//TRIM(ErrMsg)//' of A is not positive definite, so Cholesky factorization could not be completed.' + END IF + END IF + + + RETURN END SUBROUTINE LAPACK_SPPTRF !======================================================================= !> Compute singular value decomposition (SVD) for a general matrix, A. From 1495a52447eaf8c4620cac8e88be01a8cd3bac82 Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Mon, 2 Mar 2026 16:38:41 -0700 Subject: [PATCH 3/3] TurbSim: use xPOTRF instead of xPPTRF See PR #3123 --- modules/turbsim/src/TSsubs.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/turbsim/src/TSsubs.f90 b/modules/turbsim/src/TSsubs.f90 index fd8753c5a..4c0dbc548 100644 --- a/modules/turbsim/src/TSsubs.f90 +++ b/modules/turbsim/src/TSsubs.f90 @@ -763,7 +763,7 @@ SUBROUTINE Coh2H( p, IVec, IFreq, TRH, S, ErrStat, ErrMsg ) NPts = p%grid%NPoints END IF - CALL LAPACK_pptrf( 'L', NPts, TRH(Indx:), ErrStat, ErrMsg ) ! 'L'ower triangular 'TRH' matrix (packed form), of order 'NPoints'; returns Stat + CALL LAPACK_potrf( 'L', NPts, TRH(Indx:), ErrStat, ErrMsg ) ! 'L'ower triangular 'TRH' matrix (unpacked form), of order 'NPoints'; returns Stat IF ( ErrStat /= ErrID_None ) THEN IF (ErrStat < AbortErrLev) then