SVDLIBC offers a cleaned-up version of the code with a new library interface and a front-end executable that performs matrix file type conversions, along with computing singular value decompositions. Currently the only SVDPACKC algorithm implemented in SVDLIBC is las2, because it seems to be consistently the fastest. This algorithm has the drawback that the low order singular values may be relatively imprecise, but that is not a problem for most users who only want the higher-order values or who can tolerate some imprecision.
Note that the SVDPACKC matrix file formats are designed to be simple and do not include magic cookies or have conventional extensions to allow the format to be determined automatically. Therefore, you may need to use the -r and -w options to specify the input and output formats.
Usage | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
svd [options] matrix_file | ||||||||||||
-a | algorithm | Set the algorithm to use. They include:
| ||||||||||
-c | infile outfile | Converts a matrix file to a new format (using -r and -w to specify the old and new formats). Then exits immediately. | ||||||||||
-d | dimensions | Desired number of SVD triples or dimensions (default is all) | ||||||||||
-e | bound | Minimum magnitude of wanted eigenvalues for las2 (1e-30) | ||||||||||
-k | kappa | Accuracy parameter for las2 (1e-6) | ||||||||||
-i | iterations | Maximum algorithm settling iterations. By default it iterates as many times as necessary to obtain the desired number of dimensions, and most users will not want to adjust this. But you can set this to a lower value to speed things up, with the possible loss of some dimensions. | ||||||||||
-o | file_root | Root of files in which to store resulting U', S, and V' | ||||||||||
-r | format | Input matrix file format (see below for format specifications)
| ||||||||||
-t | Transposes the input matrix. Can be used when computing the SVD or converting the format with -c. | |||||||||||
-v | verbosity | Default is 1. Use 0 for no feedback, 2 to list singular values, and 3 for the vectors too. | ||||||||||
-w | format | Output matrix file format. Options are same as for -r, but default is
dense text. |
If the -o option is used, the resulting U' and V' matrices will be stored in files whose name is the specified file_root with "-Ut" or "-Vt" appended to the end. The matrices stored in these files are actually the transposes of the traditionally defined U and V matrices, so that the rows of the "-Ut" matrix are the left singular vectors and the rows of the "-Vt" matrix are the right singular vectors, which is generally more convenient. The "-S" file contains an array of the singular values, the first line of which holds the number of values.
The library defines three structures. An SMat is a pointer to a struct smat, which is a sparse matrix. A DMat is a pointer to a struct dmat, which holds a dense matrix. Finally, a SVDRec is a pointer to a struct svdrec, which holds the results of an SVD: the dimensionality (d), the left- and right- singular matrices (Ut and Vt), and file types (such as SVD_F_ST). Any file type can be loaded to or written from either a sparse or dense matrix.
Finally, the svdLAS2 function actually computes the SVD. It takes a sparse matrix and some parameters and returns an SVDRec containing the components of the SVD. svdLAS2A is a simpler version that attempts to automatically choose reasonable parameter values and requires only a matrix and the desired number of dimensions (or 0 for all).
Library Code | Command-line Code | Description |
---|---|---|
SVD_F_ST | st | Sparse matrix, text format. |
SVD_F_STH | sth | Sparse matrix, Harwell-Boeing text format used in SVDPACKC. |
SVD_F_SB | sb | Sparse matrix, binary format. |
SVD_F_DT | dt | Dense matrix, text format. |
SVD_F_DB | db | Dense matrix, binary format. |
1.4 |
|
1.34 |
|
1.33 |
|
1.32 |
|
1.31 |
|
1.3 |
|
1.21 |
|
1.2 |
|
1.1 |
|
1.01 |
|
1.0 |
|