Classical FORTRAN: Programming for Engineering and Scientific Applications

Introduction Why Study Programming? The Evolution of FORTRAN Why Study FORTRAN? Classical FORTRAN About This Book Advice to Instructors About the Author Acknowledgments Disclaimers Hello, World! Case Study: A First FORTRAN Program Compiling the Program Running a Program in UNIX Omissions Expressions and Assignment Statements Constants Variables and Variable Names Arithmetic Operators Function References Expressions Assignment Statements READ and PRINT Omissions Conditionals and Branching Flowcharting The GO TO Statement The IF-THEN Construct The Logical IF Statement Flowcharting Reconsidered Additional Examples Omissions Scalar Data Types Integers Reals Roundoff Errors Type Conversions Case Study: Computing the Sine Other Data Types Some Special Values Architectural Variations Omissions Arrays and DO Loops Vectors The DO Loop Matrices The Rules of DO Loops Array Dimensioning Case Study: Matrix Multiplication Omissions Subprograms SUBROUTINE Subprograms Call by Reference FUNCTION Subprograms Case Study: Bisection Detecting First Entry FORTRAN, System, and Library Routines Conclusion and Omissions Adjustable Dimensions and EXTERNAL Adjustable Dimensions EXTERNAL Summary and Omissions COMMON Passing Data Through Passing Data Around Alignment Formal Parameters and COMMON Arrays in COMMON BLOCK DATA Omissions Input and Output READ and WRITE Case Study: Descriptive Statistics Implied DO Loops Unit Assignments Descriptive Statistics Revisited Positioning in Files Case Study: Merging Files Unformatted I/O Cautions and Omissions Character Variables How Characters Are Stored Writing Out and Reading In Character Variables Editing Character Strings Object-Time FORMATs Case Study: QUERY CHARACTER Variables in Other Contexts Character Graphics Omissions Memory Management Techniques Passing Array Columns Partitioning Workspace Sharing Workspace Sharing Constant Data Storing a Symmetric Matrix Sparse Matrix Techniques Linked Lists Omissions and Caveats Design, Documentation, and Coding Style The Craft of Programming Design Documentation Coding Style Hand-Checking Testing, Revision, and Maintenance Conclusion and Omissions Archaic, Unusual, and Dangerous Usages Source Form Expressions and Assignment Statements Conditionals and Transfer of Control Scalar Data Types Arrays and DO Loops Subprograms Adjustable Dimensions and EXTERNAL COMMON Input and Output Character Variables Case Study: A Legacy Code Conclusion and Omissions UNIX Issues Using the Compiler Operating System Services Debugging and dbx Automatic Compilation with make Libraries Writing Custom Manual Pages Omissions Measuring and Maximizing Serial Execution Speed Measuring Serial Execution Speed Tuning FORTRAN Source Code Omissions Vector and Parallel Processing Vector Processing Parallel Processing Omissions Modern Fortran and HPF Fortran-90 High Performance Fortran The Future of FORTRAN Some Utility Routines Number-Numeral Conversions String Insertions Attaching a File Arithmetic with Two-Part Values Measuring CPU Time A Shell Script for Global Edits Caveats and Omissions Bibliography Index Exercises appear at the end of each chapter.