Create Eigen matrix from spans.
648 {
649 if (spans.empty()) {
650 return {};
651 }
652
653 int rows = spans[0].size();
654 int cols = spans.size();
655
656 for (const auto& span : spans) {
657 if (span.size() != rows) {
659 }
660 }
661
662 Eigen::MatrixXd matrix(rows, cols);
663 for (int col = 0; col < cols; ++col) {
664 for (int row = 0; row < rows; ++row) {
665 matrix(row, col) = static_cast<double>(spans[col][row]);
666 }
667 }
668 return matrix;
669 }
@ Runtime
General runtime operations (default fallback)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.