Skip to content

Commit 03c4e2c

Browse files
committed
add GGEV error handling
1 parent cc30d4c commit 03c4e2c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/stdlib_linalg_eigenvalues.fypp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,41 @@ submodule (stdlib_linalg) stdlib_linalg_eigenvalues
5858

5959
end subroutine handle_geev_info
6060

61+
!> Process GGEV output flags
62+
pure subroutine handle_ggev_info(err,info,shapea,shapeb)
63+
!> Error handler
64+
type(linalg_state_type), intent(inout) :: err
65+
!> GEEV return flag
66+
integer(ilp), intent(in) :: info
67+
!> Input matrix size
68+
integer(ilp), intent(in) :: shapea(2),shapeb(2)
69+
70+
select case (info)
71+
case (0)
72+
! Success!
73+
err%state = LINALG_SUCCESS
74+
case (-1)
75+
err = linalg_state_type(this,LINALG_INTERNAL_ERROR,'Invalid task ID: left eigenvectors.')
76+
case (-2)
77+
err = linalg_state_type(this,LINALG_INTERNAL_ERROR,'Invalid task ID: right eigenvectors.')
78+
case (-5,-3)
79+
err = linalg_state_type(this,LINALG_VALUE_ERROR,'invalid matrix size: a=',shapea)
80+
case (-7)
81+
err = linalg_state_type(this,LINALG_VALUE_ERROR,'invalid matrix size: b=',shapeb)
82+
case (-12)
83+
err = linalg_state_type(this,LINALG_VALUE_ERROR,'insufficient left vector matrix size.')
84+
case (-14)
85+
err = linalg_state_type(this,LINALG_VALUE_ERROR,'insufficient right vector matrix size.')
86+
case (-16)
87+
err = linalg_state_type(this,LINALG_INTERNAL_ERROR,'Insufficient work array size.')
88+
case (1:)
89+
err = linalg_state_type(this,LINALG_ERROR,'Eigenvalue computation did not converge.')
90+
case default
91+
err = linalg_state_type(this,LINALG_INTERNAL_ERROR,'Unknown error returned by ggev.')
92+
end select
93+
94+
end subroutine handle_ggev_info
95+
6196
!> Process SYEV/HEEV output flags
6297
elemental subroutine handle_heev_info(err,info,m,n)
6398
!> Error handler

0 commit comments

Comments
 (0)