mlpack  master
lin_alg.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_MATH_LIN_ALG_HPP
13 #define MLPACK_CORE_MATH_LIN_ALG_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
20 namespace mlpack {
21 namespace math {
22 
28 void VectorPower(arma::vec& vec, const double power);
29 
37 void Center(const arma::mat& x, arma::mat& xCentered);
38 
44 void WhitenUsingSVD(const arma::mat& x,
45  arma::mat& xWhitened,
46  arma::mat& whiteningMatrix);
47 
52 void WhitenUsingEig(const arma::mat& x,
53  arma::mat& xWhitened,
54  arma::mat& whiteningMatrix);
55 
59 void RandVector(arma::vec& v);
60 
65 void Orthogonalize(const arma::mat& x, arma::mat& W);
66 
71 void Orthogonalize(arma::mat& x);
72 
80 void RemoveRows(const arma::mat& input,
81  const std::vector<size_t>& rowsToRemove,
82  arma::mat& output);
83 
93 void Svec(const arma::mat& input, arma::vec& output);
94 
95 void Svec(const arma::sp_mat& input, arma::sp_vec& output);
96 
103 void Smat(const arma::vec& input, arma::mat& output);
104 
113 inline size_t SvecIndex(size_t i, size_t j, size_t n);
114 
125 void SymKronId(const arma::mat& A, arma::mat& op);
126 
127 } // namespace math
128 } // namespace mlpack
129 
130 // Partially include implementation
131 #include "lin_alg_impl.hpp"
132 
133 #endif // MLPACK_CORE_MATH_LIN_ALG_HPP
void Orthogonalize(const arma::mat &x, arma::mat &W)
Orthogonalize x and return the result in W, using eigendecomposition.
void VectorPower(arma::vec &vec, const double power)
Auxiliary function to raise vector elements to a specific power.
void RemoveRows(const arma::mat &input, const std::vector< size_t > &rowsToRemove, arma::mat &output)
Remove a certain set of rows in a matrix while copying to a second matrix.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
The core includes that mlpack expects; standard C++ includes and Armadillo.
void SymKronId(const arma::mat &A, arma::mat &op)
If A is a symmetric matrix, then SymKronId returns an operator Op such that.
void Smat(const arma::vec &input, arma::mat &output)
The inverse of Svec.
void WhitenUsingEig(const arma::mat &x, arma::mat &xWhitened, arma::mat &whiteningMatrix)
Whitens a matrix using the eigendecomposition of the covariance matrix.
void WhitenUsingSVD(const arma::mat &x, arma::mat &xWhitened, arma::mat &whiteningMatrix)
Whitens a matrix using the singular value decomposition of the covariance matrix. ...
size_t SvecIndex(size_t i, size_t j, size_t n)
Return the index such that A[i,j] == factr(i, j) * svec(A)[pos(i, j)], where factr(i, j) = sqrt(2) if i != j and 1 otherwise.
void RandVector(arma::vec &v)
Overwrites a dimension-N vector to a random vector on the unit sphere in R^N.
void Svec(const arma::mat &input, arma::vec &output)
Upper triangular representation of a symmetric matrix, scaled such that, dot(Svec(A), Svec(B)) == dot(A, B) for symmetric A, B.
void Center(const arma::mat &x, arma::mat &xCentered)
Creates a centered matrix, where centering is done by subtracting the sum over the columns (a column ...