MayaFlux 1.0.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 424 of file OperationHelper.hpp.

426 {
427 using Scalar = typename EigenMatrix::Scalar;
428 std::vector<std::span<const Scalar>> result;
429 result.reserve(static_cast<size_t>(matrix.cols()));
430
431 for (int col = 0; col < matrix.cols(); ++col) {
432 result.emplace_back(matrix.col(col).data(), static_cast<size_t>(matrix.rows()));
433 }
434 return result;
435 }