48 "MergeTreeDistanceMatrix");
69 template <
class dataType>
72 std::vector<std::vector<double>> &distanceMatrix) {
73 executePara<dataType>(trees, distanceMatrix);
74 if(trees2.size() != 0) {
76 std::vector<std::vector<double>> distanceMatrix2(
77 trees2.size(), std::vector<double>(trees2.size()));
78 executePara<dataType>(trees2, distanceMatrix2,
false);
83 template <
class dataType>
85 std::vector<std::vector<double>> &distanceMatrix) {
86 for(
unsigned int i = 0; i < distanceMatrix.size(); ++i) {
87 if(i % std::max(
int(distanceMatrix.size() / 10), 1) == 0) {
88 std::stringstream stream;
89 stream << i <<
" / " << distanceMatrix.size();
103 distanceMatrix[i][i] = 0.0;
105 for(
unsigned int j = i + 1; j < distanceMatrix[0].size(); ++j) {
108 distanceMatrix[i][j] = 0;
111 &(ftmtrees[i].tree), &(ftmtrees[j].tree));
112 distanceMatrix[i][j] =
static_cast<double>(dist);
115 &(ftmtrees[i].tree), &(ftmtrees[j].tree));
116 distanceMatrix[i][j] =
static_cast<double>(dist);
119 distanceMatrix[j][i] = distanceMatrix[i][j];
124 template <
class dataType>
126 std::vector<std::vector<double>> &distanceMatrix,
127 bool isFirstInput =
true) {
128#ifdef TTK_ENABLE_OPENMP
129#pragma omp parallel num_threads(this->threadNumber_)
131#pragma omp single nowait
133 executeParaImpl<dataType>(trees, distanceMatrix, isFirstInput);
134#ifdef TTK_ENABLE_OPENMP
140 template <
class dataType>
142 std::vector<std::vector<double>> &distanceMatrix,
143 bool isFirstInput =
true) {
144 for(
unsigned int i = 0; i < distanceMatrix.size(); ++i) {
145#ifdef TTK_ENABLE_OPENMP
146#pragma omp task firstprivate(i) UNTIED() shared(distanceMatrix, trees)
149 if(i % std::max(
int(distanceMatrix.size() / 10), 1) == 0) {
150 std::stringstream stream;
151 stream << i <<
" / " << distanceMatrix.size();
154 distanceMatrix[i][i] = 0.0;
155 for(
unsigned int j = i + 1; j < distanceMatrix[0].size(); ++j) {
187 std::vector<std::tuple<ftm::idNode, ftm::idNode>> outputMatching;
188 distanceMatrix[i][j] = mergeTreeDistance.
execute<dataType>(
189 trees[i], trees[j], outputMatching);
191 distanceMatrix[i][j] = 0;
194 distanceMatrix[j][i] = distanceMatrix[i][j];
196#ifdef TTK_ENABLE_OPENMP
virtual int setThreadNumber(const int threadNumber)
void setBaseMetric(int m)
dataType editDistance_branch(ftm::FTMTree_MT *tree1, ftm::FTMTree_MT *tree2)
void setAssignmentSolver(int assignmentSolver)
Minimalist debugging class.
void setDebugMsgPrefix(const std::string &prefix)
virtual int setDebugLevel(const int &debugLevel)
void setBranchDecomposition(bool useBD)
void setNormalizedWasserstein(bool normalizedWasserstein)
void setDistanceSquaredRoot(bool distanceSquaredRoot)
void setEpsilon3Tree1(double epsilon)
void setEpsilonTree1(double epsilon)
void setAssignmentSolver(int assignmentSolver)
void setEpsilon2Tree1(double epsilon)
void setEpsilonTree2(double epsilon)
bool normalizedWasserstein_
void setPersistenceThreshold(double pt)
bool distanceSquaredRoot_
void setCleanTree(bool clean)
void setEpsilon2Tree2(double epsilon)
void setKeepSubtree(bool keepSubtree)
double persistenceThreshold_
void setUseMinMaxPair(bool useMinMaxPair)
void setEpsilon3Tree2(double epsilon)
double mixDistancesMinMaxPairWeight(bool isFirstInput)
bool branchDecomposition_
bool isPersistenceDiagram_
void setParallelize(bool para)
void setIsPersistenceDiagram(bool isPD)
void mixDistancesMatrix(std::vector< std::vector< dataType > > &distanceMatrix, std::vector< std::vector< dataType > > &distanceMatrix2)
void executePara(std::vector< ftm::MergeTree< dataType > > &trees, std::vector< std::vector< double > > &distanceMatrix, bool isFirstInput=true)
void setBranchMetric(int m)
void setBaseModule(int m)
void setPathMetric(int m)
MergeTreeDistanceMatrix()
void execute(std::vector< ftm::MergeTree< dataType > > &ftmtrees, std::vector< std::vector< double > > &distanceMatrix)
void executeParaImpl(std::vector< ftm::MergeTree< dataType > > &trees, std::vector< std::vector< double > > &distanceMatrix, bool isFirstInput=true)
void execute(std::vector< ftm::MergeTree< dataType > > &trees, std::vector< ftm::MergeTree< dataType > > &trees2, std::vector< std::vector< double > > &distanceMatrix)
~MergeTreeDistanceMatrix() override=default
void setPostprocess(bool postproc)
void setSaveTree(bool save)
void setMinMaxPairWeight(double weight)
dataType execute(ftm::MergeTree< dataType > &mTree1, ftm::MergeTree< dataType > &mTree2, std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > &outputMatching)
void setIsCalled(bool ic)
void setBaseMetric(int m)
void setAssignmentSolver(int assignmentSolver)
void setComputeMapping(bool m)
dataType editDistance_path(ftm::FTMTree_MT *tree1, ftm::FTMTree_MT *tree2)
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)