Arrays
Arrays are what Fortran was built around, and this is the longest part of the course. Declarations and constructors, indexing and bounds, whole-array operations and sections come first, then WHERE, FORALL and the allocatable arrays. The assumed-shape and assumed-size arguments follow, the reduction intrinsics, MATMUL, RESHAPE and the sorting of an array. The part ends on column-major order, which decides what a loop over a matrix costs.
031
Array declarations and constructors
DIMENSION, the shape, array constructors, implied DO and the lower bound
Open
032
Indexing, bounds and zero-sized arrays
the default lower bound, LBOUND and UBOUND, SIZE and SHAPE, and a bound that is not one
Open
033
Whole-array operations
an operation on two arrays is element by element, a scalar broadcasts, and the shapes must conform
Open
034
Sections, strides and triplets
a(i:j), the stride a(1:n:2), a section is not a copy, and a section as an argument
Open
035
WHERE and ELSEWHERE
a masked assignment, WHERE with ELSEWHERE, the mask evaluated once, and a masked reduction
Open
036
FORALL
FORALL as an assignment, its mask, the difference from DO CONCURRENT, and why it is rarely needed
Open
037
Allocatable arrays
ALLOCATE, DEALLOCATE, automatic deallocation at the end of scope, MOVE_ALLOC and a growing array
Open
038
Assumed-shape arguments
a(:), the lower bound inside the procedure, SIZE and the explicit interface it needs
Open
039
Explicit-shape and assumed-size arrays
a(n) as a dummy, a(*) as the old form, sequence association and the bounds a caller promises
Open
040
SUM, COUNT, ANY, ALL and the reductions
SUM, PRODUCT, MAXVAL, MINVAL, COUNT, ANY, ALL, the DIM argument and a masked reduction
Open
041
MATMUL, DOT_PRODUCT and TRANSPOSE
matrix multiplication, the inner product, TRANSPOSE, and a matrix-vector product by hand
Open
042
RESHAPE, SPREAD, PACK, UNPACK, CSHIFT
RESHAPE with its PAD and ORDER, SPREAD, PACK and UNPACK, CSHIFT and EOSHIFT
Open
043
MAXLOC, MINLOC and FINDLOC
MAXLOC and MINLOC with DIM, the BACK argument, FINDLOC with a value, and a mask
Open
044
Sorting arrays
a bubble sort by hand, MAXLOC as a selection sort, and the intrinsic route with an index array
Open
045
Column-major order and array memory
the first index moves fastest, a 2D array in memory, the loop order that matters and a timing
Open