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

◆ transform_exponential() [1/2]

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

Exponential transformation y = a * base^(b * x) (IN-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - WILL BE MODIFIED
aScale factor
bExponential rate
baseExponential base (default: e for natural exponential)
Returns
Transformed data

Definition at line 184 of file MathematicalHelper.hpp.

185{
186 auto [target_data, structure_info] = OperationHelper::extract_structured_double(input);
187
188 for (auto& span : target_data) {
189 std::ranges::transform(span, span.begin(),
190 [a, b, base](double x) {
191 if (base == std::numbers::e) {
192 return a * std::exp(b * x);
193 }
194 return a * std::pow(base, b * x);
195 });
196 }
197
198 auto reconstructed_data = target_data
199 | std::views::transform([](const auto& span) {
200 return std::vector<double>(span.begin(), span.end());
201 })
202 | std::ranges::to<std::vector>();
203
204 return OperationHelper::reconstruct_from_double<DataType>(reconstructed_data, structure_info);
205}

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

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

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