Skip to content

Commit 1bc6427

Browse files
committed
Fixed error handling.
1 parent a381d0b commit 1bc6427

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/stdlib_linalg_matrix_functions.fypp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ contains
4848
'invalid matrix sizes: A=',[lda,n], &
4949
' E=',[lde,ne])
5050
else
51-
E(:n, :n) = A(:n, :n) ; call stdlib_linalg_${ri}$_expm_inplace(E, order, err)
51+
E(:n, :n) = A(:n, :n) ; call stdlib_linalg_${ri}$_expm_inplace(E, order, err0)
5252
endif
5353

5454
! Process output and return

test/linalg/test_linalg_expm.fypp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module test_linalg_expm
2323

2424
#:for rk,rt,ri in RC_KINDS_TYPES
2525
tests = [tests, new_unittest("expm_${ri}$",test_expm_${ri}$)]
26-
! tests = [tests, new_unittest("Error-handling expm_${ri}$",test_error_handling_expm_${ri}$)]
26+
tests = [tests, new_unittest("Error-handling expm_${ri}$",test_error_handling_expm_${ri}$)]
2727
#:endfor
2828

2929
end subroutine test_expm_computation
@@ -87,8 +87,19 @@ module test_linalg_expm
8787
call check(error, err%error(), "Negative Pade order")
8888
if (allocated(error)) return
8989

90+
call matrix_exp(A, order=-1, err=err)
91+
! Check result.
92+
call check(error, err%error(), "Negative Pade order")
93+
if (allocated(error)) return
94+
95+
! Compute matrix exponential.
96+
call matrix_exp(A, E(:n, :n-1), err=err)
97+
! Check result.
98+
call check(error, err%error(), "Invalid matrix size")
99+
if (allocated(error)) return
100+
90101
! Compute matrix exponential.
91-
call matrix_exp(A(:n, :n-1), E, err=err)
102+
call matrix_exp(A(:n, :n-1), err=err)
92103
! Check result.
93104
call check(error, err%error(), "Invalid matrix size")
94105
if (allocated(error)) return

0 commit comments

Comments
 (0)