The Algorithm Design Manual
About the Book
Programming Challenges

The Stony Brook Algorithm Repository

Steven Skiena
Stony Brook University
Dept. of Computer Science

1.2.1 Solving Linear Equations

Problem Input | Problem Output

INPUT                    OUTPUT


Input Description: An m x n matrix A, and an m x 1 vector b, representing m linear equations with n variables.

Problem: What is the vector x such that A \cdot x = b?

Excerpt from The Algorithm Design Manual: Solving linear systems is a problem of such scientific and commercial importance that excellent codes are readily available. There is likely no good reason to implement your own solver, even though the basic algorithm (Gaussian elimination) is one we learned in high school. This is especially true if you are working with large systems.

Gaussian elimination is based on the fact that the solution to a system of linear equations is invariant under scaling (multiplying both sides by a constant; i.e. if x=y, then 2x=2y) and adding equations (i.e. the solution to the equations x=y and w=z is the same as the solution to x=y and x+w=y+z). Gaussian elimination scales and adds equations so as to eliminate each variable from all but one equation, leaving the system in such a state that the solution can just be read off from the equations.


Implementations

  • LAPACK and LINPACK -- Linear Algebra PACKages (FORTRAN) (rating 10)
  • LAPACK++: LAPACK in C++ (C++) (rating 10)
  • JScience: comprehensive Java library for the scientific community. (Java) (rating 9)
  • Numerical Recipes Software (C++) (rating 8)
  • JAMA : A Java Matrix Package (Java) (rating 8)
  • GSL - GNU Scientific Library (C++,C) (rating 8)

  • Recommended Books

    Parallel Numerical Algorithms by D. Keyes and A. Sameh and V. Venkatarishnan Matrix Computations by Gene H. Golub and Charles F. Van Loan Elementary Numerical computing with Mathematica by R. Skeel and J. Keiper
    Numerical methods and analysis by J. Buchanan and P. Turner Parallel Algorithms for Matrix Computations by K. Gallivan Introduction to Algorithms by T. Cormen and C. Leiserson and R. Rivest and C. Stein
    Introduction to Parallel and Vector Solution of Linear Systems by J. Ortega Numerical Mathematics and Computing by W. Cheney and D. Kincaid The Design and Analysis of Computer Algorithms by A. Aho and J. Hopcroft and J. Ullman

    Related Problems


      
    Bandwidth Reduction
      
    Determinants and Permanents
      
    Matrix Multiplication



    This page last modified on 2008-07-10 .
    www.algorist.com