Skip to content

Commit 0cc6207

Browse files
committed
changed
1 parent f040d34 commit 0cc6207

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

src/specialmatrices/stdlib_specialmatrices_tridiagonal.fypp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
1515
!----- -----
1616
!--------------------------------
1717

18-
#:for k1, t1, s1 in (KINDS_TYPES)
18+
#:for k1, t1, s1 in KINDS_TYPES
1919
pure module function initialize_tridiagonal_pure_${s1}$(dl, dv, du) result(A)
2020
!! Construct a `tridiagonal` matrix from the rank-1 arrays
2121
!! `dl`, `dv` and `du`.
@@ -147,7 +147,7 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
147147
!-----------------------------------------
148148

149149
!! spmv_tridiag
150-
#:for k1, t1, s1 in (KINDS_TYPES)
150+
#:for k1, t1, s1 in KINDS_TYPES
151151
#:for rank in RANKS
152152
module subroutine spmv_tridiag_${rank}$d_${s1}$(A, x, y, alpha, beta, op)
153153
type(tridiagonal_${s1}$_type), intent(in) :: A
@@ -226,7 +226,7 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
226226
!----- -----
227227
!-------------------------------------
228228

229-
#:for k1, t1, s1 in (KINDS_TYPES)
229+
#:for k1, t1, s1 in KINDS_TYPES
230230
pure module function tridiagonal_to_dense_${s1}$(A) result(B)
231231
!! Convert a `tridiagonal` matrix to its dense representation.
232232
type(tridiagonal_${s1}$_type), intent(in) :: A
@@ -247,19 +247,21 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
247247
if (n == 1) then
248248
B(1, 1) = A%dv(1)
249249
else
250-
B(1, 1) = A%dv(1) ; B(1, 2) = A%du(1)
250+
B(1, 1) = A%dv(1)
251+
B(1, 2) = A%du(1)
251252
do concurrent (i=2:n-1)
252253
B(i, i-1) = A%dl(i-1)
253254
B(i, i) = A%dv(i)
254255
B(i, i+1) = A%du(i)
255256
enddo
256-
B(n, n-1) = A%dl(n-1) ; B(n, n) = A%dv(n)
257+
B(n, n-1) = A%dl(n-1)
258+
B(n, n) = A%dv(n)
257259
end if
258260
end associate
259261
end function
260262
#:endfor
261263

262-
#:for k1, t1, s1 in (KINDS_TYPES)
264+
#:for k1, t1, s1 in KINDS_TYPES
263265
pure module function transpose_tridiagonal_${s1}$(A) result(B)
264266
type(tridiagonal_${s1}$_type), intent(in) :: A
265267
!! Input matrix.
@@ -268,7 +270,7 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
268270
end function
269271
#:endfor
270272

271-
#:for k1, t1, s1 in (KINDS_TYPES)
273+
#:for k1, t1, s1 in KINDS_TYPES
272274
pure module function hermitian_tridiagonal_${s1}$(A) result(B)
273275
type(tridiagonal_${s1}$_type), intent(in) :: A
274276
!! Input matrix.
@@ -281,7 +283,7 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
281283
end function
282284
#:endfor
283285

284-
#:for k1, t1, s1 in (KINDS_TYPES)
286+
#:for k1, t1, s1 in KINDS_TYPES
285287
pure module function scalar_multiplication_tridiagonal_${s1}$(alpha, A) result(B)
286288
${t1}$, intent(in) :: alpha
287289
type(tridiagonal_${s1}$_type), intent(in) :: A
@@ -299,7 +301,7 @@ submodule (stdlib_specialmatrices) tridiagonal_matrices
299301
end function
300302
#:endfor
301303

302-
#:for k1, t1, s1 in (KINDS_TYPES)
304+
#:for k1, t1, s1 in KINDS_TYPES
303305
pure module function matrix_add_tridiagonal_${s1}$(A, B) result(C)
304306
type(tridiagonal_${s1}$_type), intent(in) :: A
305307
type(tridiagonal_${s1}$_type), intent(in) :: B

test/linalg/test_linalg_specialmatrices.fypp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ contains
155155
subroutine test_tridiagonal_1x1(error)
156156
!> Test 1x1 matrix edge case for dense conversion
157157
type(error_type), allocatable, intent(out) :: error
158-
#:for k1, t1, s1 in (KINDS_TYPES)
158+
#:for k1, t1, s1 in KINDS_TYPES
159159
block
160160
integer, parameter :: wp = ${k1}$
161161
type(tridiagonal_${s1}$_type) :: A
@@ -174,7 +174,7 @@ contains
174174
A = tridiagonal(dl, dv, du)
175175
Amat = dense(A)
176176

177-
! Check if it compiled and converted properly without segfaulting
177+
! Check if the 1x1 matrix converted properly at runtime without segfaulting
178178
call check(error, size(Amat, 1) == 1, .true.)
179179
if (allocated(error)) return
180180
call check(error, size(Amat, 2) == 1, .true.)
@@ -188,7 +188,7 @@ contains
188188
subroutine test_tridiagonal_arithmetic(error)
189189
!> Test arithmetic operations and optimization
190190
type(error_type), allocatable, intent(out) :: error
191-
#:for k1, t1, s1 in (KINDS_TYPES)
191+
#:for k1, t1, s1 in KINDS_TYPES
192192
block
193193
integer, parameter :: wp = ${k1}$
194194
integer, parameter :: n = 3

0 commit comments

Comments
 (0)