Skip to content

Commit bdae9ae

Browse files
committed
Style changes
1 parent a14af3b commit bdae9ae

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

src/stdlib_linalg.fypp

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module stdlib_linalg
55
!! ([Specification](../page/specs/stdlib_linalg.html))
66
use stdlib_kinds, only: sp, dp, qp, &
77
int8, int16, int32, int64
8+
use stdlib_error, only: error_stop
89
implicit none
910
private
1011

@@ -92,7 +93,7 @@ module stdlib_linalg
9293
interface is_square
9394
!! version: experimental
9495
!!
95-
!! Checks if a matrix (rank-2 array) is square.
96+
!! Checks if a matrix (rank-2 array) is square
9697
!! ([Specification](../page/specs/stdlib_linalg.html#description_4))
9798
#:for k1, t1 in RCI_KINDS_TYPES
9899
module procedure is_square_${t1[0]}$${k1}$
@@ -104,7 +105,7 @@ module stdlib_linalg
104105
interface is_diagonal
105106
!! version: experimental
106107
!!
107-
!! Checks if a matrix (rank-2 array) is diagonal.
108+
!! Checks if a matrix (rank-2 array) is diagonal
108109
!! ([Specification](../page/specs/stdlib_linalg.html#description_5))
109110
#:for k1, t1 in RCI_KINDS_TYPES
110111
module procedure is_diagonal_${t1[0]}$${k1}$
@@ -116,7 +117,7 @@ module stdlib_linalg
116117
interface is_symmetric
117118
!! version: experimental
118119
!!
119-
!! Checks if a matrix (rank-2 array) is symmetric.
120+
!! Checks if a matrix (rank-2 array) is symmetric
120121
!! ([Specification](../page/specs/stdlib_linalg.html#description_6))
121122
#:for k1, t1 in RCI_KINDS_TYPES
122123
module procedure is_symmetric_${t1[0]}$${k1}$
@@ -128,7 +129,7 @@ module stdlib_linalg
128129
interface is_skew_symmetric
129130
!! version: experimental
130131
!!
131-
!! Checks if a matrix (rank-2 array) is skew-symmetric.
132+
!! Checks if a matrix (rank-2 array) is skew-symmetric
132133
!! ([Specification](../page/specs/stdlib_linalg.html#description_7))
133134
#:for k1, t1 in RCI_KINDS_TYPES
134135
module procedure is_skew_symmetric_${t1[0]}$${k1}$
@@ -140,7 +141,7 @@ module stdlib_linalg
140141
interface is_hermitian
141142
!! version: experimental
142143
!!
143-
!! Checks if a matrix (rank-2 array) is Hermitian.
144+
!! Checks if a matrix (rank-2 array) is Hermitian
144145
!! ([Specification](../page/specs/stdlib_linalg.html#description_8))
145146
#:for k1, t1 in CMPLX_KINDS_TYPES
146147
module procedure is_hermitian_${t1[0]}$${k1}$
@@ -152,7 +153,7 @@ module stdlib_linalg
152153
interface is_triangular
153154
!! version: experimental
154155
!!
155-
!! Checks if a matrix (rank-2 array) is triangular.
156+
!! Checks if a matrix (rank-2 array) is triangular
156157
!! ([Specification](../page/specs/stdlib_linalg.html#description_9))
157158
#:for k1, t1 in RCI_KINDS_TYPES
158159
module procedure is_triangular_${t1[0]}$${k1}$
@@ -223,15 +224,15 @@ contains
223224
A_shape = shape(A)
224225
m = A_shape(1)
225226
n = A_shape(2)
226-
do j=1,n !loop over all columns
227+
do j = 1, n !loop over all columns
227228
o = min(j-1,m) !index of row above diagonal (or last row)
228-
do i=1,o !loop over rows above diagonal
229+
do i = 1, o !loop over rows above diagonal
229230
if (.not. (A(i,j) .eq. zero)) then
230231
res = .false.
231232
return
232233
end if
233234
end do
234-
do i=o+2,m !loop over rows below diagonal
235+
do i = o+2, m !loop over rows below diagonal
235236
if (.not. (A(i,j) .eq. zero)) then
236237
res = .false.
237238
return
@@ -254,8 +255,8 @@ contains
254255
end if
255256
A_shape = shape(A)
256257
n = A_shape(1) !symmetric dimension of A
257-
do j=1,n !loop over all columns
258-
do i=1,j-1 !loop over all rows above diagonal
258+
do j = 1, n !loop over all columns
259+
do i = 1, j-1 !loop over all rows above diagonal
259260
if (.not. (A(i,j) .eq. A(j,i))) then
260261
res = .false.
261262
return
@@ -278,8 +279,8 @@ contains
278279
end if
279280
A_shape = shape(A)
280281
n = A_shape(1) !symmetric dimension of A
281-
do j=1,n !loop over all columns
282-
do i=1,j !loop over all rows above diagonal (and diagonal)
282+
do j = 1, n !loop over all columns
283+
do i = 1, j !loop over all rows above diagonal (and diagonal)
283284
if (.not. (A(i,j) .eq. -A(j,i))) then
284285
res = .false.
285286
return
@@ -302,8 +303,8 @@ contains
302303
end if
303304
A_shape = shape(A)
304305
n = A_shape(1) !symmetric dimension of A
305-
do j=1,n !loop over all columns
306-
do i=1,j !loop over all rows above diagonal (and diagonal)
306+
do j = 1, n !loop over all columns
307+
do i = 1, j !loop over all rows above diagonal (and diagonal)
307308
if (.not. (A(i,j) .eq. conjg(A(j,i)))) then
308309
res = .false.
309310
return
@@ -316,7 +317,7 @@ contains
316317

317318

318319
#:for k1, t1 in RCI_KINDS_TYPES
319-
pure function is_triangular_${t1[0]}$${k1}$(A,uplo) result(res)
320+
function is_triangular_${t1[0]}$${k1}$(A,uplo) result(res)
320321
${t1}$, intent(in) :: A(:,:)
321322
character, intent(in) :: uplo
322323
logical :: res
@@ -327,9 +328,9 @@ contains
327328
m = A_shape(1)
328329
n = A_shape(2)
329330
if ((uplo .eq. 'u') .or. (uplo .eq. 'U')) then !check for upper triangularity
330-
do j=1,n !loop over all columns
331+
do j = 1, n !loop over all columns
331332
o = min(j-1,m) !index of row above diagonal (or last row)
332-
do i=o+2,m !loop over rows below diagonal
333+
do i = o+2, m !loop over rows below diagonal
333334
if (.not. (A(i,j) .eq. zero)) then
334335
res = .false.
335336
return
@@ -347,7 +348,7 @@ contains
347348
end do
348349
end do
349350
else
350-
!return error on uplo parameter needing to be in {u,U,l,L}
351+
call error_stop("ERROR (is_triangular): second argument must be one of {'u','U','l','L'}")
351352
end if
352353

353354
res = .true. !otherwise A is triangular of the requested type
@@ -356,7 +357,7 @@ contains
356357

357358

358359
#:for k1, t1 in RCI_KINDS_TYPES
359-
pure function is_hessenberg_${t1[0]}$${k1}$(A,uplo) result(res)
360+
function is_hessenberg_${t1[0]}$${k1}$(A,uplo) result(res)
360361
${t1}$, intent(in) :: A(:,:)
361362
character, intent(in) :: uplo
362363
logical :: res
@@ -367,27 +368,27 @@ contains
367368
m = A_shape(1)
368369
n = A_shape(2)
369370
if ((uplo .eq. 'u') .or. (uplo .eq. 'U')) then !check for upper Hessenberg
370-
do j=1,n !loop over all columns
371+
do j = 1, n !loop over all columns
371372
o = min(j-2,m) !index of row two above diagonal (or last row)
372-
do i=o+4,m !loop over rows two or more below main diagonal
373+
do i = o+4, m !loop over rows two or more below main diagonal
373374
if (.not. (A(i,j) .eq. zero)) then
374375
res = .false.
375376
return
376377
end if
377378
end do
378379
end do
379380
else if ((uplo .eq. 'l') .or. (uplo .eq. 'L')) then !check for lower Hessenberg
380-
do j=1,n !loop over all columns
381+
do j = 1, n !loop over all columns
381382
o = min(j-2,m) !index of row two above diagonal (or last row)
382-
do i=1,o !loop over rows one or more above main diagonal
383+
do i = 1, o !loop over rows one or more above main diagonal
383384
if (.not. (A(i,j) .eq. zero)) then
384385
res = .false.
385386
return
386387
end if
387388
end do
388389
end do
389390
else
390-
!return error on uplo parameter needing to be in {u,U,l,L}
391+
call error_stop("ERROR (is_hessenberg): second argument must be one of {'u','U','l','L'}")
391392
end if
392393
res = .true. !otherwise A is Hessenberg of the requested type
393394
end function is_hessenberg_${t1[0]}$${k1}$

0 commit comments

Comments
 (0)