All derivatives for , reusing a precomputed ASSOC_LEGENDRE_ALL table rather than recomputing from scratch.
Warning
Inherits ASSOC_LEGENDRE_ALL's stability limit (safe for
at any ) -- see STABILITY_FINDINGS.md
at the repo root, Part 2.
by PLM_INDEX(l,m); 0 at the poles ().
ASSOC_LEGENDRE_ALL, same size/indexing.
P).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(out) | :: | DP_OUT((LMAX+1)*(LMAX+2)/2) | |||
| real(kind=dp), | intent(in) | :: | P((LMAX+1)*(LMAX+2)/2) | |||
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree, (must match |
||
| real(kind=dp), | intent(in) | :: | X |
Argument, (must match the |
SUBROUTINE DDX_ASSOC_LEGENDRE_ALL_DP(DP_OUT, P, LMAX, X) IMPLICIT NONE INTEGER(KIND=i4), INTENT(IN) :: LMAX REAL(KIND=dp), INTENT(IN) :: X REAL(KIND=dp), INTENT(IN) :: P((LMAX+1)*(LMAX+2)/2) REAL(KIND=dp), INTENT(OUT) :: DP_OUT((LMAX+1)*(LMAX+2)/2) INTEGER(KIND=i4) :: L, M REAL(KIND=dp) :: DOM DOM = 1.0_dp - X**2 DO M = 0, LMAX DO L = M, LMAX IF (ABS(X) .GE. 1.0_dp .OR. L .EQ. 0) THEN DP_OUT(PLM_INDEX(L, M)) = 0.0_dp ELSE IF (L .EQ. M) THEN DP_OUT(PLM_INDEX(L, M)) = & -L * X * P(PLM_INDEX(L, M)) / DOM ELSE DP_OUT(PLM_INDEX(L, M)) = & ((L+M)*P(PLM_INDEX(L-1, M)) - & L*X*P(PLM_INDEX(L, M))) / DOM END IF END DO END DO END SUBROUTINE DDX_ASSOC_LEGENDRE_ALL_DP