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

◆ create_eigen_matrix() [1/2]

template<typename T >
static Eigen::MatrixXd MayaFlux::Yantra::OperationHelper::create_eigen_matrix ( const std::vector< std::span< const T > > &  spans)
inlinestaticprivate

Create Eigen matrix from spans.

Definition at line 830 of file OperationHelper.hpp.

831 {
832 if (spans.empty()) {
833 return {};
834 }
835
836 int rows = spans[0].size();
837 int cols = spans.size();
838
839 for (const auto& span : spans) {
840 if (span.size() != rows) {
841 error<std::invalid_argument>(Journal::Component::Yantra, Journal::Context::Runtime, std::source_location::current(), "All spans must have same size");
842 }
843 }
844
845 Eigen::MatrixXd matrix(rows, cols);
846 for (int col = 0; col < cols; ++col) {
847 for (int row = 0; row < rows; ++row) {
848 matrix(row, col) = static_cast<double>(spans[col][row]);
849 }
850 }
851 return matrix;
852 }
uint32_t rows
@ Runtime
General runtime operations (default fallback)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.

References rows.