Skip to content

Commit 0be7f11

Browse files
committed
add bibliography.md
This copies the mediawiki source code block of the Wikipedia article's bibliography. It will be edited after the other sections are revised. Signed-off-by: Norwid Behrnd <[email protected]>
1 parent 6634c7c commit 0be7f11

12 files changed

+359
-645
lines changed

data/learning.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ books:
300300
- /learn/f95_features/pointers
301301
- /learn/f95_features/intrinsic_procedures
302302
- /learn/f95_features/data_transfer
303+
- /learn/f95_features/operations_on_external_files
304+
- /learn/f95_features/bibliography
303305

304306
# Web links listed at the bottom of the 'Learn' landing page
305307
#

source/learn/f95_features/array_handling.md

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ call sub(a)
5252
the corresponding dummy argument specification defines only the type and
5353
rank of the array, not its shape. This information has to be made
5454
available by an explicit interface, often using an interface block (see
55-
[Interface blocks](interface_blocks).
55+
[Interface blocks](interface_blocks)).
5656
Thus we write just
5757

5858
```f90
5959
subroutine sub(da)
6060
real, dimension(:, :) :: da
6161
```
6262

63-
and this is as if `da` were dimensioned `(11,21)`. However, we can specify
64-
any lower bound and the array maps accordingly.
63+
and this is as if `da` were dimensioned `(11,21)`. However, we can
64+
specify any lower bound and the array maps accordingly.
6565

6666
```f90
6767
real, dimension(0:, 0:) :: da
@@ -102,7 +102,7 @@ end module
102102
program main
103103
use work_array
104104
read (input, *) n
105-
allocate (work(n, 2 * n, 3 * n), STAT=status)
105+
allocate (work(n, 2 * n, 3 * n), stat=status)
106106
:
107107
deallocate (work)
108108
```
@@ -159,7 +159,7 @@ parallel processors. An elemental procedure must be pure.
159159

160160
```f90
161161
elemental subroutine swap(a, b)
162-
real, intent(INOUT) :: a, b
162+
real, intent(inout) :: a, b
163163
real :: work
164164
work = a
165165
a = b
@@ -313,9 +313,7 @@ always has a subscript or subscripts qualifying at least the last name.
313313
## Array subobjects (sections)
314314

315315
The general form of subscript for an array section is
316-
317-
` [`*`lower`*`] : [`*`upper`*`] [:`*`stride`*`]`
318-
316+
`[lower]:[upper][:stride]`
319317
(where `[...]` indicates an optional item) as in
320318

321319
```f90
@@ -366,52 +364,59 @@ tar(1, 1)%u ! component of an array element
366364

367365
### Vector and matrix multiply
368366

369-
| `dot_product` | Dot product of 2 rank-one arrays |
370-
|---------------|----------------------------------|
371-
| `matmul` | Matrix multiplication |
367+
```{csv-table}
368+
`dot_product`, "Dot product of 2 rank-one arrays"
369+
`matmul`, "Matrix multiplication"
370+
```
372371

373372
### Array reduction
374373

375-
| `all` | True if all values are true |
376-
|-----------|-------------------------------------------------------------|
377-
| `any` | True if any value is true. Example: `if (any( a > b)) then` |
378-
| `count` | Number of true elements in array |
379-
| `maxval` | Maximum value in an array |
380-
| `minval` | Minimum value in an array |
381-
| `product` | Product of array elements |
382-
| `sum` | Sum of array elements |
374+
```{csv-table}
375+
`all`, "True if all values are true"
376+
`any`, "True if any value is true. Example: `if (any( a > b)) then`"
377+
`count`, "Number of true elements in array"
378+
`maxval`, "Maximum value in an array"
379+
`minval`, "Minimum value in an array"
380+
`product`, "Product of array elements"
381+
`sum`, "Sum of array elements"
382+
```
383383

384384
### Array inquiry
385385

