Skip to content

Commit 34745cb

Browse files
committed
Make use of the new handle_gesv_info function.
1 parent 8acc8de commit 34745cb

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

src/stdlib_linalg_matrix_functions.fypp

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ submodule (stdlib_linalg) stdlib_linalg_matrix_functions
55
use stdlib_linalg_constants
66
use stdlib_linalg_blas, only: gemm
77
use stdlib_linalg_lapack, only: gesv
8+
use stdlib_linalg_lapack_aux, only: handle_gesv_info
89
use stdlib_linalg_state, only: linalg_state_type, linalg_error_handling, LINALG_ERROR, &
910
LINALG_INTERNAL_ERROR, LINALG_VALUE_ERROR
1011
implicit none
1112

13+
character(len=*), parameter :: this = "matrix_exponential"
14+
1215
contains
1316

1417
#:for rk,rt,ri in RC_KINDS_TYPES
@@ -96,7 +99,7 @@ contains
9699
block
97100
integer(ilp) :: ipiv(n), info
98101
call gesv(n, n, Q, n, ipiv, E, n, info) ! E = inv(Q) @ E
99-
call handle_gesv_info(info, n, n, n, err0)
102+
call handle_gesv_info(this, info, n, n, n, err0)
100103
call linalg_error_handling(err0, err)
101104
end block
102105

@@ -113,28 +116,6 @@ contains
113116
enddo
114117
end block
115118
return
116-
contains
117-
elemental subroutine handle_gesv_info(info,lda,n,nrhs,err)
118-
integer(ilp), intent(in) :: info,lda,n,nrhs
119-
type(linalg_state_type), intent(out) :: err
120-
! Process output
121-
select case (info)
122-
case (0)
123-
! Success
124-
case (-1)
125-
err = linalg_state_type(this,LINALG_VALUE_ERROR,'invalid problem size n=',n)
126-
case (-2)
127-
err = linalg_state_type(this,LINALG_VALUE_ERROR,'invalid rhs size n=',nrhs)
128-
case (-4)
129-
err = linalg_state_type(this,LINALG_VALUE_ERROR,'invalid matrix size a=',[lda,n])
130-
case (-7)
131-
err = linalg_state_type(this,LINALG_ERROR,'invalid matrix size a=',[lda,n])
132-
case (1:)
133-
err = linalg_state_type(this,LINALG_ERROR,'singular matrix')
134-
case default
135-
err = linalg_state_type(this,LINALG_INTERNAL_ERROR,'catastrophic error')
136-
end select
137-
end subroutine handle_gesv_info
138119
end function stdlib_expm_${ri}$
139120
#:endfor
140121

0 commit comments

Comments
 (0)