I'm using the Armadillo C++ linear algebra library, and I'm trying to figure out how to convert an sp_mat sparse matrix object to a standard mat dense matrix.
Looking at the internal code doc, sp_mat and mat don't share a common parent class, which leads me to believe there isn't a way to cast an sp_mat as a mat. By the way, conv_to<mat>::from(sp_mat x) doesn't work.
Perhaps there's a tricky way to do this using one of the advanced mat constructors? For example, somehow create a mat of zeros and pass the locations and values of non-zero elements in the sp_mat.
Does anyone know of an efficient method to do this? Thanks in advance.
Casting works perfectly fine: