13 #ifndef MLPACK_CORE_MATH_MAKE_ALIAS_HPP 14 #define MLPACK_CORE_MATH_MAKE_ALIAS_HPP 23 template<
typename ElemType>
24 arma::Cube<ElemType>
MakeAlias(arma::Cube<ElemType>& input,
25 const bool strict =
true)
28 return arma::Cube<ElemType>(input.memptr(), input.n_rows, input.n_cols,
29 input.n_slices,
false, strict);
36 template<
typename ElemType>
37 arma::Mat<ElemType>
MakeAlias(arma::Mat<ElemType>& input,
38 const bool strict =
true)
41 return arma::Mat<ElemType>(input.memptr(), input.n_rows, input.n_cols,
false,
49 template<
typename ElemType>
50 arma::Row<ElemType>
MakeAlias(arma::Row<ElemType>& input,
51 const bool strict =
true)
54 return arma::Row<ElemType>(input.memptr(), input.n_elem,
false, strict);
61 template<
typename ElemType>
62 arma::Col<ElemType>
MakeAlias(arma::Col<ElemType>& input,
63 const bool strict =
true)
66 return arma::Col<ElemType>(input.memptr(), input.n_elem,
false, strict);
73 template<
typename ElemType>
74 arma::SpMat<ElemType>
MakeAlias(
const arma::SpMat<ElemType>& input,
78 return arma::SpMat<ElemType>(input);
85 template<
typename ElemType>
86 arma::SpRow<ElemType>
MakeAlias(
const arma::SpRow<ElemType>& input,
90 return arma::SpRow<ElemType>(input);
97 template<
typename ElemType>
98 arma::SpCol<ElemType>
MakeAlias(
const arma::SpCol<ElemType>& input,
102 return arma::SpCol<ElemType>(input);
109 template<
typename ElemType>
112 if (mat.mem_state >= 1)
120 template<
typename ElemType>
Linear algebra utility functions, generally performed on matrices or vectors.
void ClearAlias(arma::Mat< ElemType > &mat)
Clear an alias so that no data is overwritten.
arma::Cube< ElemType > MakeAlias(arma::Cube< ElemType > &input, const bool strict=true)
Make an alias of a dense cube.