30 template <
class dataType>
31 int execute(
const dataType *
const inputData1,
32 const dataType *
const inputData2,
33 dataType *
const outputData,
34 const std::string &distanceType,
37 template <
class dataType,
typename PowerFunc>
38 int computeLn(
const dataType *
const input1,
39 const dataType *
const input2,
40 dataType *
const output,
43 const PowerFunc &powerFunc);
45 template <
class dataType>
47 const dataType *
const input2,
48 dataType *
const output,
59 template <
typename type>
60 static type
abs_diff(
const type var1,
const type var2) {
61 return (var1 > var2) ? var1 - var2 : var2 - var1;
71template <
class dataType>
73 const dataType *
const inputData2,
74 dataType *
const outputData,
75 const std::string &distanceType,
82#ifndef TTK_ENABLE_KAMIKAZE
83 if(inputData1 ==
nullptr || inputData2 ==
nullptr) {
88 if(distanceType ==
"inf") {
89 status =
computeLinf(inputData1, inputData2, outputData, vertexNumber);
91 int const n = stoi(distanceType);
96 outputData, n, vertexNumber);
101 "Data-set processed", 1.0, t.
getElapsedTime(), this->threadNumber_);
107template <
class dataType,
typename PowerFunc>
109 const dataType *
const input2,
110 dataType *
const output,
113 const PowerFunc &powerFunc) {
117#ifdef TTK_ENABLE_OPENMP
118#pragma omp parallel for num_threads(threadNumber_) reduction(+ : sum)
122 const dataType power = powerFunc(diff);
138 this->
printMsg(
"L" + std::to_string(n)
139 +
"-distance: " + std::to_string(
result));
145template <
class dataType>
147 const dataType *
const input2,
148 dataType *
const output,
156#ifdef TTK_ENABLE_OPENMP
157#pragma omp parallel for num_threads(threadNumber_) reduction(max : maxValue)
170 result = (double)maxValue;
#define TTK_POW_LAMBDA(CALLEXPR, TYPE, EXPN,...)
Optimized Power function with lambdas.
int computeLinf(const dataType *const input1, const dataType *const input2, dataType *const output, const SimplexId vertexNumber)
int computeLn(const dataType *const input1, const dataType *const input2, dataType *const output, const int n, const SimplexId vertexNumber, const PowerFunc &powerFunc)
int execute(const dataType *const inputData1, const dataType *const inputData2, dataType *const outputData, const std::string &distanceType, const SimplexId vertexNumber)
static type abs_diff(const type var1, const type var2)
void setPrintRes(const bool data)
T1 pow(const T1 val, const T2 n)
TTK base package defining the standard types.
int SimplexId
Identifier type for simplices of any dimension.
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/| (_) |"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)