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

◆ transform_logarithmic() [1/2]

template<OperationReadyData DataType>
DataType MayaFlux::Yantra::transform_logarithmic ( DataType &  input,
double  a,
double  b,
double  c,
std::vector< std::vector< double > > &  working_buffer,
double  base = std::numbers::e 
)

Logarithmic transformation y = a * log_base(b * x + c) (OUT-OF-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - will NOT be modified
aScale factor
bInput scale factor
cOffset to ensure positive argument
working_bufferBuffer for operations (will be resized if needed)
Returns
Transformed data

Definition at line 282 of file MathematicalHelper.hpp.

283{
284 auto [target_data, structure_info] = OperationHelper::setup_operation_buffer(input, working_buffer);
285
286 double log_base_factor = (base == std::numbers::e) ? 1.0 : (1.0 / std::log(base));
287
288 for (auto& span : target_data) {
289 std::ranges::transform(span, span.begin(),
290 [a, b, c, log_base_factor](double x) {
291 double arg = b * x + c;
292 if (arg <= 0.0)
293 return 0.0;
294 return a * std::log(arg) * log_base_factor;
295 });
296 }
297
298 return OperationHelper::reconstruct_from_double<DataType>(working_buffer, structure_info);
299}

References transform_logarithmic().

+ Here is the call graph for this function: