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

◆ transform_linear() [1/2]

template<OperationReadyData DataType>
DataType MayaFlux::Yantra::transform_linear ( DataType &  input,
double  a,
double  b 
)

Linear transformation y = ax + b using C++20 ranges (IN-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - WILL BE MODIFIED
aScale factor
bOffset factor
Returns
Transformed data

Definition at line 32 of file MathematicalHelper.hpp.

33{
34 auto [target_data, structure_info] = OperationHelper::extract_structured_double(input);
35
36 for (auto& span : target_data) {
37 std::ranges::transform(span, span.begin(),
38 [a, b](double x) { return a * x + b; });
39 }
40
41 auto reconstructed_data = target_data
42 | std::views::transform([](const auto& span) {
43 return std::vector<double>(span.begin(), span.end());
44 })
45 | std::ranges::to<std::vector>();
46
47 return OperationHelper::reconstruct_from_double<DataType>(reconstructed_data, structure_info);
48}

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: