The following Fortran code for displaying arrays can be downloaded
(in .gz format) from http://www.netlib.org/toms/892 . It works for me
with g95 and gfortran.
ACM Transactions on Mathematical Software (TOMS)
Volume 36 Issue 1, March 2009
Pretty-printing matrices in standard Fortran 95 using Dispmodule
by Kristj=E1n J=F3nasson
A standard Fortran 95 module for printing scalars, vectors and
matrices to external files is described. The module
can display variables of default kind of all intrinsic types (integer,
real, complex, logical and character), and addon
modules are provided for data of non-default kind. The main module is
self-contained and incorporating it
only requires that it be compiled and linked with a program containing
a =91use dispmodule=92 statement. A generic
interface and optional parameters are used, so that the same
subroutine name, DISP, is used to display items of
different data type and rank, irrespective of display options. The
subroutine is quite versatile, and hopefully can
improve Fortran=92s competitiveness against other array programming
languages. The module also contains a
function TOSTRING to convert numerical scalars and vectors to strings.
The module is distributed under a public
domain licence and can be freely used, even in commercial packages.
Key Words: Fortran 95, Matrix pretty-printing, Matrix printing, Output
utilities, Array programming language
"The package has been tested successfully with recent versions of the
following compilers: under
Microsoft Windows: gfortran, g95, f95 from NAG, and ifort from Intel;
under Ubuntu Linux: gfortran
and g95; under Sun Solaris: g95; under Suse Linux: ifort. It passes
tests of g95, gfortran and ifort of
conforming to the Fortran 95 standard."