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

◆ transform_clamp() [1/2]

template<OperationReadyData DataType>
DataType MayaFlux::Yantra::transform_clamp ( DataType &  input,
double  min_val,
double  max_val 
)

Clamp transformation using C++20 ranges (IN-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - WILL BE MODIFIED
min_valMinimum value
max_valMaximum value
Returns
Clamped data

Definition at line 437 of file MathematicalHelper.hpp.

438{
439 auto [target_data, structure_info] = OperationHelper::extract_structured_double(input);
440
441 for (auto& span : target_data) {
442 std::ranges::transform(span, span.begin(),
443 [min_val, max_val](double x) { return std::clamp(x, min_val, max_val); });
444 }
445
446 auto reconstructed_data = target_data
447 | std::views::transform([](const auto& span) {
448 return std::vector<double>(span.begin(), span.end());
449 })
450 | std::ranges::to<std::vector>();
451
452 return OperationHelper::reconstruct_from_double<DataType>(reconstructed_data, structure_info);
453}

References transform_clamp().

Referenced by transform_clamp(), and transform_clamp().

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