PLearn 0.1
Namespaces | Functions
TMat_maths_impl.h File Reference
#include <algorithm>
#include <limits>
#include <plearn/sys/Profiler.h>
Include dependency graph for TMat_maths_impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  PLearn
 

< for swap


Functions

template<class T >
TVec< T > PLearn::sign (const TVec< T > &vec)
template<class T >
void PLearn::compute_sign (const TVec< T > &vec, const TVec< T > &dest)
template<class T >
bool PLearn::sortedVectorsIntersect (const TVec< T > &v1, const TVec< T > &v2)
 v1 and v2 have their elements in increasing order.
template<class T >
real PLearn::one_against_all_hinge_loss (const TVec< T > &output, const int target)
template<class T >
void PLearn::one_against_all_hinge_loss_bprop (const TVec< T > &output, const int target, TVec< T > d_output)
template<class T >
void PLearn::softmax (const TVec< T > &x, const TVec< T > &y)
 y = softmax(x)
template<class T >
void PLearn::softmaxMinus (const TVec< T > &x, const TVec< T > &y)
 y = softmax(-x)
template<class T >
void PLearn::log_softmax (const TVec< T > &x, TVec< T > &y)
template<class T >
void PLearn::exp (const TVec< T > &x, TVec< T > &y)
 computes y <- exp(x)
template<class T >
PLearn::sumsquare (const TVec< T > &x)
 returns the sum of squared elements
template<class T >
PLearn::sumabs (const TVec< T > &x)
 returns the sum of absolute values of elements
template<class T >
void PLearn::squareElements (const TVec< T > &x)
 squares the elements of x in place
template<class T >
void PLearn::squareElements (const TMat< T > &m)
 squares the elements of m in place
template<class T >
PLearn::sumsquare (const TMat< T > &m)
 returns the sum of squared elements
template<class T >
PLearn::sumabs (const TMat< T > &m)
 returns the sum of absolute value of the elements
template<class T >
void PLearn::doubleCentering (const TMat< T > &mat, TVec< T > &avg, TMat< T > &res, T scale=T(1))
template<class T >
void PLearn::multiply (const TVec< T > &source1, T source2, TVec< T > &destination)
 destination = source1*source2
template<class T >
PLearn::sum (const TVec< T > &vec, bool ignore_missing)
 Sum of elements of a vector, which handles missing values.
template<class T >
PLearn::sum (const TVec< T > &vec)
 Sum of elements of a vector, which assumes all elements are non-missing (will return NAN if T = float or double and there is a missing value).
template<class T >
PLearn::sum_of_log (const TVec< T > &vec)
 Returns the sum of the log of the elements (this is also the log of the product of the elements but is more stable if you have very small elements).
template<class T >
PLearn::product (const TVec< T > &vec)
template<class T >
PLearn::mean (const TVec< T > &vec, bool ignore_missing=false)
 if ignore_missing==true, then the mean is computed by ignoring the possible MISSING_VALUE in the Vec.
template<class T >
PLearn::harmonic_mean (const TVec< T > &vec, bool ignore_missing=false)
template<class T >
PLearn::avgdev (const TVec< T > &vec, T meanval, bool ignore_missing=false)
template<class T >
PLearn::geometric_mean (const TVec< T > &vec)
template<class T >
PLearn::weighted_mean (const TVec< T > &vec, const TVec< T > &weights, bool ignore_missing=false)
template<class T >
PLearn::variance (const TVec< T > &vec, T meanval, bool ignore_missing=false)
template<class T >
PLearn::covariance (const TVec< T > &vec1, const TVec< T > &vec2, T mean1, T mean2)
template<class T >
PLearn::weighted_variance (const TVec< T > &vec, const TVec< T > &weights, T no_weighted_mean, T weighted_mean)
template<class T >
TVec< T > PLearn::histogram (const TVec< T > &vec, T minval, T maxval, int nbins)
template<class T >
PLearn::max (const TVec< T > &vec)
 Returns the maximum.
template<class T >
PLearn::max (const TVec< T > &vec, int &argmax)
 Returns the maximum and computes its index.
template<class T >
PLearn::min (const TVec< T > &vec)
 Returns the minimum.
template<class T >
PLearn::min (const TVec< T > &vec, int &argmin)
 Returns the minimum and computes its index.
template<class T >
PLearn::maxabs (const TVec< T > &vec)
 Returns the maximum in absolute value.
template<class T >
PLearn::maxabs (const TVec< T > &vec, int &argmax)
 Returns the maximum in absolute value and compute its index.
template<class T >
PLearn::minabs (const TVec< T > &vec)
 Returns the minimum in absolute value.
template<class T >
PLearn::minabs (const TVec< T > &vec, int &argmin)
 Returns the minimum in absolute value and compute its index.
template<class T >
int PLearn::argmax (const TVec< T > &vec)
template<class T >
int PLearn::argmax (const TVec< T > &vec, bool ignore_missing)
template<class T >
int PLearn::argmin (const TVec< T > &vec)
template<class T >
int PLearn::argmin (const TVec< T > &vec, bool ignore_missing)
template<class T >
PLearn::pownorm (const TVec< T > &vec, double n)
template<class T >
PLearn::pownorm (const TVec< T > &vec)
template<class T >
PLearn::norm (const TVec< T > &vec, double n)
template<class T >
PLearn::norm (const TVec< T > &vec)
template<class T >
void PLearn::normalize (const TVec< T > &vec, double n=2)
template<class T >
PLearn::powdistance (const TVec< T > &vec1, const TVec< T > &vec2, double n, bool ignore_missing=false)
 Compute ||vec1 - vec2||_n^n.
template<class T >
PLearn::powdistance (const TVec< T > &vec1, const TVec< T > &vec2)
template<class T >
PLearn::dist (const TVec< T > &vec1, const TVec< T > &vec2, double n)
template<class T >
PLearn::L2distance (const TVec< T > &vec1, const TVec< T > &vec2)
template<class T >
PLearn::L1distance (const TVec< T > &vec1, const TVec< T > &vec2)
template<class T >
PLearn::weighted_powdistance (const TVec< T > &vec1, const TVec< T > &vec2, double n, const TVec< T > &weights)
template<class T >
PLearn::weighted_distance (const TVec< T > &vec1, const TVec< T > &vec2, double n, const TVec< T > &weights)
template<class T >
void PLearn::operator+= (const TVec< T > &vec1, const TVec< T > &vec2)
 element-wise +
template<class T >
void PLearn::operator+= (const TVec< T > &vec, T scalar)
template<class T >
TVec< T > PLearn::operator- (const TVec< T > &vec)
template<class T >
void PLearn::operator-= (const TVec< T > &vec1, const TVec< T > &vec2)
template<class T >
void PLearn::operator-= (const TVec< T > &vec, T scalar)
template<class T >
void PLearn::operator*= (const TVec< T > &vec1, const TVec< T > &vec2)
template<class T >
void PLearn::operator*= (const TVec< T > &vec, T factor)
template<class T >
void PLearn::operator/= (const TVec< T > &vec1, const TVec< T > &vec2)
template<class T >
void PLearn::operator/= (const TVec< T > &vec, T scalar)
template<class T >
void PLearn::operator/= (const TVec< T > &vec, int scalar)
template<class T >
void PLearn::compute_log (const TVec< T > &src, const TVec< T > &dest)
template<class T >
TVec< T > PLearn::log (const TVec< T > &src)
template<class T >
void PLearn::compute_sqrt (const TVec< T > &src, const TVec< T > &dest)
template<class T >
TVec< T > PLearn::sqrt (const TVec< T > &src)
template<class T >
void PLearn::compute_safelog (const TVec< T > &src, const TVec< T > &dest)
template<class T >
TVec< T > PLearn::safelog (const TVec< T > &src)
template<class T >
void PLearn::compute_tanh (const TVec< T > &src, const TVec< T > &dest)
template<class T >
void PLearn::bprop_tanh (const TVec< T > &tanh_x, const TVec< T > &d_tanh_x, TVec< T > &d_x)
template<class T >
TVec< T > PLearn::tanh (const TVec< T > &src)
template<class T >
void PLearn::compute_fasttanh (const TVec< T > &src, const TVec< T > &dest)
template<class T >
TVec< T > PLearn::fasttanh (const TVec< T > &src)
template<class T >
void PLearn::compute_sigmoid (const TVec< T > &src, const TVec< T > &dest)
template<class T >
void PLearn::log_sigmoid (const TVec< T > &src, const TVec< T > &dest)
template<class T >
TVec< T > PLearn::sigmoid (const TVec< T > &src)
template<class T >
void PLearn::compute_fastsigmoid (const TVec< T > &src, const TVec< T > &dest)
template<class T >
TVec< T > PLearn::fastsigmoid (const TVec< T > &src)
template<class T >
void PLearn::compute_inverse_sigmoid (const TVec< T > &src, const TVec< T > &dest)
template<class T >
TVec< T > PLearn::inverse_sigmoid (const TVec< T > &src)
template<class T >
void PLearn::negateElements (const TVec< T > &vec)
template<class T >
void PLearn::invertElements (const TVec< T > &vec)
template<class T >
TVec< T > PLearn::inverted (const TVec< T > &vec)
template<class T >
PLearn::dot (const TVec< T > &vec1, const TVec< T > &vec2)
template<class V , class T , class U >
PLearn::dot (const TVec< T > &vec1, const TVec< U > &vec2)
 Special dot product that allows TVec's of different types, as long as operator*(T,U) is defined.
template<class T >
PLearn::dot (const TMat< T > &m1, const TMat< T > &m2)
template<class T >
TVec< T > PLearn::operator- (const TVec< T > &v1, const TVec< T > &v2)
template<class T >
TVec< T > PLearn::operator- (T v1, const TVec< T > &v2)
template<class T >
TVec< T > PLearn::operator- (const TVec< T > &v1, T v2)
template<class T >
TVec< T > PLearn::operator+ (const TVec< T > &v1, const TVec< T > &v2)
template<class T >
TVec< T > PLearn::operator+ (T v1, const TVec< T > &v2)
template<class T >
TVec< T > PLearn::operator+ (const TVec< T > &v1, T v2)
template<class T >
TVec< T > PLearn::operator% (const TVec< T > &v1, const TVec< T > &v2)
template<class T >
TVec< T > PLearn::operator* (T scalar, const TVec< T > &v)
template<class T >
TVec< T > PLearn::operator* (const TVec< T > &v1, T v2)
template<class T >
TVec< T > PLearn::operator/ (const TVec< T > &v1, const TVec< T > &v2)
template<class T >
TVec< T > PLearn::operator/ (T v1, const TVec< T > &v2)
template<class T1 , class T2 >
TVec< T1 > PLearn::operator/ (const TVec< T1 > &v1, T2 scalar)
template<class T >
PLearn::logadd (const TVec< T > &vec)
template<class T >
PLearn::output_margin (const TVec< T > &class_scores, int correct_class)
template<class T >
void PLearn::fill_one_hot (const TVec< T > &vec, int hotpos, T coldvalue, T hotvalue)
template<class T >
TVec< T > PLearn::one_hot (int length, int hotpos, T coldvalue, T hotvalue)
template<class T >
TVec< T > PLearn::square (const TVec< T > &vec)
template<class T >
void PLearn::square (TVec< T > &result, const TVec< T > &vec)
template<class T >
TVec< T > PLearn::squareroot (const TVec< T > &vec)
template<class T >
TVec< T > PLearn::remove_missing (const TVec< T > &vec)
 @ return a new array that contain only the non-missing value @ see remove_missing_inplace for inplace version
template<class T >
void PLearn::remove_missing_inplace (TVec< T > &v)
 remove all missing value inplace while keeping the order
template<class T , class U , class V >
TVec< U > PLearn::apply (const TVec< T > &vec, U(*func)(V))
 Transform a vector of T into a vector of U through a unary function.
template<class T , class U >
void PLearn::apply (const TVec< T > &source, TVec< U > &destination, U(*func)(T))
 Transform a vector of T into a vector of U through a unary function.
template<class T , class U , class V >
void PLearn::apply (const TVec< T > &src1, const TVec< U > &src2, TVec< V > &dest, V(*func)(T, U))
 Transform a vector of T and a vector of U into a vector of V, through a binary function.
template<class T >
void PLearn::multiply (const TVec< T > &source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::multiplyAdd (const TVec< T > &source1, const TVec< T > &source2, T source3, TVec< T > &destination)
template<class T >
void PLearn::multiplyScaledAdd (const TVec< T > &source, T a, T b, const TVec< T > &destination)
template<class T >
void PLearn::multiplyScaledAdd (const TMat< T > &source, T a, T b, const TMat< T > &destination)
template<class T >
void PLearn::add (const TVec< T > &source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::add (const TVec< T > &source1, T source2, TVec< T > &destination)
template<class T >
void PLearn::substract (const TVec< T > &source1, T source2, TVec< T > &destination)
template<class T >
void PLearn::substract (const TVec< T > &source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::substractAcc (const TVec< T > &source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::substract (T source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::divide (const TVec< T > &source1, T source2, TVec< T > &destination)
template<class T >
void PLearn::divide (const TVec< T > &source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::divide (T source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::max (const TVec< T > &source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::max (const TVec< T > &source1, T source2, TVec< T > &destination)
template<class T >
void PLearn::min (const TVec< T > &source1, const TVec< T > &source2, TVec< T > &destination)
template<class T >
void PLearn::min (const TVec< T > &source1, T source2, TVec< T > &destination)
template<class T >
TVec< T > PLearn::softmax (const TVec< T > &x)
template<class T >
void PLearn::tanh (const TVec< T > &x, TVec< T > &y)
template<class T >
TVec< T > PLearn::exp (const TVec< T > &vec)
template<class T >
TVec< T > PLearn::nonZeroIndices (TVec< T > v)
template<class T >
TVec< T > PLearn::nonZeroIndices (TVec< bool > v)
template<class T >
void PLearn::complement_indices (TVec< T > &indices, int n, TVec< T > &complement_indices, TVec< T > &buffer)
template<class T >
void PLearn::equals (const TVec< T > &src, T v, TVec< T > &dest)
template<class T >
void PLearn::isLargerThan (const TVec< T > &first, const TVec< T > &second, TVec< T > &dest)
template<class T >
void PLearn::isLargerThanOrEqualTo (const TVec< T > &first, const TVec< T > &second, TVec< T > &dest)
template<class T >
void PLearn::isSmallerThan (const TVec< T > &first, const TVec< T > &second, TVec< T > &dest)
template<class T >
void PLearn::isSmallerThanOrEqualTo (const TVec< T > &first, const TVec< T > &second, TVec< T > &dest)
template<class T >
void PLearn::ifThenElse (const TVec< T > &if_vec, const TVec< T > &then_vec, const TVec< T > &else_vec, TVec< T > &dest)
template<class T >
int PLearn::vec_counts (const TVec< T > &src, T value)
template<class T >
int PLearn::vec_find (const TVec< T > &src, T f)
template<class T >
PLearn::estimatedCumProb (T x, TVec< T > bins)
template<class T >
int PLearn::positionOfkthOrderedElement (const TVec< T > &vec, int k)
template<class T >
PLearn::kthOrderedElement (const TVec< T > &vec, int k)
 returns the value of the kth ordered element of v k can take values 0 to vec.length()-1
template<class T >
PLearn::median (const TVec< T > &vec)
 Return the median value of vector.
template<class T >
PLearn::selectAndOrder (const TVec< T > &vec, int pos)
 find the element at position pos that would result from a sort and put all elements (not in order!) lower than v[pos] in v[i<pos].
template<class T >
TVec< T > PLearn::getQuantiles (const TVec< T > &vec, int q)
template<class T >
TVec< T > PLearn::nonZero (const TVec< T > &vec)
 returns a vector composed of the values of v that are different from 0;
template<class T >
TVec< T > PLearn::positiveValues (const TVec< T > &vec)
 returns a vector composed of the values of v that are greater than 0;
template<class T >
int PLearn::positionOfClosestElement (const TVec< T > &vec, const T &value, bool is_sorted_vec=false)
template<class T >
void PLearn::projectOnOrthogonalSubspace (const TVec< T > &vec, const TMat< T > &orthonormal_subspace)
template<class T >
void PLearn::multiplyAcc (const TVec< T > &vec, const TVec< T > &x, T scale)
 vec[i] += x[i]*scale;
template<class T >
void PLearn::exponentialMovingAverageUpdate (const TVec< T > &vec, const TVec< T > &x, T alpha)
 TVec[i] = (1-alpha)*TVec[i]+x[i]*alpha;.
template<class T >
void PLearn::exponentialMovingVarianceUpdate (const TVec< T > &vec, const TVec< T > &x, const TVec< T > &mu, T alpha)
 TVec[i] = (1-alpha)*TVec[i]+(x[i]-mu[i])^2*alpha;.
template<class T >
void PLearn::exponentialMovingSquareUpdate (const TVec< T > &vec, const TVec< T > &x, T alpha)
 TVec[i] = (1-alpha)*TVec[i]+x[i]^2*alpha;.
template<class T >
void PLearn::multiplyAcc (const TVec< T > &vec, const TVec< T > &x, const TVec< T > &y)
 vec[i] += x[i]*y[i];
template<class T >
void PLearn::squareMultiplyAcc (const TVec< T > &vec, const TVec< T > &x, T scale)
 TVec[i] += x[i]*x[i]*scale;.
template<class T >
void PLearn::squareAcc (const TVec< T > &vec, const TVec< T > &x)
 TVec[i] += x[i]*x[i];.
template<class T >
void PLearn::squareSubtract (const TVec< T > &vec, const TVec< T > &x)
 Tvec[i] -= x[i]*x[i];.
template<class T >
void PLearn::diffSquareMultiplyAcc (const TVec< T > &vec, const TVec< T > &x, const TVec< T > &y, T scale)
 TVec[i] += (x[i]-y[i])^2*scale;.
template<class T >
void PLearn::diffSquareMultiplyScaledAcc (const TVec< T > &vec, const TVec< T > &x, const TVec< T > &y, T fact1, T fact2)
 TVec[i] = TVec[i]*fact1 + (x[i]-y[i])^2*fact2;.
template<class T >
void PLearn::product (const TVec< T > &result, const TMat< T > &m, const TVec< T > &v)
 result[i] = sum_j m[i,j] * v[j]
template<class T >
void PLearn::productAcc (const TVec< T > &result, const TMat< T > &m, const TVec< T > &v)
 result[i] += sum_j m[i,j] * v[j]
template<class T >
void PLearn::productScaleAcc (const TVec< T > &result, const TMat< T > &m, bool transpose_m, const TVec< T > &v, T alpha, T beta)
 result[i] = alpha * sum_j m[i,j] * v[j] + beta * v[i] (Will use the transpose of m if transpose_m is true)
template<class T >
void PLearn::productScaleAcc (const TVec< T > &result, const TMat< T > &m, const TVec< T > &v, T alpha, T beta)
 result[i] = alpha * sum_j m[i,j] * v[j] + beta * v[i]
template<class T >
void PLearn::transposeProduct (const TVec< T > &result, const TMat< T > &m, const TVec< T > &v)
 result[i] = sum_j m[j,i] * v[j] Equivalently: rowvec(result) = rowvec(v) .
template<class T >
void PLearn::transposeProductAcc (const TVec< T > &result, const TMat< T > &m, const TVec< T > &v)
 result[i] += sum_j m[j,i] * v[j]
template<class T >
void PLearn::transposeProductScaleAcc (const TVec< T > &result, const TMat< T > &m, const TVec< T > &v, T alpha, T beta)
 result[i] = alpha * sum_j m[j,i] * v[j] + beta * result[i]
template<class T >
void PLearn::diagonalizedFactorsProduct (TMat< T > &result, const TMat< T > &U, const TVec< T > d, const TMat< T > V, bool accumulate=false)
 return the matrix with elements (i,j) = sum_k U_{ik} d_k V_{kj}
template<class T >
void PLearn::diagonalizedFactorsProductBprop (const TMat< T > &dCdresult, const TMat< T > &U, const TVec< T > d, const TMat< T > V, TMat< T > &dCdU, TVec< T > &dCdd, TMat< T > &dCdV)
 GIVEN that res(i,j) = sum_k U_{ik} d_k V_{kj}, and given dC/dres, U,d and V, accumulate gradients on dC/dU, dC/dd and dC/dV: dC/dU[i,k] += sum_j dC/dres[i,j] d_k V[k,j] dC/dd[k] += sum_{ij} dC/dres[i,j] U[i,k] V[k,j] dC/dV[k,j] += d_k * sum_i U[i,k] dC/dres[i,j].
template<class T >
void PLearn::diagonalizedFactorsProductTranspose (TMat< T > &result, const TMat< T > &U, const TVec< T > d, const TMat< T > V, bool accumulate=false)
 return the matrix with elements (i,j) = sum_k U_{ik} d_k V_{jk}
template<class T >
void PLearn::diagonalizedFactorsProductTransposeBprop (const TMat< T > &dCdresult, const TMat< T > &U, const TVec< T > d, const TMat< T > V, TMat< T > &dCdU, TVec< T > &dCdd, TMat< T > &dCdV)
template<class T >
void PLearn::diagonalizedFactorsTransposeProduct (TMat< T > &result, const TMat< T > &U, const TVec< T > d, const TMat< T > V, bool accumulate=false)
 return the matrix with elements (i,j) = sum_k U_{ki} d_k V_{kj}
template<class T >
void PLearn::diagonalizedFactorsTransposeProductBprop (const TMat< T > &dCdresult, const TMat< T > &U, const TVec< T > d, const TMat< T > V, TMat< T > &dCdU, TVec< T > &dCdd, TMat< T > &dCdV)
template<class T >
void PLearn::diagonalizedFactorsTransposeProductTranspose (TMat< T > &result, const TMat< T > &U, const TVec< T > d, const TMat< T > V, bool accumulate=false)
 return the matrix with elements (i,j) = sum_k U_{ki} d_k V_{jk}
template<class T >
void PLearn::diagonalizedFactorsTransposeProductTransposeBprop (const TMat< T > &dCdresult, const TMat< T > &U, const TVec< T > d, const TMat< T > V, TMat< T > &dCdU, TVec< T > &dCdd, TMat< T > &dCdV)
template<class T >
PLearn::matRowDotVec (const TMat< T > &mat, int i, const TVec< T > v)
 return dot product of i-th row with vector v
template<class T >
PLearn::matColumnDotVec (const TMat< T > &mat, int j, const TVec< T > v)
 return dot product of j-th column with vector v
template<class T >
void PLearn::matRowsDots (TVec< T > v, const TMat< T > &A, const TMat< T > &B)
 return dot products of i-th row of A with i-th row of B in vector v
template<class T >
void PLearn::matRowsDotsAcc (TVec< T > v, const TMat< T > &A, const TMat< T > &B)
 return dot products of i-th row of A with i-th row of B in vector v
template<class T >
void PLearn::fillItSymmetric (const TMat< T > &mat)
 Fill the bottom left part of a matrix with its top right part, so that it becomes symmetric.
template<class T >
void PLearn::makeItSymmetric (const TMat< T > &mat, T max_dif)
template<class T >
void PLearn::product (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
 mat[i,j] = sum_k m1[i,k] * m2[k,j]
template<class T >
void PLearn::productAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
 mat[i,j] += sum_k m1[i,k] * m2[k,j]
template<class T >
void PLearn::productScaleAcc (const TMat< T > &mat, const TMat< T > &m1, bool transpose_m1, const TMat< T > &m2, bool transpose_m2, T alpha, T beta)
 mat[i,j] = alpha sum_k m1[i,k] * m2[k,j] + beta mat[i,j]
template<class T >
void PLearn::productScaleAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2, T alpha, T beta)
 mat[i,j] = alpha * sum_k m1[i,k] * m2[k,j] + beta * mat[i,j]
template<class T >
void PLearn::product2Acc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::squareProductAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::externalProduct (const TMat< T > &mat, const TVec< T > &v1, const TVec< T > &v2)
template<class T >
void PLearn::externalProductAcc (const TMat< T > &mat, const TVec< T > &v1, const TVec< T > &v2)
template<class T >
void PLearn::externalProductScaleAcc (const TMat< T > &mat, const TVec< T > &v1, const TVec< T > &v2, T gamma)
template<class T >
void PLearn::externalProductScaleAcc (const TMat< T > &mat, const TVec< T > &v1, const TVec< T > &v2, T gamma, T alpha)
template<class T >
void PLearn::externalProductMultUpdate (const TMat< T > &mat, const TVec< T > &v1, const TVec< T > &v2)
template<class T >
void PLearn::externalProductDivUpdate (const TMat< T > &mat, const TVec< T > &v1, const TVec< T > &v2)
template<class T >
void PLearn::productTranspose (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
 mat[i,j] = sum_k m1[i,k] * m2[j,k]
template<class T >
void PLearn::squareProductTranspose (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::product2Transpose (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::productTransposeAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
 mat[i,j] += sum_k m1[i,k] * m2[j,k]
template<class T >
void PLearn::productTransposeScaleAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2, T alpha, T beta)
 mat[i,j] = alpha * sum_k m1[i,k] * m2[j,k] + beta * mat[i,j]
template<class T >
void PLearn::product2TransposeAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::squareProductTransposeAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::transposeProduct (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
 mat[i,j] = sum_k m1[k,i] * m2[k,j]
template<class T >
void PLearn::transposeProduct2 (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::transposeProductAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
 mat[i,j] += sum_k m1[k,i] * m2[k,j]
template<class T >
void PLearn::transposeProductScaleAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2, T alpha, T beta)
template<class T >
void PLearn::transposeProduct2Acc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::transposeTransposeProduct (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
 mat[i,j] = sum_k m1[k,i] * m2[j,k]
template<class T >
void PLearn::transposeTransposeProductAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2)
 mat[i,j] += sum_k m1[k,i] * m2[j,k]
template<class T >
void PLearn::transposeTransposeProductScaleAcc (const TMat< T > &mat, const TMat< T > &m1, const TMat< T > &m2, T alpha, T beta)
 mat[i,j] = alpha * sum_k m1[k,i] * m2[j,k] + beta * mat[i,j]
template<class T >
PLearn::trace (const TMat< T > &mat)
template<class T >
void PLearn::regularizeMatrix (const TMat< T > &mat, T tolerance)
 Applies a regularizer : diag(A) += (tolerance * trace(A))
template<class T >
void PLearn::makeRowsSumTo1 (const TMat< T > &mat)
template<class T >
void PLearn::multiply (const TMat< T > &result, const TMat< T > &x, T scale)
template<class T >
void PLearn::multiply (TMat< T > &result, const TMat< T > &x, const TVec< T > &y, bool transpose=false)
template<class T >
TMat< T > PLearn::operator* (const TMat< T > &m, const T &scalar)
template<class T >
TMat< T > PLearn::operator* (const T &scalar, const TMat< T > &m)
template<class T >
TMat< T > PLearn::operator/ (const TMat< T > &m, const T &scalar)
template<class T >
void PLearn::multiplyAcc (const TMat< T > &mat, const TMat< T > &x, T scale)
template<class T >
void PLearn::multiplyAcc (const TMat< T > &mat, const TMat< T > &x, const TMat< T > &y)
template<class T >
void PLearn::squareMultiplyAcc (const TMat< T > &mat, const TMat< T > &x, T scale)
template<class T >
void PLearn::diffSquareMultiplyAcc (const TMat< T > &mat, const TMat< T > &x, const TMat< T > &y, T scale)
template<class T >
void PLearn::swapRows (const TMat< T > &mat, int i, int j)
 Swap rows i and j in matrix 'mat'.
template<class T >
TVec< T > PLearn::selectAndOrder (const TMat< T > &mat, int pos, int colnum=0)
template<class T >
void PLearn::addToDiagonal (const TMat< T > &mat, T lambda)
template<class T >
void PLearn::addToDiagonal (const TMat< T > &mat, const TVec< T > &lambda)
template<class T >
void PLearn::fillDiagonal (const TMat< T > &mat, T val)
 Fill diagonal with the specified value.
template<class T >
void PLearn::fillDiagonal (const TMat< T > &mat, const TVec< T > &v)
 Fill diagonal with the specified vector.
template<class T >
void PLearn::diag (const TMat< T > &mat, const TVec< T > &d)
 Copy diagonal of mat in d (which must have correct size)
template<class T >
TVec< T > PLearn::diag (const TMat< T > &mat)
template<class T >
void PLearn::diagonalOfSquare (const TMat< T > &mat, const TVec< T > &d)
template<class T >
void PLearn::projectOnOrthogonalSubspace (const TMat< T > &mat, TMat< T > orthonormal_subspace)
template<class T >
void PLearn::averageAcrossRowsAndColumns (const TMat< T > &mat, TVec< T > &avg_across_rows, TVec< T > &avg_across_columns, bool ignored)
template<class T >
void PLearn::addToRows (const TMat< T > &mat, const TVec< T > row, bool ignored)
template<class T >
void PLearn::addToColumns (const TMat< T > &mat, const TVec< T > col, bool ignored)
template<class T >
void PLearn::substractFromRows (const TMat< T > &mat, const TVec< T > row, bool ignored)
template<class T >
void PLearn::substractFromColumns (const TMat< T > &mat, const TVec< T > col, bool ignored)
template<class T >
void PLearn::addToMat (const TMat< T > &mat, T scalar, bool ignored)
template<class T >
PLearn::sum (const TMat< T > &mat, bool ignore_missing)
 Sum of elements of a matrix, which handles missing values.
template<class T >
PLearn::sum (const TMat< T > &mat)
 Sum of elements of a matrix, which assumes all elements are non-missing (will return NAN if T = float or double and there is a missing value).
template<class T >
PLearn::product (const TMat< T > &mat)
template<class T >
PLearn::sum_of_squares (const TMat< T > &mat)
template<class T >
PLearn::mean (const TMat< T > &mat)
template<class T >
PLearn::geometric_mean (const TMat< T > &mat)
template<class T >
PLearn::variance (const TMat< T > &mat, T meanval)
template<class T >
PLearn::correlation (const TMat< T > &mat)
template<class T >
PLearn::correlation (const TVec< T > &x, const TVec< T > &y)
template<class T >
PLearn::min (const TMat< T > &mat)
 Returns the minimum.
template<class T >
PLearn::min (const TMat< T > &mat, int &min_i, int &min_j)
 Returns the minimum and computes its position.
template<class T >
PLearn::max (const TMat< T > &mat)
 Returns the maximum.
template<class T >
PLearn::max (const TMat< T > &mat, int &max_i, int &max_j)
 Returns the maximum and computes its position.
template<class T >
PLearn::minabs (const TMat< T > &mat)
 Returns the minimum in absolute value.
template<class T >
PLearn::minabs (const TMat< T > &mat, int &min_i, int &min_j)
 Returns the minimum in absolute value and computes its position.
template<class T >
PLearn::maxabs (const TMat< T > &mat)
 Returns the maximum in absolute value.
template<class T >
PLearn::maxabs (const TMat< T > &mat, int &max_i, int &max_j)
 Returns the maximum in absolute value and computes its position.
template<class T >
void PLearn::argmin (const TMat< T > &mat, int &mini, int &minj)
 Stores the position of the min in the 'mini' & 'minj' arg.
template<class T >
void PLearn::argmax (const TMat< T > &mat, int &maxi, int &maxj)
template<class T >
int PLearn::argmin (const TMat< T > &m)
 return mini*width+minj
template<class T >
int PLearn::argmax (const TMat< T > &m)
 return maxi*width+maxj
template<class T >
void PLearn::rowSum (const TMat< T > &mat, const TMat< T > &singlecolumn)
template<class T >
void PLearn::rowSumAcc (const TMat< T > &mat, const TMat< T > &singlecolumn)
template<class T >
void PLearn::rowSum (const TMat< T > &mat, const TVec< T > &colvec)
template<class T >
void PLearn::rowMean (const TMat< T > &mat, const TMat< T > &singlecolumn)
template<class T >
void PLearn::rowVariance (const TMat< T > &mat, const TMat< T > &singlecolumn, const TMat< T > &rowmean)
template<class T >
void PLearn::rowSumOfSquares (const TMat< T > &mat, const TMat< T > &singlecolumn)
template<class T >
void PLearn::rowMax (const TMat< T > &mat, const TMat< T > &singlecolumn)
template<class T >
void PLearn::rowMax (const TMat< T > &mat, const TVec< T > &colvec)
template<class T >
void PLearn::rowMin (const TMat< T > &mat, const TMat< T > &singlecolumn)
template<class T >
void PLearn::rowMin (const TMat< T > &mat, const TVec< T > &colvec)
template<class T >
void PLearn::rowArgmax (const TMat< T > &mat, const TMat< T > &singlecolumn)
template<class T >
void PLearn::rowArgmin (const TMat< T > &mat, const TMat< T > &singlecolumn)
template<class T >
void PLearn::columnSum (const TMat< T > &mat, TVec< T > &result)
template<class T >
void PLearn::columnSumOfSquares (const TMat< T > &mat, TVec< T > &result)
template<class T >
void PLearn::columnMean (const TMat< T > &mat, TVec< T > &result)
template<class T >
void PLearn::columnWeightedMean (const TMat< T > &mat, TVec< T > &result)
template<class T >
void PLearn::columnVariance (const TMat< T > &mat, TVec< T > &result, const TVec< T > &columnmean)
template<class T >
void PLearn::columnWeightedVariance (const TMat< T > &mat, TVec< T > &result, const TVec< T > &column_weighted_mean)
template<class T >
void PLearn::columnMax (const TMat< T > &mat, TVec< T > &result)
template<class T >
void PLearn::columnMin (const TMat< T > &mat, TVec< T > &result)
template<class T >
void PLearn::columnArgmax (const TMat< T > &mat, TVec< T > &result)
template<class T >
void PLearn::columnArgmin (const TMat< T > &mat, TVec< T > &result)
template<class T >
PLearn::mahalanobis_distance (const TVec< T > &input, const TVec< T > &meanvec, const TMat< T > &inversecovmat)
template<class T >
void PLearn::computeMean (const TMat< T > &m, TVec< T > &meanvec)
 compute the mean of the rows of m (looping over columns)
template<class T >
void PLearn::computeMeanAndVariance (const TMat< T > &m, TVec< T > &meanvec, TVec< T > &variancevec)
 compute the mean and variance of the rows of m (looping over columns)
template<class T >
void PLearn::computeInverseStandardDeviationFromMeanAndSquareMean (const TMat< T > &inverse_standard_deviation, const TMat< T > &means, const TMat< T > &mean_of_squares, real default_stddev=1, real min_stddev=-1)
 inverse_standard_deviation[i,j] = 1/sqrt(mean_of_squares[i,j] - means[i,j]^2) If 'min_stddev' is provided, any standard deviation less than this value will be set to 'default_stddev' without any warning being issued (even when a negative variance is encountered, which can happen because of numerical approximation for an almost constant variable).
template<class T >
void PLearn::computeCovar (const TMat< T > &m, const TVec< T > &meanvec, TMat< T > &covarmat)
template<class T >
void PLearn::computeMeanAndCovar (const TMat< T > &m, TVec< T > &meanvec, TMat< T > &covarmat)
template<class T >
void PLearn::computeMeanAndStddev (const TMat< T > &m, TVec< T > &meanvec, TVec< T > &stddevvec)
 compute the mean and standard deviations of the rows of m (looping over columns)
template<class T >
void PLearn::computeColumnsMeanAndStddev (const TMat< T > &m, TMat< T > &meanvec, TMat< T > &stddevvec)
 compute the mean and standard deviations of the colums of m (looping over s) (the result is stored in column vectors meanvec and stddevvec)
template<class T >
void PLearn::normalize (TMat< T > &m)
 substract mean, and divide by stddev (these are estimated globally)
template<class T >
void PLearn::normalizeRows (const TMat< T > &m)
 Divides each row by the sum of its elements.
template<class T >
void PLearn::normalizeColumns (const TMat< T > &m)
 Divides each column by the sum of its elements.
template<class T >
void PLearn::normalize (TMat< T > &m, double n)
 divide each row by its n norm
template<class T >
void PLearn::operator+= (const TMat< T > &m, T scalar)
template<class T >
void PLearn::operator*= (const TMat< T > &m, T scalar)
template<class T >
void PLearn::operator-= (const TMat< T > &m, T scalar)
template<class T >
void PLearn::operator/= (const TMat< T > &m, T scalar)
template<class T >
void PLearn::operator/= (const TMat< T > &m, int scalar)
template<class T >
void PLearn::operator+= (const TMat< T > &m, const TVec< T > &v)
 adds v to every row
template<class T >
void PLearn::operator-= (const TMat< T > &m, const TVec< T > &v)
 subtracts v from every row
template<class T >
void PLearn::operator*= (const TMat< T > &m, const TVec< T > &v)
 does an elementwise multiplication of every row by v
template<class T >
void PLearn::operator*= (const TMat< T > &m1, const TMat< T > &m2)
 does an elementwise multiplication
template<class T >
void PLearn::operator/= (const TMat< T > &m, const TVec< T > &v)
template<class T >
void PLearn::operator/= (const TMat< T > &m1, const TMat< T > &m2)
 does an elementwise division
template<class T >
void PLearn::operator+= (const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::operator-= (const TMat< T > &m1, const TMat< T > &m2)
template<class T >
TMat< T > PLearn::operator- (const TMat< T > &m1, const TMat< T > &m2)
template<class T >
TMat< T > PLearn::operator+ (const TMat< T > &m1, const TMat< T > &m2)
template<class T >
void PLearn::substract (const TMat< T > &m1, const TMat< T > &m2, TMat< T > &destination)
template<class T >
void PLearn::add (const TMat< T > &m1, const TMat< T > &m2, TMat< T > &destination)
template<class T >
TMat< T > PLearn::operator- (const TMat< T > &m)
 return a negated copy of m
template<class T >
void PLearn::negateElements (const TMat< T > &m)
 x'_ij = -x_ij;
template<class T >
void PLearn::invertElements (const TMat< T > &m)
 x'_ij = 1.0/x_ij;
template<class T >
TMat< T > PLearn::leftPseudoInverse (TMat< T > &m)
template<class T >
void PLearn::leftPseudoInverse (const TMat< T > &m, TMat< T > &inv)
template<class T >
TMat< T > PLearn::rightPseudoInverse (TMat< T > &m)
template<class T >
void PLearn::rightPseudoInverse (const TMat< T > &m, TMat< T > &inv)
template<class T >
TMat< T > PLearn::inverse (TMat< T > &m)
template<class T >
void PLearn::inverse (const TMat< T > &m, TMat< T > &inv)
template<class T >
void PLearn::solveLinearSystemByCholesky (const TMat< T > &A, const TMat< T > &B, TMat< T > &X, TMat< T > *pL=0, TVec< T > *py=0)
template<class T >
void PLearn::solveTransposeLinearSystemByCholesky (const TMat< T > &A, const TMat< T > &B, TMat< T > &X, TMat< T > *pL=0, TVec< T > *py=0)
template<class T >
void PLearn::choleskyDecomposition (const TMat< T > &A, TMat< T > &L)
template<class T >
void PLearn::bpropCholeskyDecomposition (const TMat< T > &A, const TMat< T > &L, TMat< T > &dC_dA, TMat< T > &dC_dL)
template<class T >
void PLearn::choleskyLeftSolve (const TMat< T > &L, const TVec< T > &b, const TVec< T > &y)
template<class T >
void PLearn::choleskyRightSolve (const TMat< T > &L, TVec< T > &y, TVec< T > &x)
template<class T >
void PLearn::choleskySolve (const TMat< T > &L, TVec< T > b, TVec< T > x, TVec< T > &y)
template<class T >
void PLearn::choleskySolve (const TMat< T > &L, const TMat< T > &B, TMat< T > &X, TVec< T > &y)
template<class T >
void PLearn::bpropCholeskySolve (const TMat< T > &L, const TVec< T > &x, const TVec< T > &y, TMat< T > &dC_dL, TVec< T > &dC_db, TVec< T > &dC_dx)
template<class T >
real PLearn::choleskyInvert (const TMat< T > &A, TMat< T > &Ainv)
template<class T >
TVec< T > PLearn::choleskySolve (const TMat< T > &A, const TVec< T > &b)
template<class T >
TMat< T > PLearn::choleskyInvert (const TMat< T > &A)
template<class T >
void PLearn::LU_decomposition (TMat< T > &A, TVec< T > &Trow, int &detsign, TVec< T > *p=0)
template<class T >
PLearn::det (const TMat< T > &A, bool log_det=false)
 Return the determinant of A, using LU decomposition.
template<class T >
PLearn::det (const TMat< T > &LU, int detsign, bool log_det=false)
 Return the determinant of A, whose LU decomposition is given ('detsign' is as set by the LU_decomposition(..) function).
template<class T >
void PLearn::equals (const TMat< T > &src, T v, TMat< T > &dest)
template<class T >
void PLearn::transpose (const TMat< T > src, TMat< T > dest)
template<class T >
TMat< T > PLearn::transpose (const TMat< T > &src)
template<class T , class U >
void PLearn::apply (U(*func)(T), const TMat< T > &source, TMat< U > &destination)
 Transform a matrix of T into a matrix of U through a unary function.
template<class T , class U >
void PLearn::apply (const TMat< T > &source, TMat< U > &destination, U(*func)(T))
 Transform a matrix of T into a matrix of U through a unary function Same as above, for coherence with TVec<T>'s notation.
template<class T >
void PLearn::apply (T(*func)(const TVec< T > &), const TMat< T > &m, TMat< T > &dest)
template<class T >
void PLearn::apply (T(*func)(const TVec< T > &, const TVec< T > &), const TMat< T > &m1, const TMat< T > &m2, TMat< T > &dest)
template<class T >
void PLearn::linearRegressionNoBias (TMat< T > inputs, TMat< T > outputs, T weight_decay, TMat< T > weights)
template<class T >
void PLearn::linearRegression (TMat< T > inputs, TMat< T > outputs, T weight_decay, TMat< T > theta_t)
template<class T >
void PLearn::linearRegression (TVec< T > inputs, TVec< T > outputs, T weight_decay, TVec< T > theta_t)
template<class T >
TMat< T > PLearn::smooth (TMat< T > data, int windowsize)
template<class T >
TMat< T > PLearn::square (const TMat< T > &m)
template<class T >
TMat< T > PLearn::sqrt (const TMat< T > &m)
template<class T >
void PLearn::affineMatrixInitialize (TMat< T > W, bool output_on_columns=true, real scale=1.0)
template<class T >
TMat< T > PLearn::grep (TMat< T > data, int col, TVec< T > values, bool exclude=false)
template<class T >
void PLearn::convolve (TMat< T > m, TMat< T > mask, TMat< T > result)
template<class T >
void PLearn::subsample (TMat< T > m, int thesubsamplefactor, TMat< T > result)
template<class T >
void PLearn::classification_confusion_matrix (TMat< T > outputs, TMat< T > target_classes, TMat< T > confusion_matrix)
template<class T >
int PLearn::GramSchmidtOrthogonalization (TMat< T > A, T tolerance=1e-6)
 Orthonormalize in-place the rows of the given matrix, using successive projections on the orthogonal subspace of the previously found basis.
template<class T >
TVec< T > PLearn::product (const TMat< T > &m, const TVec< T > &v)
 products
template<class T >
TVec< T > PLearn::transposeProduct (const TMat< T > &m, const TVec< T > &v)
 return m' x v
template<class T >
TMat< T > PLearn::product (const TMat< T > &m1, const TMat< T > &m2)
 return m1 x m2
template<class T >
TMat< T > PLearn::transposeProduct (const TMat< T > &m1, const TMat< T > &m2)
 return m1' x m2
template<class T >
TMat< T > PLearn::productTranspose (const TMat< T > &m1, const TMat< T > &m2)
 return m1 x m2'
template<class T >
TMat< T > PLearn::operator+ (const TMat< T > &m, const TVec< T > &v)
 return m + v (added to every ROW of m)
template<class T >
TMat< T > PLearn::operator- (const TMat< T > &m, const TVec< T > &v)
 return m - v (subtracted from every ROW of m)
template<class T >
TMat< T > PLearn::operator* (const TMat< T > &m, const TVec< T > &v)
 does an elementwise multiplication of every row by v
template<class T >
TMat< T > PLearn::operator/ (const TMat< T > &m, const TVec< T > &v)
 elementwise division of every row by v
template<class T >
TMat< T > PLearn::operator/ (const TMat< T > &m1, const TMat< T > &m2)
 elementwise division of every row by v
template<class T >
void PLearn::choleskySolve (const TMat< T > &L, TVec< T > b, TVec< T > x)
template<class T >
TMat< T > PLearn::grep (TMat< T > data, int col, T value, bool exclude=false)
 Same as above, but with a single value argument.
template<class T >
void PLearn::addIfNonMissing (const TVec< T > &source, const TVec< int > &nnonmissing, TVec< T > destination)
template<class T >
void PLearn::addXandX2IfNonMissing (const TVec< T > &source, const TVec< int > &nnonmissing, TVec< T > somme, TVec< T > somme2)
template<class T >
void PLearn::layerBpropUpdate (TVec< T > input_gradient, TMat< T > weights, const TVec< T > &input, const TVec< T > &output_gradient, real learning_rate)
template<class T >
void PLearn::layerL2BpropUpdate (TVec< T > input_gradient, TMat< T > weights, const TVec< T > &input, const TVec< T > &output_gradient, real learning_rate, T weight_decay)
template<class T >
void PLearn::transposedLayerL2BpropUpdate (TVec< T > input_gradient, TMat< T > weights, const TVec< T > &input, const TVec< T > &output_gradient, real learning_rate, T weight_decay)
template<class T >
void PLearn::layerL1BpropUpdate (TVec< T > input_gradient, TMat< T > weights, const TVec< T > &input, const TVec< T > &output_gradient, real learning_rate, T weight_decay)
template<class T >
void PLearn::transposedLayerL1BpropUpdate (TVec< T > input_gradient, TMat< T > weights, const TVec< T > &input, const TVec< T > &output_gradient, real learning_rate, T weight_decay)
template<class T >
void PLearn::identityMatrix (TMat< T > m)
 set m to the identity matrix, more precisely set m(i,j) = 1_{i==j} (works also for non-square matrices)
template<class T >
TMat< T > PLearn::identityMatrix (int n, int m=-1)
 Return the identity matrix, more precisely an n x n or n x m matrix with result(i,j) = 1_{i==j}.

Detailed Description

Definition in file TMat_maths_impl.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines