@@ -103,10 +103,12 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
103103 call linalg_error_handling(err0, err)
104104 endif
105105
106- ! Description of the matrix.
107- A%n = n
108- ! Matrix elements.
109- A%dl = dl ; A%dv = dv ; A%du = du
106+ if(err0%ok()) then
107+ ! Description of the matrix.
108+ A%n = n
109+ ! Matrix elements.
110+ A%dl = dl ; A%dv = dv ; A%du = du
111+ endif
110112 end function
111113
112114 module function initialize_constant_tridiagonal_impure_${s1}$(dl, dv, du, n, err) result(A)
@@ -124,16 +126,19 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
124126 integer(ilp) :: i
125127 type(linalg_state_type) :: err0
126128
127- ! Description of the matrix.
128- A%n = n
129129 if (n <= 0) then
130130 err0 = linalg_state_type(this, LINALG_VALUE_ERROR, "Matrix size needs to be positive, n = ", n, ".")
131131 call linalg_error_handling(err0, err)
132132 endif
133- ! Matrix elements.
134- A%dl = [(dl, i = 1, n-1)]
135- A%dv = [(dv, i = 1, n)]
136- A%du = [(du, i = 1, n-1)]
133+
134+ if(err0%ok()) then
135+ ! Description of the matrix.
136+ A%n = n
137+ ! Matrix elements.
138+ A%dl = [(dl, i = 1, n-1)]
139+ A%dv = [(dv, i = 1, n)]
140+ A%du = [(du, i = 1, n-1)]
141+ endif
137142 end function
138143 #:endfor
139144
@@ -168,7 +173,7 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
168173 op_ = "N" ; if (present(op)) op_ = op
169174
170175 ! Prepare Lapack arguments.
171- n = A%n ; ldx = n ; ldy = n ; y = 0.0_${k1}$
176+ n = A%n ; ldx = n ; ldy = n ;
172177 nrhs = #{if rank==1}# 1 #{else}# size(x, dim=2, kind=ilp) #{endif}#
173178
174179 #:if rank == 1
0 commit comments