Fortran (also FORTRAN) is a programming language originally developed in the 1950s and still in use today. The name is short for "Formula Translator/Translation". Early versions of the language were known as FORTRAN, but the capitalization has been dropped in newer revisions beginning with Fortran 90. The official language standards now refer to the language as "Fortran".
Fortran is mainly used for scientific computing and numerical analysis. Although originally a procedural language, recent versions of Fortran have included some features to support object-oriented programming.
History, versions, and revisions
The first FORTRAN compiler was developed for the IBM 704 in 1954-57 by an IBM team led by John W. Backus. This was an optimizing compiler, because the authors reasoned that no one would use the language if its performance was not comparable to assembly language.
The language was widely adopted by scientists for writing numerically intensive programs, which encouraged compiler writers to produce compilers that generate faster code. The inclusion of a complex number data type in the language made Fortran especially suited to scientific computation. There are many vendors of high performance Fortran compilers today. Many advances in the theory and design of compilers were motivated by the need to generate good code for Fortran programs.
Several revisions of the language have appeared, including the well-known FORTRAN IV (also known as FORTRAN 66), FORTRAN 77, and Fortran 90. The most recent formal standard for the language, published in 1997, is known as Fortran 95. IBM's versions were never as popular as those developed by others, which was especially true of FORTRAN IV -- WATFOR, the version of FORTRAN IV developed at the University of Waterloo, Canada, was universally preferred because it produced better reports of compilation errors. The software for automatically generating flow charts from FORTRAN programs was also developed outside IBM.
Features and extensions
Initially, the language relied on precise formatting of the source code and heavy use of statement numbers and goto statements. These quirks have been removed from newer versions of the language. Successive versions also introduced 'modern' programming concepts, such as source code comments and output of text, IF-THEN-ELSE (in FORTRAN 77), recursion (in Fortran 90), and parallel constructs, while still attempting to maintain Fortran's 'lean' profile and high performance. Among the most popular specialized Fortran-based languages were SAS, for generating statistical reports, and SIMSCRIPT, for simulating processes involving queuing.
Vendors of high performance scientific computers (Burroughs, CDC, Cray, IBM, Texas Instruments, ...) added extensions to Fortran to make use of special hardware features such as: instruction cache, CPU pipeline, vector arrays, etc. For example, one of IBM's Fortran compilers (H Extended IUP) had a level of optimization which reordered the machine code instructions to keep several internal arithmetic units busy at the same time. Another example is CFD, a special 'version' of Fortran designed specifically for the ILLIAC IV supercomputer, running at NASA's Ames Research Center. These extensions have either disappeared over time or had elements incorporated into the main standard; the major remaining extension is OpenMP, which is a cross-platform extension for shared memory programming. One new extension, CoArray Fortran, is intended to promote parallel programming.
Syntax drawbacks and advantages
As what was basically a first attempt at designing a high-level language, the language's syntax is regarded as arcane by many programmers who learned more modern languages. It is difficult to write a lexical analyser for, and one-character mistakes can lead to runtime errors rather than compilation errors if more recent constructs such as free source form are not used. Some of the earlier versions, particularly, lacked facilities that would be regarded as useful in modern machines, such as dynamic memory allocation.
One should, however, take into consideration that the syntax of Fortran has been tuned to scientific and numerical work, and that many of its deficiencies have been addressed in more recent versions. For example, Fortran 95 has very short commands for performing mathematical operations on matrices and arrays which not only greatly improves program readability but also provides useful information to the compiler to enable it to vectorize operations. For these reasons, Fortran is not often used outside scientific and engineering numerical analysis, but remains the language of choice for high performance numerical computing.
The two standards below reflect the current Fortran implementations.
- ANSI X3.198-1992 (R1997). Title: Programming Language "Fortran" Extended. Informally known as Fortran 90. This standard was published by ANSI.
- ISO/IEC 1539-1:1997. Title: Information technology - Programming languages - Fortran - Part 1: Base language. Informally known as Fortran 95. There are a further 2 parts to this standard. Part 1 has been formally adopted by ANSI.
Code example (Hello, world)
PRINT *, 'hello, world'
Source | Copyright
Webmasters: Add your website here:
Readers: Edit |
AR and ARFIMA models
Tests for AR(1) Parameter in Regression Models with Autocorrelated Errors. Univariate and multivariate Bayesian ARFIMA. By Nalini Ravishanker and coworkers.
ARMA and Kalman Filter model estimation
By J. Newton
Autoregressive model estimation
Originally by H. Akaike, modified by T. Morikawa, M. Sigemori, and T. Wada.
Complete code of six stand-alone Fortran programs for cluster analysis, described and illustrated in L. Kaufman and P.J. Rousseeuw (1990), "Finding Groups in Data: an Introduction to Cluster Analysis", Wiley.
Cluster generation, hierarchical clustering with influence detection, and K-Means clustering with influence detection, by Glenn Milligan.
Computer Assisted Analysis of Mixtures (C.A.MAN)
Program designed to analyse mixtures of densities from the exponential family.
DECORANA and TWINSPAN
Fortran 77 programs for correspondence analysis, by Jari Oksanen.
Computer Program for Multifactor Relative Risks and Tests of Hypotheses Using a Variance-Covariance Matrix from Linear and Log-Linear Regression, by Leif E. Peterson, Journal of Statistical Software v2 (1997).
Flexible Least Squares (FLS)
Developed by Robert E. Kalaba and Leigh Tesfatsion, implements the flexible least squares (FLS) approach to time-varying linear regression proposed by Kalaba and Tesfatsion in "Time-Varying Linear Regression Via Flexible Least Squares," Computers and Mathematics With Applications 17 (1989), 1215-1245. The FLS program has been incorporated into the statistical packages SHAZAM (Version 8.0) and GAUSS (TSM version 1.2).
Fortran Code for L-p Distance Statistic
Subroutines by David Allen to calculate the L-1 and L-2 distances between two density estimates. The L-1 statistic has been used successfully to testing the hypothesis that two samples come from the same distribution.
Monahan statistics code
Fortran 95 code for the book Numerical Methods of Statistics, by John Monahan
Fortran 90 codes for univariate and multivariate random number generation, computation of simple statistics, covariance matrices, principal components analysis, multiple regression, and jacknife cross-validation, by Dan Hennen.
Multivariate Normal and Multivariate t Integrals Over Convex Regions
Fortran 90 code by Paul N. Somerville, appearing in the Journal of Statistical Software volume 3.
Local polynomial regression fitting with ridging, kernel regression fitting with local and global bandwidth optimization, and kernel density estimation with global bandwidth selection.
Poisson Iteratively Reweighted Least Squares Program for Additive, Multiplicative, Power, and Non-linear Models, by Leif E. Peterson, Journal of Statistical Software v2 (1997).
Quality Control and Engineering Statistics code
For a course, authored by Karen Jensen, F. F. Gan, Stephen Crowder, Thomas Lorenzen, Keith Crawford, Andy Chiang, and Brandon L. Paris.
Robust Estimation of Simple Statistics
By T. Beers, K. Flynn, and K. Gebhardt.
Code for regression and covariance matrix estimation, from the Antwerp Group On Robust & Applied Statistics.
Fortran 90 code by Kelley Pace.
STARPAC - Statistical & Time Series Package
Fortran 77 code for times series and least-squares regression including nonlinear regression.
Code for "Invariant Small Sample Confidence Intervals For The Difference Of Two Success Probabilities" and "Bootstrap Prediction and Confidence Bands: a Superior Statistical Method for Analysis of Gait Data", by Thomas Santner.
Code by Laurie Davies for modality of spectral densities, ANOVA, and nonparametric regression: runs, taut strings, and local extremes.
See Applied Statistics (algorithms of the Royal Statistical Society) and General Archives for a considerable amount of Fortran code.
GARCH Estimates: Analytic Derivatives
By Gabriele Fiorentini, Giorgio Calzolari, and Lorenzo Panattoni, for a 1996 paper in the Journal of Applied Econometrics.
NOCOM estimates the parameters (means, variance, proportions of components) of a mixture of normal distributions for independent observations (quantitative data). COMPMIX assumes a mixture of normal distributions, with parameters for each component in that mixture. The COMPMIX program then calculates the conditional probability, given an observed value, that it belongs to the i-th component.
Mixture modelling by Minimum Message Length (MML).
Time Series Analysis and Forecasting Techniques
By Hossein Arsham. Â
Simulation from the Multivariate Normal and t Distributions Subject to Linear Constraints
By John Geweke.
Studies of Random Numbers
Fortran 77 codes by Ilpo Vattulainen.
Time-Varying Autoregression (TVAR)
Software by Raquel Prado and Mike West for fitting, analysis and exploration of time series using classes of TVAR's.
Z-transformed Discrete Correlation Function algorithm (ZDCF)
By Tal Alexander.
VPLX: Variance Estimation for Complex Samples
Program from the U.S. Census Bureau for the calculation of variances for complex sample designs through replication.
University of California, Berkeley, Econometrics Laboratory Fortran Software
Monte Carlo Methods in Bayesian Computation
Fortran 77 code to accompany book by Ming-Hui Chen, Qi-Man Shao, and Joseph G. Ibrahim.
Permutation Methods: A Distance Function Approach
Code for book by Paul W. Mielke Jr. and Kenneth J. Berry.
Metasite with links to source codes in Fortran and C implementing statistical methods which are freely available on the Internet. The codes are chosen for their potential utility for research in astronomy and other physical sciences.
Fortran 90 and Matlab codes for course by Lynne Seymour.
Department of Economics Data & Software
Programs for estimating univariate and multivariate GARCH models in Fortran 77 and Gauss.
Nonparametric Kernel Regression
Code for Monte Carlo simulation with discrete and continuous outcomes, by Tom Mroz.
Nonlinear Time Series Analysis (TISEAN)
Code in C and Fortran for the analysis of time series with methods based on the theory of nonlinear deterministic dynamical systems (chaos).
Univariate and multivariate spline regression, by Dolph Schluter.
Code for Bayesian analysis of long memory and persistence using ARFIMA models, benchmark priors for Bayesian model averaging, estimation of demand systems through consumption efficiency, model uncertainty in cross-country growth regressions, and Bayesian modelling of catch in a Northwest Atlantic Fishery, by Mark Steel.
Fortran 95 codes by Karin Meyer: RRGIBBS does simple random regression analyses via Gibbs sampling, and PDMATRIX makes matrices positive definite.
Hypothesis Testing using Shape-Restricted Regression
Code for convex and monotone regression, by Mary C. Meyer.
Fortran codes for cointegration tests and other time series topics.
By Michael C. Minnotte. Uses a random number generator (RNG) from NAG, but another RNG can be used.
Predictor Sort Confidence Interval Simulation
Program by Steve Verrill that performs a simulation to test how well corrected confidence intervals based on blocked and unblocked ANOVAs perform in a predictor sort sampling ANOVA. It also estimates coverages for confidence intervals based on an analysis of covariance, and for confidence intervals based on uncorrected blocked and unblocked ANOVAs.
Program to determine appropriate sample sizes, allocate specimens, and analyze results in the case in which a response predictor is used to sort the specimens prior to treatment.
Calculates nonparametric estimates of percentiles, associated confidence intervals, and tolerance limits of the percentiles from a data set. It can also give the order statistics needed for any sample size to create the same estimates.
Exact Confidence Bounds on a Normal Distribution Coefficient of Variation
Obtains a two-sided confidence interval on a coefficient of variation for data from a normal distribution.
Andrew Jeffrey's Fortran 90 routines
Routines for i) the calculation of some linear algebra ii) non-linear minimization, iii) numerical integration and differentiation, iv) random number generation from a Normal distribution with mean zero and variance one, and v) the implementation of the Generalized Method of Moments statistical estimation procedure.
Classical Item Analysis
Program by Seock-Ho Kim for classical item analysis for tests that consist of multiple-choice or true-false items. In addition to item statistics for each item response, the program provides summary statistics of the total score, coefficient alpha, and test scoring results. The cross classification of quintile group by item response can be obtained optionally. The program can be obtained from the author.
Solves unsymmetric equations, linear least squares, and damped least squares for a left-hand-side matrix that is large and sparse.
ODRPACK: Software for Orthogonal Distance Regression
Solves the Orthogonal Distance Regresson (ODR) problem, that is, to find parameter estimates that minimize the sum of the squares of the weighted orthogonal distances between each observed data point and the curve described by a nonlinear equation.
Lyapunov Exponent of Noisy Nonlinear Systems (LENNS)
Fortran 77 code for paper by Ronald Gallant.
Allows one to estimate and analyze dynamic, nonlinear, simultaneous equations models. The models can be rational expectations models, and they can have autoregressive errors of any order. The estimation techniques include OLS, 2SLS, 3SLS, FIML, LAD, 2SLAD, and some versions of Hansen's method of moments estimator.
Code for bispectrum test of Melvin Hinich.
Fortran 90 code by Michael Schulz and Manfred Mudelsee to estimate red-noise spectra directly from unevenly spaced time series, without requiring interpolation.
Statistical Analysis of Climate Time Series
Codes by Manfred Mudelsee. PearsonT estimates Pearsonâ€™s correlation coefficient from serially dependent time series. Rampfit estimates ramp function regressions. TAUEST estimates persistence in unevenly spaced weather/climate time series. XTREND estimates trends in the occurrence rate of extreme weather and climate events.
Numerical Methods for Estimation and Inference in Bayesian VAR-models
Fortran 77 code for paper by K. Rao Kadiyala and Sune Karlsson.
Nearest Point Algorithm (NPA) for Dense Kernels
Fortran 77 code by S. Sathiya Keerthi to accompany paper "A Fast Iterative Nearest Point Algorithm for Support Vector Machine Classifier Design".
Program by Ruey Tsay to calculate the price of a European option using a simple jump diffusion model.
Fortran code by Forrest W. Young for multidimensional scaling.
Program for canonical community ordination by [partial] [detrended] [canonical] correspondence analysis, principal components analysis and redundancy analysis. [Commercial]
BIO 248 Programs
Fortran and S codes for neural networks and optimization.
Pricing Derivative Securities
Fortran 77 and C++ code for book by T. W. Epps, in a zip file.
Non-Negative Least Squares (NNLS)
Codes in Fortran 77, 90, C, IDL, and Matlab.
Random number generators in F (Fortran 95 subset) by Jose Rui Faustino de Sousa.
Fortran 90 codes.
Programs by Allan D. Gordon for hierarchical classification of data using one of four standard clustering procedures (single link, group average link, Ward's method, complete link) and other topics in classification.
Group Sequential Tests
Programs from book by Christopher Jennison.
Fortran 77 code by Ruey Tsay to calculate the portmanteau statistic for multivariate time series regression.
Computer Intensive Statistical Methods
Fortran 77 programs from book by Urban Hjorth: cross validation of forward selection, forward validation, and bootstrapping.
Quantiles of the Multivariate Studentized Range Procedure
By Otto Schwalb.
Multivariate Normal Rectangle Probabilities
Fortran and C codes by H. Joe to accompany paper.
Wes' programs page
Fortran 77 codes by W. J. Metzger to construct a minimum spanning tree and calculate a confidence level for the hypothesis that two sets of points are from the same distribution.
Fortran 77 programs and Windows binaries by M. T. Boswell to generate random numbers and compute the cumulative and inverse cumulative distribution functions for several statistical distributions.
Fortran 77 codes by Volker Blobel for sorting, linear algebra, random number generation, least squares fitting with constraints and with many variables, and unfolding of measured distributions.
WWZ and TS
TS is a time series statistical program for analyzing variable star data. WWZ is a time series analysis program used to study the time-evolution of variable star data, capable of measuring changes in period, amplitude, and mean magnitude.
Demo Fortran90 Multilayer Perceptron Backprop Code
By Phil Brierley. A genetical algorithm code is at http://www.philbrierley.com/main.html&code/gafortran.html&code/codeleft.html .
Research Tools Developed by the Mann Group
Fortran 77 code for the Mann & Lees Multi-Taper Method (MTM) and Mann & Park MTM-SVD Multivariate Signal Analysis.
Software for Stochastic Simulation Input Modeling
Fortran 77 code and Windows executables for fitting Johnson distributions, Poisson processes, and other topics. By James R. Wilson.
Richard Chandler's software
Fortran 77 code for random number generation (uniform, exponential, normal, binomial, poisson, geometric, gamma, beta, negative binomial and Weibull), and GLIMCLIM (Generalised Linear Modelling of daily climate sequences).
Gaussian Random Number Generator
Code to generate autocorrelated Gaussian variates by S. Tim Hatamian.
Ahlquist Time Series Analysis
Fortran 77 codes, some of which call Numerical Recipes.
Autoregressive to Anything (ARTA)
Code by Marne C. Cario and Barry L. Nelson to simulate stationary time series with arbitrary marginal distributions and feasible autocorrelation structure specified through lag p.
SNP: A Program for Nonparametric Time Series Analysis
Code by A. Ronald Gallant and George Tauchen for nonparametric time series analysis that employs a Hermite polynomial series expansion to approximate the conditional density of a multivariate process.
Bayesian Analysis, Computation and Communication (BACC)
By John Geweke.
Mersenne Twister in Fortran
Random number generators in Fortran.
Phil Everson research
TLNise: Two-Level Normal independent sampling estimation. Rcwish generates random draws from the Wishart and related distributions.
Geostatistical Software LIBrary (GSLIB)
Codes in Fortran 90 and 77. Accompanies the book "GSLIB: Geostatistical Software Library and User's Guide" by Clayton Deutsch and AndrÃ© Journel.
Raw General Linear Model (GLM)
Code to accompany paper "Rolling Your Own: Linear Model Hypothesis Testing and Power Calculations via the Singular Value Decomposition".
Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimator
By Wouter J. Denhaan.
Suite of programs to estimate (co)variance components or covariance functions, and the resulting genetic parameters, by Restricted Maximum Likelihood fitting an animal model, by K. Meyer.
Department of Biomathematics, University of Texas M. D. Anderson Hospital
Random numbers, distributions, and many more (dcflib, ranlib, ...)
In Fortran 77, by Ingo Ruczinski and Charles Kooperberg. Also incorporated into packages for R and S-PLUS.
Multivariate Data Analysis
Code for principal components, partitioning, clustering, discriminant analysis, multidimensional scaling, Kohonen self-organizing map, sorting, errors-in-variable regression, minimal spanning trees, and GMDH, by Fionn Murtagh.
Kalman smoothing routine for Hodrick-Prescott filter
By E. Prescott.
Recipe: REGression Confidence Intervals for PErcentiles
Determines one-sided tolerance limits (in particular, A- and B-basis material property values) for regression models in the presence of between-batch variability. By Mark Vangel.
Simultaneous Nonparametric Regression
By Laurie Davies.
RKPACK and RKPACK-II are collections of RATFOR (rational FORTRAN) routines by Chong Gu for Gaussian regression using smoothing splines, penalized likelihood density and hazard estimation.
Multivariate normal or t-probabilities
Fortran and SAS/IML programs by Frank Bretz.
Simulating Rectangle Multivariate Normal Probabilities and Derivatives
By Vassilis Hajivassiliou.
Random Number Generator
KISS RNG by George Marsaglia
I-NoLLS Least-Squares Fitting Program
Fits the parameters of physical models to (experimental) data using an Interactive Non-Linear Least Squares procedure. The code, by Mark M. Law and Jeremy M. Hutson, is designed to be highly modular.
Simulating stationary and non-stationary Gaussian random processes
By Grace Chan.