Physics 410: Fortran Programming
Please report all errors/typos. etc to
choptuik@physics.ubc.ca
Last updated September 29, 2003
- The source code described below and in class can also be found on
the phys410 account on the lnx machines in
~phys410/f77/ex1, ~phys410/f77/ex2, ...
(organized by lecture).
- Some Online References for Fortran 77 Programming
- Lecture 1 and 2 (Sep 30 and Oct 2)
- Combined handouts (PS)
for Lectures 2 through 6 (does NOT include Notes
on Fortran 77 arrays from Lecture 5).
- Lecture 2 (Oct 2 & 7)
-
fdemo1.f: Program demonstrating some essential
Fortran 77 language elements
-
fdemo1-output: Output from fdemo1
- Makefile:
Note: Beware of cutting-and-pasting text to and from
Makefiles. All lines which specify an action (shell command)
for updating a target must begin with a TAB character.
- Lecture 3 (Oct 9)
- Lecture 4 (Oct 14 & 16)
- Lecture 5 (Oct 16)
- Notes on Fortran 77 arrays:
(PS)
-
arraydemo.f: Demonstrates a general technique
for writing Fortran 77 programs which define and manipulate
multi-dimensional arrays whose bounds are determined at
run time.
Program output.
- Makefile for
above executable.
-
arraydemo90.f: Fortran 90 implementation
of above example, illustrating f90's dynamical
memory allocation facilities. Makefile
for this example.
- Lecture 6 (Oct 16 & 21)
- A brief synopsis of the
IEEE floating point standard from
the PSC. Another
PAGE with
links to much more additional information, including
What Every Computer Scientist Should Know About Floating-Point
Arithmetic, by David Goldberg (PS).
- meps.f:
Computes approximate real*8 machine epsilon.
Sun (IEEE) output.
PC Linux output.
- catprec.f:
Illustrates catastrophic precision loss due to subtraction
of nearly-equal floating point values.
Program output.
- dmroutines.f:
Two dimensional array (matrix) routines:
- dmmmult: Matrix-matrix multiply (square matrices only)
- dmfrom: Read matrix from file or stdin
- dmto: Write matrix to file or stdout
- tdm.f: Test
driver for dmroutines.f.
Program output.
- Makefile for
above executables.
- Miscellaneous
- t2d.f: Program to test
understanding of Fortran 77 array storage scheme.
t2d-soln.f and
output on lnx1
- Sample output
from nth, a filter (shell-script) which
selects specified columns (separated by white space)
from standard output and writes them to standard
output.