|
| CuSubMatrix (const CuMatrixBase< Real > &mat, const MatrixIndexT row_offset, const MatrixIndexT num_rows, const MatrixIndexT col_offset, const MatrixIndexT num_cols) |
|
| CuSubMatrix (const Real *data, const MatrixIndexT num_rows, const MatrixIndexT num_cols, const MatrixIndexT stride) |
|
| CuSubMatrix (const CuSubMatrix &other) |
| This type of constructor is needed for Range() to work [in CuMatrix base class]. More...
|
|
void | CopyCols (const CuMatrixBase< Real > &src, const CuArrayBase< MatrixIndexT > &indexes) |
| Copies column r from column indexes[r] of src. More...
|
|
void | AddCols (const CuMatrixBase< Real > &src, const CuArrayBase< MatrixIndexT > &indices) |
| Add column indices[r] of src to column r. More...
|
|
void | CopyRows (const CuMatrixBase< Real > &src, const CuArrayBase< MatrixIndexT > &indexes) |
| Copies row r from row indexes[r] of src. More...
|
|
void | CopyRows (const CuArrayBase< const Real *> &src) |
| Copies row r of this matrix from an array of floats at the location given by src[r], where src[r] is assumed to be obtained from the RowData() function of another CuMatrix, or from CuVector::Data() (the point is: the data it points to should be on the GPU if we're using a GPU, and on a CPU otherwise). More...
|
|
void | CopyToRows (const CuArrayBase< Real *> &dst) const |
| For each row r of this matrix, copies it to the array of floats at the location given by dst[r], where dst[r] is assumed to be obtained from the RowData() function of another CuMatrix, or from CuVector::Data() (i.e. More...
|
|
void | AddRows (Real alpha, const CuMatrixBase< Real > &src, const CuArrayBase< MatrixIndexT > &indexes) |
| Does for each row r, this.Row(r) += alpha * src.row(indexes[r]). More...
|
|
void | MulRows (const CuMatrixBase< Real > &src, const CuArrayBase< MatrixIndexT > &indexes) |
| Does for each row r, this.Row(r) *= alpha * src.row(indexes[r]), where '*=' is elementwise multiplication. More...
|
|
void | AddRows (Real alpha, const CuArrayBase< const Real *> &src) |
| Does for each row r, this.Row(r) += alpha * src[r], treating src[r] as the beginning of a region of memory representing a vector of floats, of the same length as this.NumCols(). More...
|
|
void | AddToRows (Real alpha, const CuArrayBase< MatrixIndexT > &indexes, CuMatrixBase< Real > *dst) const |
| For each row i of *this, adds this->Row(i) to dst->Row(indexes(i)) if indexes(i) >= 0, else do nothing. More...
|
|
void | AddToRows (Real alpha, const CuArrayBase< Real *> &dst) const |
| For each row r of this matrix, adds it (times alpha) to the array of floats at the location given by dst[r], where dst[r] is assumed to be obtained from the RowData() function of another CuMatrix, or from CuVector::Data() (i.e. More...
|
|
void | SumColumnRanges (const CuMatrixBase< Real > &src, const CuArrayBase< Int32Pair > &indexes) |
| For each row r of this and for each column c, sets (*this)(r, c) to the sum src(r, j), where j ranges from indexes[c].first through indexes[c].second - 1. More...
|
|
void | AddRowRanges (const CuMatrixBase< Real > &src, const CuArrayBase< Int32Pair > &indexes) |
| For each row r of this and for each column c, do (*this)(r, c) += src(j, c), where j ranges from indexes[r].first through indexes[r].second - 1. More...
|
|
void | AddToDiag (Real value) |
| Adds "value" to the diagonal elements of the matrix. More...
|
|
MatrixIndexT | NumRows () const |
| Dimensions. More...
|
|
MatrixIndexT | NumCols () const |
|
MatrixIndexT | Stride () const |
|
::MatrixDim | Dim () const |
|
Real | FrobeniusNorm () const |
|
bool | IsUnit (Real tol=0.001) const |
|
bool | ApproxEqual (const CuMatrixBase< Real > &other, float tol=0.01) const |
| True if ((*this)-other).FrobeniusNorm() <= tol * this->FrobeniusNorm() More...
|
|
MatrixIndexT | SizeInBytes () const |
| Get size of matrix in bytes. More...
|
|
template<typename OtherReal > |
void | CopyFromMat (const MatrixBase< OtherReal > &src, MatrixTransposeType trans=kNoTrans) |
|
void | CopyFromGeneralMat (const GeneralMatrix &src, MatrixTransposeType trans=kNoTrans) |
|
void | CopyFromMat (const MatrixBase< Real > &src, MatrixTransposeType trans=kNoTrans) |
|
void | CopyFromSp (const CuSpMatrix< Real > &M) |
|
template<typename OtherReal > |
void | CopyFromTp (const CuTpMatrix< OtherReal > &M, MatrixTransposeType trans=kNoTrans) |
|
void | CopyRangeFromMatClamped (const CuMatrixBase< Real > &src, int32_t start_range, int32_t end_range, int32_t clamp_low, int32_t clamp_high) |
|
template<typename OtherReal > |
void | CopyFromMat (const CuMatrixBase< OtherReal > &M, MatrixTransposeType trans=kNoTrans) |
|
template<typename OtherReal > |
void | CopyToMat (MatrixBase< OtherReal > *dst, MatrixTransposeType trans=kNoTrans) const |
|
void | CopyRowsFromVec (const CuVectorBase< Real > &v) |
| This function has two modes of operation. More...
|
|
void | CopyRowsFromVec (const VectorBase< Real > &v) |
| Version of CopyRowsFromVec() that takes a CPU-based vector. More...
|
|
void | CopyColsFromVec (const CuVectorBase< Real > &v) |
| Copies vector into matrix, column-by-column. More...
|
|
void | CopyColFromVec (const CuVectorBase< Real > &v, const MatrixIndexT col) |
| Copy vector into specific column of matrix. More...
|
|
void | Sigmoid (const CuMatrixBase< Real > &src) |
| Set each element to the sigmoid of the corresponding element of "src": element by element, x = 1 / (1 + exp(-x)) More...
|
|
void | Heaviside (const CuMatrixBase< Real > &src) |
| Set each element to the Heaviside function of the corresponding element of "src", which we define as the function (x > 0 ? 1.0 : 0.0) [note: in general, there are different ways to deal with the situation when x==0. More...
|
|
void | Exp (const CuMatrixBase< Real > &src) |
|
void | Log (const CuMatrixBase< Real > &src) |
|
void | Pow (const CuMatrixBase< Real > &src, Real power) |
|
void | PowAbs (const CuMatrixBase< Real > &src, Real power, bool include_sign=false) |
| Apply power to the absolute value of each element. More...
|
|
void | Floor (const CuMatrixBase< Real > &src, Real floor_val) |
|
void | Ceiling (const CuMatrixBase< Real > &src, Real ceiling_val) |
|
void | ExpLimited (const CuMatrixBase< Real > &src, Real lower_limit, Real upper_limit) |
| This is equivalent to running: Floor(src, lower_limit); Ceiling(src, upper_limit); Exp(src) More...
|
|
void | ExpSpecial (const CuMatrixBase< Real > &src) |
| For each element x of the matrix, set it to (x < 0 ? exp(x) : x + 1). More...
|
|
void | SoftMaxPerRow (const CuMatrixBase< Real > &src) |
| Softmax nonlinearity Y = Softmax(X) : Yij = e^Xij / sum_k(e^Xik), done to each row, with attention to avoiding overflow or underflow. More...
|
|
void | LogSoftMaxPerRow (const CuMatrixBase< Real > &src) |
| LogSoftmax nonlinearity Y = LogSoftmax(X) : Yij = Xij - log(sum_k(e^Xik)), done to each row, with attention to avoiding overflow or underflow. More...
|
|
void | SoftHinge (const CuMatrixBase< Real > &src) |
| Apply the function y = log(1 + exp(x)), to each element. More...
|
|
void | GroupPnorm (const CuMatrixBase< Real > &src, Real pow) |
| Apply the function y(i) = (sum_{j = i*G}^{(i+1)*G-1} x_j ^ (power)) ^ (1 / p) where G = x.NumCols() / y.NumCols() must be an integer. More...
|
|
void | DiffGroupPnorm (const CuMatrixBase< Real > &in_value, const CuMatrixBase< Real > &out_value, const CuMatrixBase< Real > &out_deriv, Real power) |
| Differentiate backward through the GroupPnorm function. More...
|
|
void | GroupMax (const CuMatrixBase< Real > &src) |
| Apply the function y(i) = (max_{j = i*G}^{(i+1)*G-1} x_j where G = x.NumCols() / y.NumCols() must be an integer. More...
|
|
void | GroupMaxDeriv (const CuMatrixBase< Real > &input, const CuMatrixBase< Real > &output) |
| Calculate derivatives for the GroupMax function above, where "input" is the input to the GroupMax function above (i.e. More...
|
|
void | ParametricRelu (const CuMatrixBase< Real > &src, const CuVectorBase< Real > &alpha, const CuVectorBase< Real > &beta) |
| Compute the parametric rectified linear unit function; element by element, *this = src * (src > 0 ? alpha : beta) More...
|
|
void | DiffParametricRelu (const CuMatrixBase< Real > &value, const CuMatrixBase< Real > &diff, const CuVectorBase< Real > &alpha, const CuVectorBase< Real > &beta) |
| Differentiate backward through the parametric relu function. More...
|
|
void | Tanh (const CuMatrixBase< Real > &src) |
| Compute the hyperbolic tangent (tanh) function; element by element, *this = tanh(src). More...
|
|
void | DiffSigmoid (const CuMatrixBase< Real > &value, const CuMatrixBase< Real > &diff) |
| Differentiate backward through the sigmoid function. More...
|
|
void | DiffTanh (const CuMatrixBase< Real > &value, const CuMatrixBase< Real > &diff) |
| Differentiate backward through the tanh function. More...
|
|
void | DiffSoftmaxPerRow (const CuMatrixBase< Real > &value, const CuMatrixBase< Real > &diff) |
| Differentiate backward through the softmax function. More...
|
|
void | DiffLogSoftmaxPerRow (const CuMatrixBase< Real > &out_value, const CuMatrixBase< Real > &out_deriv) |
| Differentiate backward through the log softmax function. More...
|
|
void | DiffXent (const CuArrayBase< int32 > &tgt, CuVector< Real > *log_post_tgt) |
| Differentiate the block [softmax+cross-entropy] : dE/da = posterior_mat - target_mat, 'E' is error function, 'a' is activation on softmax input. More...
|
|
void | Cholesky (CuMatrixBase< Real > *inv_cholesky=NULL) |
| This function does sets *this to the Cholesky factor of *this (i.e. More...
|
|
void | SymInvertPosDef () |
| Inversion for positive definite symmetric matrices. More...
|
|
void | ApplyPow (Real power) |
|
void | ApplyPowAbs (Real power, bool include_sign=false) |
|
void | ApplyHeaviside () |
|
void | ApplyFloor (Real floor_val) |
|
void | ApplyCeiling (Real ceiling_val) |
|
void | ApplyExp () |
|
void | ApplyExpLimited (Real lower_limit, Real upper_limit) |
|
void | ApplyExpSpecial () |
|
void | ApplySoftMaxPerRow () |
|
void | ApplyLogSoftMaxPerRow () |
|
void | ApplyLog () |
|
void | FindRowMaxId (CuArray< int32 > *id) const |
| Find the id of the maximal element for each row (resizes the 'id' array to the appropriate size). More...
|
|
void | SetZero () |
| Math operations, some calling kernels. More...
|
|
void | Set (Real value) |
|
void | Add (Real value) |
|
void | SetZeroAboveDiag () |
| Zeroes all elements for which col > row. More...
|
|
void | Scale (Real value) |
|
void | MulElements (const CuMatrixBase< Real > &A) |
| Multiply two matrices elementwise: C = C .* A. More...
|
|
void | DivElements (const CuMatrixBase< Real > &A) |
| Divide two matrices elementwise: C = A ./ A. More...
|
|
void | Max (const CuMatrixBase< Real > &A) |
| Do, elementwise, *this = max(*this, A). More...
|
|
void | Min (const CuMatrixBase< Real > &A) |
| Do, elementwise, *this = min(*this, A). More...
|
|
void | MulColsVec (const CuVectorBase< Real > &scale) |
| scale i'th column by scale[i] More...
|
|
void | MulRowsVec (const CuVectorBase< Real > &scale) |
| scale i'th row by scale[i] More...
|
|
void | MulRowsGroupMat (const CuMatrixBase< Real > &src) |
| divide each row into src.NumCols() groups, and then scale i'th row's jth group of elements by src[i, j]. More...
|
|
void | DivRowsVec (const CuVectorBase< Real > &div) |
| divide i'th row by scale[i] More...
|
|
void | InvertElements () |
| invert the matrix by elements. More...
|
|
void | AddMat (Real alpha, const CuMatrixBase< Real > &A, MatrixTransposeType trans=kNoTrans) |
| *this += alpha * A More...
|
|
void | AddSmat (Real alpha, const CuSparseMatrix< Real > &A, MatrixTransposeType trans=kNoTrans) |
| *this += alpha * A. More...
|
|
void | AddSmatMat (Real alpha, const CuSparseMatrix< Real > &A, MatrixTransposeType transA, const CuMatrixBase< Real > &B, Real beta) |
| (*this) = alpha * op(A) * B + beta * (*this), where A is sparse. More...
|
|
void | AddMatSmat (Real alpha, const CuMatrixBase< Real > &A, const CuSparseMatrix< Real > &B, MatrixTransposeType transB, Real beta) |
| (*this) = alpha * A * op(B) + beta * (*this), where B is sparse and op(B) is either B or trans(B) depending on the 'transB' argument. More...
|
|
void | AddToElements (Real alpha, const CuArrayBase< int32 > &elements) |
| This is a rather special purpose function; we might generalize it later by adding a transpose-type option. More...
|
|
void | AddMatBlocks (Real alpha, const CuMatrixBase< Real > &A, MatrixTransposeType trans=kNoTrans) |
| This function is like AddMat (it does *this += alpha * src), except that it supports cases where *this and src have different dimension. More...
|
|
void | AddVecToCols (Real alpha, const CuVectorBase< Real > &col, Real beta=1.0) |
| (for each column c of *this), c = alpha * col + beta * c More...
|
|
void | AddVecToRows (Real alpha, const CuVectorBase< Real > &row, Real beta=1.0) |
| (for each row r of *this), r = alpha * row + beta * r More...
|
|
void | AddMatMat (Real alpha, const CuMatrixBase< Real > &A, MatrixTransposeType transA, const CuMatrixBase< Real > &B, MatrixTransposeType transB, Real beta) |
| C = alpha * A(^T)*B(^T) + beta * C. More...
|
|
void | AddVecVec (Real alpha, const CuVectorBase< Real > &x, const CuVectorBase< Real > &y) |
| A = alpha * x * y^T + A . More...
|
|
void | SetMatMatDivMat (const CuMatrixBase< Real > &A, const CuMatrixBase< Real > &B, const CuMatrixBase< Real > &C) |
| *this = a * b / c (by element; when c = 0, *this = a) *this can be an alias of a, b or c safely and get expected result. More...
|
|
void | SymAddMat2 (const Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType transA, Real beta) |
| *this = beta * *this + alpha * M M^T, for symmetric matrices. More...
|
|
void | AddMatBlock (Real alpha, const CuMatrixBase< Real > &A, MatrixTransposeType transA, const CuBlockMatrix< Real > &B, MatrixTransposeType transB, Real beta) |
| This function is like AddMatMat but for where the second argument is of type CuBlockMatrix (a block-diagonal matrix of blocks). More...
|
|
void | AddDiagVecMat (const Real alpha, const CuVectorBase< Real > &v, const CuMatrixBase< Real > &M, MatrixTransposeType transM, Real beta=1.0) |
| *this = beta * *this + alpha * diag(v) * M [or M^T]. More...
|
|
void | AddMatDiagVec (const Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType transM, CuVectorBase< Real > &v, Real beta=1.0) |
|
void | AddMatMatElements (const Real alpha, const CuMatrixBase< Real > &A, const CuMatrixBase< Real > &B, const Real beta) |
| *this = beta * *this + alpha * A .* B (.* element by element multiplication) More...
|
|
void | AddMatSp (const Real alpha, const CuMatrixBase< Real > &A, MatrixTransposeType transA, const CuSpMatrix< Real > &B, const Real beta) |
| this <– beta*this + alpha*A*B More...
|
|
void | AddSpMat (const Real alpha, const CuSpMatrix< Real > &A, const CuMatrixBase< Real > &B, MatrixTransposeType transB, const Real beta) |
| this <– beta*this + alpha*SpA*B More...
|
|
void | AddTpMat (const Real alpha, const CuTpMatrix< Real > &A, MatrixTransposeType transA, const CuMatrixBase< Real > &B, MatrixTransposeType transB, const Real beta) |
| this <– beta*this + alpha*A*B. More...
|
|
void | AddMatTp (const Real alpha, const CuMatrixBase< Real > &A, MatrixTransposeType transA, const CuTpMatrix< Real > &B, MatrixTransposeType transB, const Real beta) |
| this <– beta*this + alpha*A*B. More...
|
|
void | CopyFromBlock (const CuBlockMatrix< Real > &B, MatrixTransposeType trans=kNoTrans) |
|
void | CopyLowerToUpper () |
|
void | CopyUpperToLower () |
|
CuSubMatrix< Real > | Range (const MatrixIndexT row_offset, const MatrixIndexT num_rows, const MatrixIndexT col_offset, const MatrixIndexT num_cols) const |
|
CuSubMatrix< Real > | RowRange (const MatrixIndexT row_offset, const MatrixIndexT num_rows) const |
|
CuSubMatrix< Real > | ColRange (const MatrixIndexT col_offset, const MatrixIndexT num_cols) const |
|
const CuSubVector< Real > | Row (MatrixIndexT i) const |
|
CuSubVector< Real > | Row (MatrixIndexT i) |
|
CuValue< Real > | operator() (MatrixIndexT r, MatrixIndexT c) |
|
Real | operator() (MatrixIndexT r, MatrixIndexT c) const |
|
Real | Sum () const |
|
Real | Max () const |
|
Real | Min () const |
|
Real | Trace (bool check_square=true) const |
| Return the trace. If check_square = true, will crash if matrix is not square. More...
|
|
void | SetRandn () |
|
void | SetRandUniform () |
|
void | Write (std::ostream &os, bool binary) const |
|
void | AddElements (Real alpha, const std::vector< MatrixElement< Real > > &input) |
|
void | AddElements (Real alpha, const CuArrayBase< Int32Pair > &indexes, const Real *input) |
|
void | Lookup (const std::vector< Int32Pair > &indexes, Real *output) const |
|
void | Lookup (const CuArrayBase< Int32Pair > &indexes, Real *output) const |
|
void | EqualElementMask (const CuMatrixBase< Real > &mat, CuMatrix< Real > *mask) const |
|
const Real * | RowData (MatrixIndexT r) const |
| Get raw row pointer (const). More...
|
|
Real * | RowData (MatrixIndexT r) |
| Get raw row pointer. More...
|
|
const Real * | Data () const |
| Return data pointer (const). More...
|
|
Real * | Data () |
| Return data pointer. More...
|
|
const MatrixBase< Real > & | Mat () const |
|
MatrixBase< Real > & | Mat () |
|