Implementing the conjugate gradient algorithm in a functional language

  • Pascal R. Serrarens
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1268)


This paper evaluates the elegance and efficiency of functional programming in numerical scientific computing, an interesting area because time and space efficiency are important: many scientific programs work with large data sets and run for a long time. The example we use is the conjugate gradient algorithm, an iterative method to solve systems of linear equations. We investigated various implementations of the algorithm in the functional languages Clean and Haskell and the imperative language C. Good results are obtained when comparing the algorithm written in Clean with the same algorithm in C and Haskell.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [BS93]
    E. Barendsen and J.E.W Smetsers. Conventional and uniqueness typing in graph rewrite systems. Technical Report CSI-R9328, Computer Science Institute, Faculty of Mathematics and Informatics, University of Nijmegen, December 1993.Google Scholar
  2. [CSJ95]
    S. Choi, T.K. Sarkar, and Choi J. Adaptive antenna array for direction-of-arrival estimation utilizing the conjugate gradient method. Signal Processing (SIGPRO), 45(3):313–327, Sep 1995.Google Scholar
  3. [EO94]
    R.G. Ellis and D.W. Oldenburg. The pole-pole 3-d dc resistivity inverse problem: a conjugate gradient approach. Geophysical Journal International, 119:187–194, 1994.Google Scholar
  4. [GLPJ93]
    A. Gill, J. Launchbury, and S.L. Peyton Jones. A short cut to deforestation. In Proceedings of the ACM Conference on Functional Programming Languages and Computer Architecture (FPCA'93), pages 223–232, April 1993.Google Scholar
  5. [H+96]
    P.H. Hartel et al. Benchmarking implementations of functional languages with “pseudoknot”, a float-intensive benchmark. Journal functional programming, 6(4): 621–655, July 1996.Google Scholar
  6. [HPJW92]
    P. Hudak, S.L. Peyton Jones, and P. Wadler. Report on the programming language haskell, a non-strict purely functional language (version 1.2). SIGPLAN Notices, Mar, 1992.Google Scholar
  7. [HS93]
    A.G. Hoekstra and P.M.A. Sloot. Implementation of a parallel conjugate gradient method for simulation of elastic light. 4th Physics Computing '92, pages 345–346, 1993.Google Scholar
  8. [JDG92]
    E.M. Johansson, F.U. Dowla, and D.M. Goodman. Backpropagation learning for multi-layer feed-forward neural networks using the conjugate gradient method. International Journal of Neural Systems, 2(4), 1992.Google Scholar
  9. [KGGK94]
    V. Kumar, A. Grama, A. Gupta, and G. Karypis. Introduction to Parallel Computing, Design and Analysis of Algorithms. The Benjamin/Cummings Publishing Company, Inc., California, 1994.Google Scholar
  10. [LPJ94]
    J. Launchbury and S.L. Peyton Jones. Lazy functional state threads. In Programming Languages Design and Implementation, Orlando, 1994. ACM Press.Google Scholar
  11. [PJ96]
    S.L. Peyton Jones. Bulk types with class. In Proceedings of the 1996 Glasgow Workshop on Fucntional Programming, Ullapool, Scotland, July 1996.Google Scholar
  12. [PJL91]
    S.L. Peyton Jones and J. Launchbury. Unboxed values as first class citizens. In FPCA '91 — Functional Programming Languages and Computer Architecture, pages 636–666, 1991.Google Scholar
  13. [PvE93]
    M.J. Plasmeijer and M.C.J.D. van Eekelen. Functional Programming and Parallel Graph Rewriting. Addison-Wesley Publishers Ltd., 1993.Google Scholar
  14. [SF93]
    T. Sheard and L. Fegaras. A fold for all seasons. In Proceedings of the ACM Conference on Functional Programming Languages and Computer Architecture (FPCA '93), pages 233–242, Orlando, April 1993. ACM Press.Google Scholar
  15. [Wad90]
    P. Wadler. Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science, 73:231–248, 1990.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1997

Authors and Affiliations

  • Pascal R. Serrarens
    • 1
  1. 1.Computer Science InstituteUniversity of NijmegenNetherlands

Personalised recommendations