carma icon indicating copy to clipboard operation
carma copied to clipboard

Carma seem to not support fixed size matrices

Open yaqwsx opened this issue 3 years ago • 0 comments

Hi, in our project, we use fixed-sized matrices (arma::mat44). However, it seems that these matrices are not supported by carma as we get the following compilation error:

_deps/carma-src/include/carma_bits/converters.h:647:16: error: no matching function for call to ‘arma::Mat<double>::fixed<4, 4>::fixed(double*, const uword&, const uword&, bool)’
  647 |         data = new armaT(src.memptr(), src.n_rows, src.n_cols, true);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from _deps/armadillo-build/tmp/include/armadillo:607,

The problematic part is in this function:

template <typename armaT, typename T = typename armaT::elem_type, is_Mat_only<armaT> = 2>
inline py::array_t<T> to_numpy(armaT& src, int copy = 0) {
    // if not copy we steal
    armaT* data;
    if (!copy) {
        data = new armaT(std::move(src));
    } else {
        data = new armaT(src.memptr(), src.n_rows, src.n_cols, true); // NOTE: Fixed size matrices don't have such constructor
    }
    return details::construct_array<T>(data);
} /* to_numpy */

Are fixed-size matrices not supported, or are we using Carma incorrectly?

yaqwsx avatar Oct 19 '22 12:10 yaqwsx