386-
| `allocated` | Array allocation status |
387-
|-------------|--------------------------------------|
388-
| `lbound` | Lower dimension bounds of an array |
389-
| `shape` | Shape of an array (or scalar) |
390-
| `size` | Total number of elements in an array |
391-
| `ubound` | Upper dimension bounds of an array |
386+
```{csv-table}
387+
`allocated`, "Array allocation status"
388+
`lbound`, "Lower dimension bounds of an array"
389+
`shape`, "Shape of an array (or scalar)"
390+
`size`, "Total number of elements in an array"
391+
`ubound`, "Upper dimension bounds of an array"
392+
```
392393

393394
### Array construction
394395

395-
| `merge` | Merge under mask |
396-
|----------|------------------------------------------------------|
397-
| `pack` | Pack an array into an array of rank one under a mask |
398-
| `spread` | Replicate array by adding a dimension |
399-
| `unpack` | Unpack an array of rank one into an array under mask |
396+
```{csv-table}
397+
`merge`, "Merge under mask"
398+
`pack`, "Pack an array into an array of rank one under a mask"
399+
`spread`, "Replicate array by adding a dimension"
400+
`unpack`, "Unpack an array of rank one into an array under mask"
401+
```
400402

401403
### Array reshape
402404

403-
| `reshape` | Reshape an array |
404-
|-----------|------------------|
405+
```{csv-table}
406+
`reshape`, "Reshape an array"
407+
```
405408

406409
### Array manipulation
407410

408-
| `cshift` | Circular shift |
409-
|-------------|-----------------------------------|
410-
| `eoshift` | End-off shift |
411-
| `transpose` | Transpose of an array of rank two |
411+
```{csv-table}
412+
`cshift`, "Circular shift"
413+
`eoshift`, "End-off shift"
414+
`transpose`, "Transpose of an array of rank two"
415+
```
412416

413417
### Array location
414418

415-
| `maxloc` | Location of first maximum value in an array |
416-
|----------|---------------------------------------------|
417-
| `minloc` | Location of first minimum value in an array |
419+
```{csv-table}
420+
`maxloc`, "Location of first maximum value in an array"
421+
`minloc`, "Location of first minimum value in an array"
422+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Bibliography
2+
3+
* Metcalf, Michael; Reid, John; Cohen, Malcolm (2004-06-17),
4+
*Fortran 95/2003 Explained*, Oxford University PressOxford,
5+
<doi:10.1093/oso/9780198526926.003.0001>, ISBN 978-0-19-852692-6.
6+
* [Introduction to Modern Fortran](https://doi.org/10.1007/0-387-28123-1_2),
7+
Statistics and Computing, New York: Springer-Verlag, 2005,
8+
<doi:10.1007/0-387-28123-1_2>, ISBN 0-387-23817-4
9+
* Gehrke, Wilhelm (1996).
10+
[Fortran 95 Language Guide](https://doi.org/10.1007/978-1-4471-1025-5).
11+
<doi:10.1007/978-1-4471-1025-5>. ISBN 978-3-540-76062-7
12+
* Chivers, Ian; Sleightholme, Jane (2000),
13+
[Fortran 2000 and Various Fortran Dialects](https://doi.org/10.1007/978-1-4471-0403-2_29),
14+
in *Introducing Fortran 95*, London: Springer London, pp. 377–388,
15+
<doi:10.1007/978-1-4471-0403-2_29>, ISBN 978-1-85233-276-1
16+
* Counihan, Martin (2006). *Fortran 95* (2nd ed.). CRC Press. ISBN 9780203978467
17+
* Ramaraman, V. (1997). *Computer programming in FORTRAN 90 and 95*.
18+
PHI Learning Pvt. Ltd. ISBN 9788120311817.
19+
* Joshi, Yogendra Prasad. *An Introduction to Fortran 90/95: Syntax and
20+
Programming.* Allied Publishers. ISBN 9788177644746.

source/learn/f95_features/data_transfer.md

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
## Formatted input/output
44

55
These examples illustrate various forms of I/O lists with some simple
6-
formats (see
7-
<a href="#Edit_descriptors" class="wikilink" title="below">below</a>):
6+
formats (see [below](edit_descriptors)):
87

98
```f90
109
integer :: i
@@ -60,8 +59,7 @@ print form, q
6059
```
6160

6261
or as an asterisk this is a type of I/O known as *list-directed* I/O
63-
(see
64-
<a href="#List-directed_I/O" class="wikilink" title="below">below</a>),
62+
(see [below](list-directed-i/o),
6563
in which the format is defined by the computer system:
6664

6765
```f90
@@ -75,27 +73,26 @@ do not reference any unit number: this is referred to as terminal I/O.
7573
Otherwise the form is:
7674

