MayaFlux 0.1.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 409 of file MatrixHelper.hpp.

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

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

+ Here is the call graph for this function: