MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ extract_native_data() [1/4]

template<typename EigenMatrix >
requires is_eigen_matrix_v<EigenMatrix>
static auto MayaFlux::Yantra::OperationHelper::extract_native_data ( const EigenMatrix &  matrix) -> std::vector<std::span<const typename EigenMatrix::Scalar>>
inlinestatic

Extract native-typed column spans from any Eigen matrix.

Returns one span per column in T::Scalar, aliasing the matrix's own storage via Eigen::Map. The matrix must outlive the returned spans.

Template Parameters
EigenMatrixAny Eigen matrix type. T::Scalar is the native type.
Parameters
matrixSource matrix.
Returns
Per-column spans in T::Scalar.

Definition at line 248 of file OperationHelper.hpp.

250 {
251 using Scalar = typename EigenMatrix::Scalar;
252 std::vector<std::span<const Scalar>> result;
253 result.reserve(static_cast<size_t>(matrix.cols()));
254
255 for (int col = 0; col < matrix.cols(); ++col) {
256 result.emplace_back(matrix.col(col).data(), static_cast<size_t>(matrix.rows()));
257 }
258 return result;
259 }