7775
```f90
78-
read (UNIT=4, FMT="(f10.3)") q
79-
read (UNIT=newunit, FMT="(f10.3)") q
80-
read (UNIT=4 * i + j, FMT="(f10.3)") a
76+
read (unit=4, fmt="(f10.3)") q
77+
read (unit=newunit, fmt="(f10.3)") q
78+
read (unit=4 * i + j, fmt="(f10.3)") a
8179
```
8280

8381
where `unit=` is optional. The value may be any nonnegative integer
84-
allowed by the system for this purpose (but `0`, `5` and `6` often denote the
85-
error, keyboard and terminal, respectively).
82+
allowed by the system for this purpose (but `0`, `5` and `6` often
83+
denote the error, keyboard and terminal, respectively).
8684

8785
An asterisk is a variantagain from the keyboard:
8886

8987
```f90
90-
read (UNIT=*, FMT="(f10.3)") q
88+
read (unit=*, fmt="(f10.3)") q
9189
```
9290

9391
A read with a unit specifier allows
94-
<a href="exception_handling" class="wikilink"
95-
title="exception handling">exception handling</a>:
92+
[exception handling](https://en.wikipedia.org/wiki/Exception_handling):
9693

9794
```f90
98-
read (UNIT=NUNIT, FMT="(3f10.3)", IOSTAT=ios) a, b, c
95+
read (unit=nunit, fmt="(3f10.3)", iostat=ios) a, b, c
9996
if (ios == 0) then
10097
! Successful read - continue execution.
10198
:
@@ -105,11 +102,11 @@ else
105102
end if
106103
```
107104

108-
There a second type of formatted output statement, the `write`
105+
There is a second type of formatted output statement, the `write`
109106
statement:
110107

111108
```f90
112-
write (UNIT=nout, FMT="(10f10.3)", IOSTAT=ios) a
109+
write (unit=nout, fmt="(10f10.3)", iostat=ios) a
113110
```
114111

115112
## Internal files
@@ -121,11 +118,12 @@ itself.
121118
```f90
122119
integer, dimension(30) :: ival
123120
integer :: key
124-
character(LEN=30) :: buffer
125-
character(LEN=6), dimension(3), parameter :: form = (/"(30i1)", "(15i2)", "(10i3)"/)
121+
character(len=30) :: buffer
122+
character(len=6), dimension(3), parameter :: form = (/"(30i1)", &
123+
"(15i2)", "(10i3)"/)
126124
127-
read (UNIT=*, FMT="(a30,i1)") buffer, key
128-
read (UNIT=buffer, FMT=form(key)) ival(1:30 / key)
125+
read (unit=*, fmt="(a30,i1)") buffer, key
126+
read (unit=buffer, fmt=form(key)) ival(1:30 / key)
129127
```
130128

131129
If an internal file is a scalar, it has a single record whose length is
@@ -140,11 +138,11 @@ An example using a `write` statement is
140138
```f90
141139
integer :: day
142140
real :: cash
143-
character(LEN=50) :: line
141+
character(len=50) :: line
144142
:
145143
! write into line
146-
write (UNIT=line, FMT="(a, i2, a, f8.2, a)") "Takings for day ", day, &
147-
& " are ", cash, " dollars"
144+
write (unit=line, fmt="(a, i2, a, f8.2, a)") "Takings for day ", day, &
145+
" are ", cash, " dollars"
148146
```
149147

150148
that might write
@@ -162,8 +160,8 @@ integer :: i
162160
real :: a
163161
complex, dimension(2) :: field
164162
logical :: flag
165-
character(LEN=12) :: title
166-
character(LEN=4) :: word
163+
character(len=12) :: title
164+
character(len=4) :: word
167165
:
168166
read *,i, a, field, flag, title, word
169167
```
@@ -191,10 +189,10 @@ non-advancing I/O statement performs no such repositioning and may
191189
therefore leave the file positioned within a record.
192190

193191
```f90
194-
character(LEN=3) :: key
192+
character(len=3) :: key
195193
integer :: u, s, ios
196194
:
197-
read (UNIT=u, FMT="(a3)", ADVANCE="no", SIZE=s, IOSTAT=ios) key
195+
read (unit=u, fmt="(a3)", advance="no", size=s, iostat=ios) key
198196
if (ios == 0) then
199197
:
200198
else
@@ -212,8 +210,8 @@ next character position on the screen without an intervening line-feed,
212210
we can write
213211

214212
```f90
215-
write (UNIT=*, FMT="(a)", ADVANCE="no") "enter next prime number:"
216-
read (UNIT=*, FMT="(i10)") prime_number
213+
write (unit=*, fmt="(a)", advance="no") "enter next prime number:"
214+
read (unit=*, fmt="(i10)") prime_number
217215
```
218216

219217
Non-advancing I/O is for external files, and is not available for
@@ -225,8 +223,8 @@ It is possible to specify that an edit descriptor be repeated a
225223
specified number of times, using a *repeat count*: `10f12.3`
226224

227225
The slash edit descriptor (see
228-
<a href="#Control_edit_descriptors" class="wikilink"
229-
title="below">below</a>) may have a repeat count, and a repeat count can
226+
[below](control-edit-descriptors))
227+
may have a repeat count, and a repeat count can
230228
also apply to a group of edit descriptors, enclosed in parentheses, with
231229
nesting:
232230

