Array operations (Fortran)
Applies to: fortran
Fortran arrays support whole-array and section operations: you can add, scale, or apply intrinsics to an
entire array (or a slice a(2:5)) without a loop, and the compiler vectorizes it. Note Fortran arrays are
one-based and column-major.
b = a * 2.0 ! whole-array: every element doubled
c = a(2:5) + d(2:5) ! section arithmetic
s = sum(a) ! intrinsic over the whole array