13 #ifndef MLPACK_CORE_MATH_MAKE_ALIAS_HPP 14 #define MLPACK_CORE_MATH_MAKE_ALIAS_HPP 23 template<
typename ElemType>
24 arma::Mat<ElemType>
MakeAlias(arma::Mat<ElemType>& input,
25 const bool strict =
true)
28 return arma::Mat<ElemType>(input.memptr(), input.n_rows, input.n_cols,
false,
36 template<
typename ElemType>
37 arma::Row<ElemType>
MakeAlias(arma::Row<ElemType>& input,
38 const bool strict =
true)
41 return arma::Row<ElemType>(input.memptr(), input.n_elem,
false, strict);
48 template<
typename ElemType>
49 arma::Col<ElemType>
MakeAlias(arma::Col<ElemType>& input,
50 const bool strict =
true)
53 return arma::Col<ElemType>(input.memptr(), input.n_elem,
false, strict);
60 template<
typename ElemType>
61 arma::SpMat<ElemType>
MakeAlias(
const arma::SpMat<ElemType>& input,
65 return arma::SpMat<ElemType>(input);
72 template<
typename ElemType>
73 arma::SpRow<ElemType>
MakeAlias(
const arma::SpRow<ElemType>& input,
77 return arma::SpRow<ElemType>(input);
84 template<
typename ElemType>
85 arma::SpCol<ElemType>
MakeAlias(
const arma::SpCol<ElemType>& input,
89 return arma::SpCol<ElemType>(input);
96 template<
typename ElemType>
99 if (mat.mem_state >= 1)
107 template<
typename ElemType>
void ClearAlias(arma::Mat< ElemType > &mat)
Clear an alias so that no data is overwritten.
arma::Mat< ElemType > MakeAlias(arma::Mat< ElemType > &input, const bool strict=true)
Make an alias of a dense matrix.