Skip to content

Commit

Permalink
ver. 1.9.7 there may be 1 indiscernible object
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrover committed Jul 6, 2022
1 parent 518e9b7 commit 9090dfb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
31 changes: 12 additions & 19 deletions phylogeny/distTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,8 @@ DistTree::DistTree (const string &treeFName,

if (! getConnected ())
throw runtime_error (FUNC "Disconnected objects");
setDiscernibles_ds ();
if (! setDiscernibles_ds ())
return;

if (isDirName (treeFName))
setGlobalLen (); // --> after dissim2Ds(), use dissims ??
Expand Down Expand Up @@ -3173,7 +3174,8 @@ DistTree::DistTree (const string &dissimFName,

if (! getConnected ())
throw runtime_error (FUNC "Disconnected objects");
setDiscernibles_ds ();
if (! setDiscernibles_ds ())
return;

neighborJoin ();

Expand Down Expand Up @@ -3972,8 +3974,6 @@ DistTree::DistTree (Subgraph &subgraph,
setPaths (false);


//ASSERT (setDiscernibles_ds () == 0);

qcPaths ();
}

Expand Down Expand Up @@ -4511,7 +4511,7 @@ Cluster2Leaves DistTree::getIndiscernibles ()



size_t DistTree::leafCluster2discernibles (const Cluster2Leaves &cluster2leaves)
void DistTree::leafCluster2discernibles (const Cluster2Leaves &cluster2leaves)
{
ASSERT (! subDepth);

Expand Down Expand Up @@ -4574,13 +4574,11 @@ size_t DistTree::leafCluster2discernibles (const Cluster2Leaves &cluster2leaves)

if (n)
cleanTopology ();

return n;
}



size_t DistTree::setDiscernibles_ds ()
bool DistTree::setDiscernibles_ds ()
{
ASSERT (! subDepth);
ASSERT (dissimDs. get ());
Expand All @@ -4599,9 +4597,6 @@ size_t DistTree::setDiscernibles_ds ()
}
}

//if (DistTree_sp::variance_min)
//return 0;

FFOR (size_t, row, dissimDs->objs. size ())
if (const Leaf* leaf1 = findPtr (name2leaf, dissimDs->objs [row] -> name))
FOR (size_t, col, row) // dissimAttr is symmetric
Expand All @@ -4616,16 +4611,16 @@ size_t DistTree::setDiscernibles_ds ()
if (const Leaf* leaf = dtNode->asLeaf ())
cluster2leaves [var_cast (leaf) -> getDisjointCluster ()] << leaf;
}
ASSERT (! cluster2leaves. empty ());

if (cluster2leaves. size () == 1)
throw runtime_error (FUNC "No discernible objects");

return leafCluster2discernibles (cluster2leaves);
leafCluster2discernibles (cluster2leaves);

return cluster2leaves. size () > 1;
}



size_t DistTree::setDiscernibles ()
void DistTree::setDiscernibles ()
{
ASSERT (! subDepth);
ASSERT (optimizable ());
Expand All @@ -4641,11 +4636,9 @@ size_t DistTree::setDiscernibles ()
//return 0;

const Cluster2Leaves cluster2leaves (getIndiscernibles ());
const size_t n = leafCluster2discernibles (cluster2leaves);
leafCluster2discernibles (cluster2leaves);

qcPaths ();

return n;
}


Expand Down
7 changes: 4 additions & 3 deletions phylogeny/distTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,12 +1262,13 @@ struct DistTree : Tree
// Return: VectorPtr::size() >= 2
// Invokes: Leaf->DisjointCluster
// Time: ~ O(p)
size_t leafCluster2discernibles (const Cluster2Leaves &cluster2leaves);
void leafCluster2discernibles (const Cluster2Leaves &cluster2leaves);
// Return: Number of indiscernible leaves
// Output: Leaf::len = 0, Leaf::discernible = false, topology
// Invokes: cleanTopology()
// Time: O(n)
size_t setDiscernibles_ds ();
bool setDiscernibles_ds ();
// Return: success
// Invokes: leafCluster2discernibles()
void cleanTopology ();
// Time: O(n)
Expand Down Expand Up @@ -1404,7 +1405,7 @@ struct DistTree : Tree
// Time: O(p log(n) / threads_max)
void qcPredictionAbsCriterion () const;
public:
size_t setDiscernibles ();
void setDiscernibles ();
// Invokes: getIndiscernibles(), leafCluster2discernibles()
size_t fixTransients ();
// Return: number of transient nodes deleted
Expand Down
6 changes: 6 additions & 0 deletions phylogeny/makeDistTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ struct ThisApplication : Application
);
}
ASSERT (tree. get ());
if (tree->getDiscernibles (). size () == 1)
{
cout << "One discernible object" << endl;
return;
}

ASSERT (optimizable == tree->optimizable ());

if (variance_dissim)
Expand Down
3 changes: 2 additions & 1 deletion version.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#define VERSION "1.9.6"
#define VERSION "1.9.7"


// 1.9.7 07/06/2022 there may be 1 indiscernible object
// 1.9.6 10/18/2021 distTree_inc_refresh_dissim.sh
// 1.9.5 07/23/2021 -prefer_gain is restored in tree2names.sh
// 1.9.4 06/09/2021 combine_dissims.cpp: -barrier
Expand Down

0 comments on commit 9090dfb

Please sign in to comment.