Fortran Programming with NumPy Arrays

  • Hans Petter Langtangen
Part of the Texts in Computational Science and Engineering book series (TCSE, volume 3)


Python loops over large array structures are known to run slowly. Tests with class Grid2D from Chapter 8.6.11 show that filling a two-dimensional array of size 1100 × 1100 with nested loops in Python may require about 150 times longer execution time than using Fortran 77 for the same purpose. With Numerical Python (NumPy) and vectorized expressions (from Chapter 4.2) one can speed up the code by a factor of about 50, which gives decent performance.


Fortran Program Extension Module Fortran Code Output Array Input Array 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Hans Petter Langtangen
    • 1
    • 2
  1. 1.Simula Research LaboratoryMartin Linges vei 17, FornebuLysakerNorway
  2. 2.Department of InformaticsUniversity of OsloOsloNorway

Personalised recommendations