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

◆ transform_matrix() [1/2]

template<OperationReadyData DataType>
DataType MayaFlux::Yantra::transform_matrix ( DataType &  input,
const Eigen::MatrixXd &  transformation_matrix 
)

Matrix transformation using existing infrastructure (IN-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - WILL BE MODIFIED
transformation_matrixMatrix to apply
Returns
Transformed data

Definition at line 411 of file MatrixHelper.hpp.

412{
413 auto [target_data, structure_info] = OperationHelper::extract_structured_double(input);
414
415 for (auto& channel_span : target_data) {
416 if (transformation_matrix.cols() == static_cast<long>(channel_span.size())) {
417 Eigen::Map<Eigen::VectorXd> data_vector(channel_span.data(), channel_span.size());
418 Eigen::VectorXd result = transformation_matrix * data_vector;
419
420 auto copy_size = std::min<long>(result.size(), static_cast<long>(channel_span.size()));
421 std::ranges::copy(result.head(copy_size), channel_span.begin());
422 }
423 }
424
425 auto reconstructed_data = target_data
426 | std::views::transform([](const auto& span) {
427 return std::vector<double>(span.begin(), span.end());
428 })
429 | std::ranges::to<std::vector>();
430
431 return OperationHelper::reconstruct_from_double<DataType>(reconstructed_data, structure_info);
432}

References MayaFlux::Yantra::OperationHelper::extract_structured_double().

+ Here is the call graph for this function: