UW AMath High Performance Scientific Computing
 
AMath 483/583 Class Notes
 
Spring Quarter, 2011

Table Of Contents

Previous topic

Fortran debugging

Next topic

Linear Algebra software

This Page

Fortran Software Packages

Fortran has many basic mathematical functions as built-in (intrinsic) functions, standard math functions like sqrt, sin, exp, etc. (see Intrinsic functions) and also matrix operations such as transpose and matmul (see Array storage in Fortran).

To solve more complex mathematical problems it is generally necessary to either use some software package or write your own code from scratch. In general it is best to use high-quality software as much as possible, for several reasons:

  • It will take less time to figure out how to use the software than to write your own version. (Assuming it’s well documented!)
  • Good general software has been extensively tested on a wide variety of problems.
  • Often general software is much more sophisticated that what you might write yourself, for example it may provide error estimates automatically, or it may be optimized to run fast.

You will probably need to write a main program to call the software, and often auxiliary functions to describe your problem.

Some software consists of a single subroutine or function that you can easily download and compile with the rest of your code. Other software is in the form of a large package that must be installed in some manner before use.

Often large collections of subroutines are organized into libraries that can be compiled once and stored in a manner that makes it easier to use by simply linking your .o files to the library, which automatically pulls out the object code for the particular library routines you use in the program. This frees the user from having to figure out what set of .o or .f files are required from the software package for each application of the software. For examples of this, see the sections on Linear Algebra software.

zeroin software

As a very simple example of a single-function piece of software, see the directory $CLASSHG/codes/fortran/zeroin This contains code to compute the n‘th root of a by finding a zero of the function f(x) = x^n - a as in Homework 3. But instead implementing Newton’s method as described in Special functions, the function zeroin is used, which was obtained from Netlib, a repository of mathematical software. The version of zeroin used is a slight modification of the Netlib version http://www.netlib.org/go/zeroin.f, modified to remove the dependence on d1mach.