Skip to content

Commit 064e7f3

Browse files
committed
Change the all_close implementation: gcc9 not support select rank.
1 parent d477d5a commit 064e7f3

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

src/stdlib_math.fypp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,14 @@ module stdlib_math
300300
!> ([Specification](../page/specs/stdlib_logic.html#all_close))
301301
interface all_close
302302
#:set RC_KINDS_TYPES = REAL_KINDS_TYPES + CMPLX_KINDS_TYPES
303+
#:set RANKS = range(1, MAXRANK + 1)
303304
#:for k1, t1 in RC_KINDS_TYPES
304-
logical module function all_close_${t1[0]}$${k1}$(a, b, rel_tol, abs_tol) result(close)
305-
${t1}$, intent(in) :: a(..), b(..)
305+
#:for r1 in RANKS
306+
logical module function all_close_${r1}$_${t1[0]}$${k1}$(a, b, rel_tol, abs_tol) result(close)
307+
${t1}$, intent(in) :: a${ranksuffix(r1)}$, b${ranksuffix(r1)}$
306308
real(${k1}$), intent(in), optional :: rel_tol, abs_tol
307-
end function all_close_${t1[0]}$${k1}$
309+
end function all_close_${r1}$_${t1[0]}$${k1}$
310+
#:endfor
308311
#:endfor
309312
end interface all_close
310313

src/stdlib_math_all_close.fypp

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,17 @@ submodule (stdlib_math) stdlib_math_all_close
88

99
contains
1010

11-
#:def inrank(r1)
12-
rank(${r1}$)
13-
select rank(b)
14-
rank(${r1}$)
15-
close = all(is_close(a, b, rel_tol, abs_tol))
16-
rank default
17-
error stop "*<ERROR>* The ranks of `a` and `b` in `all_close` are not equal."
18-
end select
19-
#:enddef
20-
2111
#:for k1, t1 in RC_KINDS_TYPES
22-
logical module function all_close_${t1[0]}$${k1}$(a, b, rel_tol, abs_tol) result(close)
12+
#:for r1 in RANKS
13+
logical module function all_close_${r1}$_${t1[0]}$${k1}$(a, b, rel_tol, abs_tol) result(close)
2314

24-
${t1}$, intent(in) :: a(..), b(..)
15+
${t1}$, intent(in) :: a${ranksuffix(r1)}$, b${ranksuffix(r1)}$
2516
real(${k1}$), intent(in), optional :: rel_tol, abs_tol
2617

27-
select rank(a)
28-
29-
#:for r1 in RANKS
30-
$:inrank(r1)
31-
#:endfor
18+
close = all(is_close(a, b, rel_tol, abs_tol))
3219

33-
rank default
34-
error stop "*<ERROR>* The rank of `a` in `all_close` is too large to be supported."
35-
end select
36-
37-
end function all_close_${t1[0]}$${k1}$
20+
end function all_close_${r1}$_${t1[0]}$${k1}$
21+
#:endfor
3822
#:endfor
3923

4024
end submodule stdlib_math_all_close

0 commit comments

Comments
 (0)