To avoid copying data from external libraries (e.g., C libraries), use views. Views wrap existing memory and expose the mvl API without overhead.
mvl::ConstMatrixView<T, Checking, Layout>: Wraps immutable external data. Supports different memory layouts like mvl::Layout::CR (Column-Major).mvl::ConstStridedMatrixView<T>: Useful for slicing specific channels from interleaved data (like RGB image buffers).
using namespace utl;
// Wrap external col-major data
const float data[] = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f };
mvl::ConstMatrixView<float, mvl::Checking::NONE, mvl::Layout::CR> A(
2, 3, data
);
// Wrap image channels from interleaved RGB data
const uint8_t* data = { /* ... */ };
mvl::ConstStridedMatrixView<uint8_t> R(w, h, 0, channels, data + 0);