Skip to content

Add overloads for sparse Armadillo `conv_to`

coot::conv_to, for compatibility reasons, can perform Armadillo conversions if Armadillo is available, by simply calling out to arma::conv_to when the input and/or output types are Armadillo types. But, there is not support for sparse objects.

This MR just adds support for sparse objects, so that you could, if you desired, do

arma::sp_mat x;
arma::mat y = coot::conv_to<arma::mat>::from(x);

(This might seem like strange support but it is actually quite useful for mlpack and ensmallen, where we could just say using coot::conv_to inside the mlpack/ensmallen namespaces, then use conv_to in an unqualified way throughout the codebase and the compiler will always use the Bandicoot version, which calls out to the Armadillo version when necessary. This is better than depending on ADL, which has all of its own inherent issues.)

Merge request reports

Loading