SVD_BASIS
Extract singular vectors from data


SVD_BASIS is a C++ program which applies the singular value decomposition to a set of data vectors, to extract the leading "modes" of the data.

This procedure, originally devised by Karl Pearson, has arisen repeatedly in a variety of fields, and hence is known under various names, including:

This program is intended as an intermediate application, in the following situation:

  1. a "high fidelity" or "high resolution" PDE solver is used to determine many (say N = 500) solutions of a discretized PDE at various times, or parameter values. Each solution may be regarded as an M vector. Typically, each solution involves an M by M linear system, greatly reduced in complexity because of bandedness or sparsity.
  2. This program is applied to extract L dominant modes from the N solutions. This is done using the singular value decomposition of the M by N matrix, each of whose columns is one of the original solution vectors.
  3. a "reduced order model" program may then attempt to solve a discretized version of the PDE, using the L dominant modes as basis vectors. Typically, this means that a dense L byL linear system will be involved.

Thus, the program might read in 500 files, and write out 5 or 10 files of the corresponding size and "shape", representing the dominant solution modes.

To compute the singular value decomposition, we first construct the M by N matrix A using individual solution vectors as columns:

A = [ X1 | X2 | ... | XN ]

The singular value decomposition has the form:

A = U * S * V'
and is determined using the DSVDC routine from the linear algebra package LINPACK. The leading L columns of the orthogonal M by M matrix U, associated with the largest singular values S, are chosen to form the basis.

In most PDE's, the solution vector has some structure; perhaps there are 100 nodes, and at each node the solution has perhaps 4 components (horizontal and vertical velocity, pressure, and temperature, say). While the solution is therefore a vector of length 400, it's more natural to think of it as a sort of table of 100 items, each with 4 components. You can use that idea to organize your solution data files; in other words, your data files can each have 100 lines, containing 4 values on each line. As long as every line has the same number of values, and every data file has the same form, the program can figure out what's going on.

The program assumes that each solution vector is stored in a separate data file and that the files are numbered consecutively, such as data01.txt, data02,txt, ... In a data file, comments (beginning with '#") and blank lines are allowed. Except for comment lines, each line of the file is assumed to represent all the component values of the solution at a particular node.

Here, for instance, is a tiny data file for a problem with just 3 nodes, and 4 solution components at each node:

      #  This is solution file number 1
      #
        1   2   3   4
        5   6   7   8
        9  10  11  12
      

The program is interactive, but requires only a very small amound of input:

The program computes L basis vectors, and writes each one to a separate file, starting with svd_001.txt, svd_002.txt and so on. The basis vectors are written with the same component and node structure that was encountered on the solution files. Each vector will have unit Euclidean norm.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

SVD_BASIS is available in a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

BLAS1, a C++ library which contains an implementation of the Level 1 Basic Linear Algebra Subprograms, which are used by this program. To build a copy of SVD_BASIS requires access to a compiled copy of the BLAS1 library.

BRAIN_SENSOR_POD, a MATLAB program which applies the method of Proper Orthogonal Decomposition to seek underlying patterns in sets of 40 sensor readings of brain activity.

BURGERS, a dataset directory which contains a set of 40 successive solutions to the Burgers equation. This data can be analyzed using SVD_BASIS.

LINPACK, a C++ library which supplies the routine DSVDC, needed by this program. To build a copy of SVD_BASIS requires access to a compiled copy of the LINPACK library.

SVD_BASIS_WEIGHT, a FORTRAN90 program which is similar to SVD_BASIS, but which allows the user to assign weights to each data vector.

SVD_DEMO, a C++ program which demonstrates the singular value decomposition for a simple example.

SVD_SNOWFALL, a C++ library which reads a file containing historical snowfall data and analyzes the data with the Singular Value Decomposition (SVD), and plots created by GNUPLOT.

SVD_TRUNCATED, a C++ program which demonstrates the computation of the reduced or truncated Singular Value Decomposition (SVD) that is useful for cases when one dimension of the matrix is much smaller than the other.

Reference:

  1. Edward Anderson, Zhaojun Bai, Christian Bischof, Susan Blackford, James Demmel, Jack Dongarra, Jeremy Du Croz, Anne Greenbaum, Sven Hammarling, Alan McKenney, Danny Sorensen,
    LAPACK User's Guide,
    Third Edition,
    SIAM, 1999,
    ISBN: 0898714478,
    LC: QA76.73.F25L36
  2. Gal Berkooz, Philip Holmes, John Lumley,
    The proper orthogonal decomposition in the analysis of turbulent flows,
    Annual Review of Fluid Mechanics,
    Volume 25, 1993, pages 539-575.
  3. John Burkardt, Max Gunzburger, Hyung-Chun Lee,
    Centroidal Voronoi Tessellation-Based Reduced-Order Modelling of Complex Systems,
    SIAM Journal on Scientific Computing,
    Volume 28, Number 2, 2006, pages 459-484.
  4. Lawrence Sirovich,
    Turbulence and the dynamics of coherent structures, Parts I-III,
    Quarterly of Applied Mathematics,
    Volume XLV, Number 3, 1987, pages 561-590.

Source Code:

Examples and Tests:

List of Routines:

You can go up one level to the C++ source codes.


Last revised on 22 November 2011.