Skip to content

Commit 897ac34

Browse files
fix: do-concurrent syntax (fortran-lang#998)
2 parents 78c6c60 + 30ccd9d commit 897ac34

File tree

8 files changed

+46
-33
lines changed

8 files changed

+46
-33
lines changed

doc/specs/stdlib_ansi.md

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,7 @@ Experimental
2828
#### Example
2929

3030
```fortran
31-
program demo_color
32-
use stdlib_ansi, only : fg_color_blue, style_bold, style_reset, ansi_code, &
33-
& operator(//), operator(+)
34-
implicit none
35-
type(ansi_code) :: highlight, reset
36-
37-
print '(a)', highlight // "Dull text message" // reset
38-
39-
highlight = fg_color_blue + style_bold
40-
reset = style_reset
41-
42-
print '(a)', highlight // "Colorful text message" // reset
43-
end program demo_color
31+
{!example/ansi/example_ansi_color.f90!}
4432
```
4533

4634

@@ -216,12 +204,7 @@ Experimental
216204
#### Example
217205

218206
```fortran
219-
program demo_string
220-
use stdlib_ansi, only : fg_color_green, style_reset, to_string
221-
implicit none
222-
223-
print '(a)', to_string(fg_color_green) // "Colorized text message" // to_string(style_reset)
224-
end program demo_string
207+
{!example/ansi/example_ansi_to_string.f90!}
225208
```
226209

227210

@@ -255,13 +238,7 @@ Experimental
255238
#### Example
256239

257240
```fortran
258-
program demo_combine
259-
use stdlib_ansi, only : fg_color_red, style_bold, ansi_code
260-
implicit none
261-
type(ansi_code) :: bold_red
262-
263-
bold_red = fg_color_red + style_bold
264-
end program demo_combine
241+
{!example/ansi/example_ansi_combine.f90!}
265242
```
266243

267244

@@ -295,10 +272,5 @@ Experimental
295272
#### Example
296273

297274
```fortran
298-
program demo_concat
299-
use stdlib_ansi, only : fg_color_red, style_reset, operator(//)
300-
implicit none
301-
302-
print '(a)', fg_color_red // "Colorized text message" // style_reset
303-
end program demo_concat
275+
{!example/ansi/example_ansi_concat.f90!}
304276
```

example/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ macro(ADD_EXAMPLE name)
66
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
77
endmacro(ADD_EXAMPLE)
88

9+
add_subdirectory(ansi)
910
add_subdirectory(array)
1011
add_subdirectory(ascii)
1112
add_subdirectory(bitsets)

example/ansi/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ADD_EXAMPLE(ansi_color)
2+
ADD_EXAMPLE(ansi_combine)
3+
ADD_EXAMPLE(ansi_concat)
4+
ADD_EXAMPLE(ansi_to_string)

example/ansi/example_ansi_color.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
program example_ansi_color
2+
use stdlib_ansi, only : fg_color_blue, style_bold, style_reset, ansi_code, &
3+
& operator(//), operator(+)
4+
implicit none
5+
type(ansi_code) :: highlight, reset
6+
7+
print '(a)', highlight // "Dull text message" // reset
8+
9+
highlight = fg_color_blue + style_bold
10+
reset = style_reset
11+
12+
print '(a)', highlight // "Colorful text message" // reset
13+
end program example_ansi_color

example/ansi/example_ansi_combine.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
program example_ansi_combine
2+
use stdlib_ansi, only : fg_color_red, style_bold, ansi_code, operator(+), to_string
3+
implicit none
4+
type(ansi_code) :: bold_red
5+
6+
bold_red = fg_color_red + style_bold
7+
print '(a)', to_string(bold_red)
8+
9+
end program example_ansi_combine

example/ansi/example_ansi_concat.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
program example_ansi_concat
2+
use stdlib_ansi, only : fg_color_red, style_reset, operator(//)
3+
implicit none
4+
5+
print '(a)', fg_color_red // "Colorized text message" // style_reset
6+
end program example_ansi_concat
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
program example_ansi_to_string
2+
use stdlib_ansi, only : fg_color_green, style_reset, to_string
3+
implicit none
4+
5+
print '(a)', to_string(fg_color_green) // "Colorized text message" // to_string(style_reset)
6+
end program example_ansi_to_string

src/stdlib_linalg_pinv.fypp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ submodule(stdlib_linalg) stdlib_linalg_pseudoinverse
7474
! Get pseudo-inverse: A_pinv = V * (diag(1/s) * U^H) = V * (U * diag(1/s))^H
7575

7676
! 1) compute (U * diag(1/s)) in-place
77-
do concurrent (i=1:m,j=1:k); u(i,j) = s(j)*u(i,j); end do
77+
do concurrent (i=1:m,j=1:k)
78+
u(i,j) = s(j)*u(i,j)
79+
end do
7880

7981
! 2) commutate matmul: A_pinv = V * (U * diag(1/s))^H = ((U * diag(1/s)) * V^H)^H.
8082
! This avoids one matrix transpose

0 commit comments

Comments
 (0)