Home

Fortranordered

Fortranordered refers to the memory layout of multi-dimensional arrays that follows the Fortran convention of storing data in column-major order. In this arrangement, elements within each column are stored contiguously in memory, and columns themselves appear one after another. This contrasts with row-major order, used by C and many other environments, where elements within each row are stored contiguously.

The term is commonly encountered in numerical computing contexts where interoperability with Fortran libraries or legacy

Choosing Fortran-ordered storage affects performance characteristics due to cache locality and the way multidimensional indices map

In practice, whether an array is Fortran-ordered is a property of its memory layout, not a separate

code
is
important.
Many
languages
and
libraries
provide
ways
to
request
Fortran-ordered
storage,
or
to
detect
it,
via
array
flags
or
layout
parameters.
For
example,
in
NumPy,
an
array
can
be
Fortran-ordered
by
creating
it
with
order='F'
or
converting
with
asfortranarray,
and
its
memory
layout
can
be
inspected
via
flags
such
as
F_CONTIGUOUS.
to
linear
memory
addresses.
When
performing
operations
that
traverse
arrays
column
by
column,
Fortran
order
can
be
advantageous,
especially
for
environments
where
column-major
storage
is
natural
(such
as
Fortran
and
many
linear
algebra
routines).
Conversely,
interacting
with
row-major
systems
might
require
transpositions
or
data
copies
to
avoid
inefficient
striding.
data
type.
It
is
one
of
several
layouts
a
numerical
program
may
use,
and
developers
often
need
to
consider
it
for
interoperability
with
libraries,
performance
optimization,
and
correct
indexing
semantics.