SVD_SNOWFALL
Singular Value Decomposition of Snowfall Data
SVD_SNOWFALL
is a C library which
demonstrates the use of the Singular Value Decomposition (SVD)
to analyze a set of historical snowfall data,
with plots created by GNUPLOT.
The snowfall data consists of records for the winters of
1890-1891 to 2016-2017, of the snowfall in inches, over the months from
October to May, as measured at Michigan Tech.
This data can be regarded as an 8 by 127 matrix A.
Applying the singular value decomposition produces the
factors
A = U * S * V'
and it is the purpose of this library to consider what these
factors indicate about the snowfall data.
The sample problem writes files that can be processed by GNUPLOT
to create plots.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
SVD_SNOWFALL is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
FINGERPRINTS,
a dataset directory which
contains a few images of fingerprints.
GNUPLOT,
C programs which
illustrate how a program can write data and command files
so that gnuplot can create plots of the program results.
SVD_DEMO,
a C program which
demonstrates the singular value decomposition (SVD) for a simple example.
TIME_SERIES,
a dataset directory which
contains examples of files describing time series.
Reference:
-
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
-
Gene Golub, Charles VanLoan,
Matrix Computations,
Third Edition,
Johns Hopkins, 1996,
ISBN: 0-8018-4513-X,
LC: QA188.G65.
-
David Kahaner, Cleve Moler, Steven Nash,
Numerical Methods and Software,
Prentice Hall, 1989,
ISBN: 0-13-627258-4,
LC: TA345.K34.
-
Lloyd Trefethen, David Bau,
Numerical Linear Algebra,
SIAM, 1997,
ISBN: 0-89871-361-7,
LC: QA184.T74.
Source Code:
Examples and Tests:
The snowfall data itself must be read into the program from a file:
The second test function writes "command" and "data" files that can be used
by gnuplot to create plots.
The third test function writes "command" and "data" files that can be used
by gnuplot to create plots.
The fourth test function writes "command" and "data" files that can be used
by gnuplot to create plots of the first 6 U modes, which form a basis
for average snowfall as a function of the month.
The fifth test function writes "command" and "data" files that can be used
by gnuplot to create plots of the first 6 V modes, which form a basis
for total yearly snowfall behavior as a function of the year.
-
vmode_commands.txt,
a command file.
-
vmode_data.txt,
a data file.
-
vmode1.png,
basis vector 1 for total yearly snowfall as a function of year.
-
vmode2.png,
basis vector 2 for total yearly snowfall as a function of year.
-
vmode3.png,
basis vector 3 for total yearly snowfall as a function of year.
-
vmode4.png,
basis vector 4 for total yearly snowfall as a function of year.
-
vmode5.png,
basis vector 5 for total yearly snowfall as a function of year.
-
umode6.png,
basis vector 6 for snowfall as a function of month.
List of Routines:
-
CH_CAP capitalizes a single character.
-
CH_EQI is TRUE (1) if two characters are equal, disregarding case.
-
CH_TO_DIGIT returns the integer value of a base 10 digit.
-
DAXPY computes constant times a vector plus a vector.
-
DDOT forms the dot product of two vectors.
-
DNRM2 returns the euclidean norm of a vector.
-
DROT applies a plane rotation.
-
DROTG constructs a Givens plane rotation.
-
DSCAL scales a vector by a constant.
-
DSVDC computes the singular value decomposition of a real rectangular matrix.
-
DSWAP interchanges two vectors.
-
FILE_COLUMN_COUNT counts the number of columns in the first line of a file.
-
FILE_ROW_COUNT counts the number of row records in a file.
-
I4_MAX returns the maximum of two I4's.
-
I4_MIN returns the smaller of two I4's.
-
R8_ABS returns the absolute value of a R8.
-
R8_MAX returns the maximum of two R8's.
-
R8_SIGN returns the sign of a R8.
-
R8COL_NORMALIZE_LI normalizes an R8COL with the column infinity norm.
-
R8COL_REVERSE reverses the order of columns in an R8COL.
-
R8MAT_DATA_READ reads the data from an R8MAT file.
-
R8MAT_HEADER_READ reads the header from an R8MAT file.
-
R8MAT_MM_NEW multiplies two matrices.
-
R8MAT_MMT_NEW computes C = A * B'.
-
R8MAT_PRINT prints an R8MAT.
-
R8MAT_PRINT_SOME prints some of an R8MAT.
-
R8MAT_SVD_LINPACK gets the SVD of a matrix using a call to LINPACK.
-
R8MAT_SVD_LOW_RANK forms a rank R approximation using the SVD.
-
R8ROW_REVERSE reverses the order of the rows of an R8ROW.
-
R8VEC_CUM0_NEW computes the cumulutive sums of an R8VEC.
-
R8VEC_PRINT prints an R8VEC.
-
R8VEC_SUM returns the sum of an R8VEC.
-
S_LEN_TRIM returns the length of a string to the last nonblank.
-
S_TO_R8 reads an R8 value from a string.
-
S_TO_R8VEC reads an R8VEC from a string.
-
S_WORD_COUNT counts the number of "words" in a string.
-
TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C source codes.
Last revised on 09 May 2013.