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

◆ transform_polynomial() [1/2]

template<OperationReadyData DataType>
DataType MayaFlux::Yantra::transform_polynomial ( DataType &  input,
const std::vector< double > &  coefficients 
)

Polynomial transformation using existing Generator::Polynomial (IN-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - WILL BE MODIFIED
coefficientsPolynomial coefficients [a0, a1, a2, ...]
Returns
Transformed data

Definition at line 127 of file MathematicalHelper.hpp.

128{
129 auto [target_data, structure_info] = OperationHelper::extract_structured_double(input);
130
131 auto polynomial_gen = std::make_shared<Nodes::Generator::Polynomial>(coefficients);
132
133 for (auto& span : target_data) {
134 std::ranges::transform(span, span.begin(),
135 [&polynomial_gen](double x) {
136 return polynomial_gen->process_sample(x);
137 });
138 }
139
140 auto reconstructed_data = target_data
141 | std::views::transform([](const auto& span) {
142 return std::vector<double>(span.begin(), span.end());
143 })
144 | std::ranges::to<std::vector>();
145
146 return OperationHelper::reconstruct_from_double<DataType>(reconstructed_data, structure_info);
147}

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

Referenced by MayaFlux::Yantra::MathematicalTransformer< InputType, OutputType >::transform_implementation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: