Physics 410: Fortran Programming
Please report all errors/typos. etc to choptuik@physics.ubc.ca
Last updated October 12, 2005
- 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 (Oct 11)
- Combined handouts: (PDF)
for
Lectures 2 through 6 (does NOT include Notes on Fortran arrays
from Lecture 5)
- Lecture 2 (Oct 18)
- 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 20 & Oct 25)
- Lecture 4 (Oct 25)
- Lecture 5 (Oct 27)
- Notes on Fortran 77 arrays: (PDF)
- 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 27)
- 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 programs and scripts
- t2d.f: Program
to test understanding of Fortran 77 array storage scheme.
- 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.
- Additional Material