@@ -258,9 +256,9 @@ computer or another computer using the same internal number
258256
representations:
259257

260258
```f90
261-
open (UNIT=4, FILE='test', FORM='unformatted')
262-
read (UNIT=4) q
263-
write (UNIT=nout, IOSTAT=ios) a ! no fmt=
259+
open (unit=4, file='test', form='unformatted')
260+
read (unit=4) q
261+
write (unit=nout, iostat=ios) a ! no fmt=
264262
```
265263

266264
## Direct-access files
@@ -276,21 +274,22 @@ real, dimension(length) :: a
276274
real, dimension(length + 1:2*length) :: b
277275
integer :: i, rec_length
278276
:
279-
inquire (IOLENGTH=rec_length) a
280-
open (UNIT=nunit, ACCESS="direct", RECL=rec_length, STATUS="scratch", ACTION="readwrite")
277+
inquire (iolength=rec_length) a
278+
open (unit=nunit, access="direct", recl=rec_length, status="scratch", &
279+
action="readwrite")
281280
:
282281
! Write array b to direct-access file in record 14
283-
write (UNIT=nunit, REC=14) b
282+
write (unit=nunit, rec=14) b
284283
:
285284
! Read the array back into array a
286-
read (UNIT=nunit, REC=14) a
285+
read (unit=nunit, rec=14) a
287286
288287
do i = 1, length / 2
289288
a(i) = i
290289
end do
291290
292291
! Replace modified record
293-
write (UNIT=nunit, REC=14) a
292+
write (unit=nunit, rec=14) a
294293
```
295294

296295
The file must be an external file and list-directed formatting and

0 commit comments

Comments
 (0)