SVDTOOL.CC
Source:
Target:
Type:
Version: 0.1
Date: 8/15/2000
Los Alamos in-house version
Version: 0.9b
Date: 2/9/2001
Make the subroutines more robust and introduce XML style documentation for
the source code.
Packages:
Includes:
Blocks:
WriteRawData()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Write some matrix data to an output file
Usage:
Inputs:
Outputs:
Returns:
Parameters:
string ofname; //
Name of output file
vector<double> dat; //
Data matrix
int numcols; //
Number of columns
vector<string> row_labels; //
Row labels
vector<string> col_labels; //
Column labels
splint()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Numerical Recipes in C
Comments:
Cubic spline interpolation. Modified from Numerical Recipes in C.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
double* xa; //
Pointer to ordinate values for interpolation
double* ya; //
Pointer to abscissa values for interpolation
double* y2a; //
Pointer to spline coefficients
int n; //
Number of data points in xa[],ya[],y2a[]
double x; //
X (ordinate) value for interpolation
double& y; //
Reference to interpolated value
spline()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Numerical Recipes in C
Comments:
Cubic spline coefficients calculation. Modified from Numerical Recipes in C
Usage:
Inputs:
Outputs:
Returns:
Parameters:
double* x; //
Pointer to ordinate values
double* y; //
Pointer to abscissa values
int n; //
Number of elements in x[] and y[]
double yp1; //
1st derivative constraint at low x. If greater than 1.e30, it
s a natural spline with 2d derivative = 0
double ypn; //
1st derivative constraint at high x. If greater than 1.e30, it
s a natural spline with 2d derivative = 0
double* y2; //
Pointer to array of output spline coefficients
Max()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Return the greater of two integers
Usage:
Inputs:
Outputs:
Returns:
Type: int
The greater of the input values
Parameters:
Min()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Return the lesser of two integers
Usage:
Inputs:
Outputs:
Returns:
Type: int
The lesser of the input values
Parameters:
SplitLine()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Split a string at the positions of an input character, ala Perl split().
Return the number of break points found.
Usage:
Inputs:
Outputs:
Returns:
Type: int
The number of break points (i.e. characters) found in the string.
Parameters:
string strline; //
The input string to be fragmented.
int start; //
The start position for the search. The first position = 0.
int nwords; //
The maximum number of words to extract.
char ch; //
The character that defines the break points.
vector<string>& words; //
The output array of words from the split.
Data::Data(string)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Constructs an instance of the data class, initializing the matrix using data from the input file named ifname.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
string ifname; //
The file name to be read for initializing Data()
Data::Data(int, Data&)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Construct an instance of the class Data() based on an existing class. The new instance has one column missing from the data matrix, defined by an input index.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
int index; //
The column number to be deleted from the source matrix.
Data& d; //
The source class to be read in creating the new instance.
Data::Data(Data&)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Copy constructor for Data()
Copies the matrix from the source.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
Data::NumCols()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Return the number of columns in the data matrix
Usage:
Inputs:
Outputs:
Returns:
Parameters:
Data::NumRows()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Return the number of rows in the data matrix
Usage:
Inputs:
Outputs:
Returns:
Parameters:
Data::WriteCorr(string, vector<double>)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Output the correlations from the SVD evaluation to a file.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
string out_base; //
Output filename base
vector<double> correlations; //
Vector array of calculated correlation values.
Data::WriteGroups(string, double)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Determine the SVD groups and write them to an output file.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
string out_base; //
Output filename.
double thresh; //
Scale for the threshold value for inclusion within a group.
Data::SubMeanRow()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Subtract the mean row value from each row of the data matrix.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
Data::SVD()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Calculate the SVD of the data matrix, placing results in U, VT, S and B.
Also generate labels for the SVD modes/
Usage:
Inputs:
Outputs:
Returns:
Parameters:
Data::MinusSVD()
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Comments:
Invert the signs of U, VT and B.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
Data::JacknifeData(double, vector<double>&)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Perform evaluation on the current data column.
This method is called within the reduced matrix class.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
double xval; //
The ordinate value for interpolation of the missing column.
vector<double> data_col; //
The original column of data.
Data::EvaluateSVD(vector<double>&)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Perform evaluation of the SVD using the jacknife method.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
vector<double> correlations; //
Output list of Pearson correlation values from the evaluation.
Data::CalcColData(vector<double>&,vector<double>&)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Calculate the "missing" data column by matrix multiplication.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
vector<double>& calcValues; //
The calculated interpolated column from the SVD.
vector<double>& data_col; //
The output reconstructed data column.
InterpolateSVD(double,vector<double>&)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Interpolation of the missing column of the SVD.
Usage:
Inputs:
Outputs:
Returns:
Parameters:
double xval; //
The ordinate value for interpolation (missing assay label).
vector<double>& newValues; //
Vector of values for the elements of the interpolated column.
Data::CorrColData(int, vector<double>&,vector<double>&)
Kind:
Authors:
Michael Wall, Los Alamos National Laboratory/mewall@lanl.gov
Patricia Dyck, Los Alamos National Laboratory/tdyck@lanl.gov
Comments:
Calculate the Pearson correlation between the reconstructed column and the original data column
Usage:
Inputs:
Outputs:
Returns:
Parameters:
int index; //
Column number in the original data matrix.
vector<double>& data_col; //
Reconstructed data column
vector<double>& correlations; //
List of calculated correlations to which the current is added
Build:
Dependencies:
Compile:
g++ -O2 -I./F2CLIBS -c svdtool.cc
Platforms:
RedHatLinux version 7.0
Compilers:
RedHatLinux version 6.1
Compilers: