HDIM
1.0.0
Packages for High Dimensional Linear Regression
|
Generic linear algebra functions. More...
#include <fenv.h>
#include <chrono>
#include <fstream>
#include <vector>
#include <eigen3/Eigen/Dense>
Go to the source code of this file.
Classes | |
struct | hdim::Binarize< T > |
Functor to convert vector of values into support vector. More... | |
struct | hdim::SoftThres< T > |
Soft Threshold functor used to apply hdim::soft_threshold to each element in a matrix or vector. More... | |
struct | hdim::SupportSift< T > |
Functions | |
template<typename T > | |
T | hdim::StdDev (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &vect) |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > | hdim::Normalize (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat) |
Set the mean of a matrix to 0 and the standard deviation to 1. More... | |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > | hdim::Normalize (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat) |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, 1 > | hdim::Normalize (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &mat) |
Overloaded version of hdim::Normalize to accomadate vectors. | |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, 1 > | hdim::Normalize (Eigen::Matrix< T, Eigen::Dynamic, 1 > &mat) |
Overloaded version of hdim::Normalize to accomadate vectors. | |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > | hdim::build_matrix (unsigned int num_rows, unsigned int num_cols, T(*mat_func)(unsigned int, unsigned int)) |
Generate a matrix using a function that depends on row and column indices. More... | |
template<typename T > | |
void | hdim::sweep_matrix (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat, T(*mat_func)(unsigned int, unsigned int)) |
sweep_matrix More... | |
template<typename T > | |
T | hdim::square (T &val) |
Compute the square of a value. More... | |
template<typename T > | |
std::vector< T > | hdim::LogScaleVector (T lower_bound, T upper_bound, unsigned int num_elements) |
Generate a vector of logarithmically equally spaced points. More... | |
template<typename T > | |
T | hdim::sgn (T val) |
The sign function defined as. More... | |
template<typename T > | |
T | hdim::pos_part (T x) |
The positive part function defined as. More... | |
template<typename T > | |
T | hdim::soft_threshold (T x, T y) |
The proximal ( soft thresholding ) operator defined as. More... | |
template<typename T > | |
T | hdim::prox (T x, T lambda) |
A functional equivalent of hdim::soft_threshold, but possibly faster. | |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, 1 > | hdim::soft_threshold_mat (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &mat, const T lambda) |
template<typename T > | |
Eigen::Matrix< int, Eigen::Dynamic, 1 > | hdim::GenerateSupport (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &coefficients, T cut_off) |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > | hdim::negative_index (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat_in, int index) |
template<typename T > | |
T | hdim::duality_gap (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &X, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &Y, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &Beta, T r_stats_it) |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > | hdim::slice (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &org, const std::vector< unsigned int > &indices) |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, 1 > | hdim::slice (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &org, const std::vector< unsigned int > &indices) |
Generic linear algebra functions.
Definition in file generics.hpp.
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> hdim::build_matrix | ( | unsigned int | num_rows, |
unsigned int | num_cols, | ||
T(*)(unsigned int, unsigned int) | mat_func | ||
) |
Generate a matrix using a function that depends on row and column indices.
That is for some function f and an input matrix A.
num_rows | Number of rows the output matrix should have |
num_cols | Number of columns the output matrix should have |
Definition at line 131 of file generics.hpp.
std::vector< T > hdim::LogScaleVector | ( | T | lower_bound, |
T | upper_bound, | ||
unsigned int | num_elements | ||
) |
Generate a vector of logarithmically equally spaced points.
There will be num_element points, beginning at log10( lower_bound ) and ending at log10( upper_bound ).
This function is semantically equivalent to the R function 'logspace'.
lower_bound | 10^x for x = smallest element in vector |
upper_bound | 10^x for x = largest element in vector |
num_elements | number of elements in the generated vector |
Vector of logarithmically equally spaced points
Definition at line 198 of file generics.hpp.
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> hdim::Normalize | ( | const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | mat | ) |
Set the mean of a matrix to 0 and the standard deviation to 1.
Note this function is done in place, that is the input matrix is modified.
mat | An n x m matrix to be normalized. |
Definition at line 67 of file generics.hpp.
T hdim::pos_part | ( | T | x | ) |
T hdim::sgn | ( | T | val | ) |
T hdim::soft_threshold | ( | T | x, |
T | y | ||
) |
The proximal ( soft thresholding ) operator defined as.
val |
Definition at line 276 of file generics.hpp.
T hdim::square | ( | T & | val | ) |
Compute the square of a value.
val | value to square |
Definition at line 169 of file generics.hpp.
void hdim::sweep_matrix | ( | Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | mat, |
T(*)(unsigned int, unsigned int) | mat_func | ||
) |