1
1
#:include "common.fypp"
2
2
#:set RC_KINDS_TYPES = REAL_KINDS_TYPES + CMPLX_KINDS_TYPES
3
3
! Cholesky factorization of a matrix, based on LAPACK *POTRF functions
4
- module stdlib_linalg_cholesky
4
+ submodule (stdlib_linalg) stdlib_linalg_cholesky
5
5
use stdlib_linalg_constants
6
6
use stdlib_linalg_lapack, only: potrf
7
7
use stdlib_linalg_state, only: linalg_state_type, linalg_error_handling, LINALG_ERROR, &
8
8
LINALG_INTERNAL_ERROR, LINALG_VALUE_ERROR
9
9
implicit none(type,external)
10
- private
11
-
12
- !> Cholesky factorization of a matrix
13
- public :: cholesky
14
10
15
11
! Returns Lower Cholesky factor
16
12
! NumPy: L = cholesky(a)
@@ -22,15 +18,6 @@ module stdlib_linalg_cholesky
22
18
! SciPy: [C, lower] = cho_factor(a, lower=False, overwrite_a=False, check_finite=True)
23
19
! SciPy: cho_solve(c_and_lower, b, overwrite_b=False, check_finite=True)
24
20
25
- interface cholesky
26
- #:for rk,rt,ri in RC_KINDS_TYPES
27
- #:if rk!="xdp"
28
- module procedure stdlib_linalg_${ri}$_cholesky_inplace
29
- module procedure stdlib_linalg_${ri}$_cholesky
30
- #:endif
31
- #:endfor
32
- end interface cholesky
33
-
34
21
character(*), parameter :: this = 'cholesky'
35
22
36
23
contains
@@ -65,7 +52,7 @@ module stdlib_linalg_cholesky
65
52
66
53
! Compute the Cholesky factorization of a symmetric / Hermitian matrix, A = L*L^T = U^T*U.
67
54
! The factorization is returned in-place, overwriting matrix A
68
- pure subroutine stdlib_linalg_${ri}$_cholesky_inplace(a,lower,other_zeroed,err)
55
+ pure module subroutine stdlib_linalg_${ri}$_cholesky_inplace(a,lower,other_zeroed,err)
69
56
!> Input matrix a[m,n]
70
57
${rt}$, intent(inout), target :: a(:,:)
71
58
!> [optional] is the lower or upper triangular factor required? Default = lower
@@ -127,7 +114,7 @@ module stdlib_linalg_cholesky
127
114
128
115
! Compute the Cholesky factorization of a symmetric / Hermitian matrix, A = L*L^T = U^T*U.
129
116
! The factorization is returned as a separate matrix
130
- pure subroutine stdlib_linalg_${ri}$_cholesky(a,c,lower,other_zeroed,err)
117
+ pure module subroutine stdlib_linalg_${ri}$_cholesky(a,c,lower,other_zeroed,err)
131
118
!> Input matrix a[n,n]
132
119
${rt}$, intent(in) :: a(:,:)
133
120
!> Output matrix with Cholesky factors c[n,n]
@@ -172,4 +159,4 @@ module stdlib_linalg_cholesky
172
159
#:endif
173
160
#:endfor
174
161
175
- end module stdlib_linalg_cholesky
162
+ end submodule stdlib_linalg_cholesky
0 commit comments