Skip to content

Commit

Permalink
Resolve @stevenweaver change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
spond committed Jan 8, 2024
1 parent 43751b8 commit c851484
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 55 deletions.
29 changes: 18 additions & 11 deletions res/TemplateBatchFiles/SelectionAnalyses/error-filter.bf
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ if (efilter.error_sink_proportion == 0) {
}
efilter.error_sink_prior_odds_ratio = Min (1e25,efilter.error_sink_proportion / efilter.fast_omega_proportion);

efilter.verbose_logging = utility.GetEnvVariable ("VERBOSE_LOGGING");

efilter.site_offset = 0;

utility.ToggleEnvVariable ("LOOP_TREE_ITERATOR_PREORDER", TRUE);



for (p = 0; p < efilter.input[terms.json.partition_count]; p+=1) {
efilter.sequences = {};
efilter.masked_sites = {};
Expand Down Expand Up @@ -175,16 +179,17 @@ for (p = 0; p < efilter.input[terms.json.partition_count]; p+=1) {
efilter.site_BF2 = 1e25;
}


/*if (efilter.site_BF >= efilter.threshold || efilter.site_BF2 >= efilter.ratio_threshold) {
if (efilter.site_BF >= efilter.threshold && efilter.site_BF2 >= efilter.ratio_threshold) {
fprintf (stdout, "FILTERED\n");
} else {
fprintf (stdout, "KEPT\n");
}
fprintf (stdout, ">" + (site+1) + "/" + node, " " + efilter.site_BF + ":" +efilter.site_BF2 + "\n");
if (efilter.verbose_logging ) {
if (efilter.site_BF >= efilter.threshold || efilter.site_BF2 >= efilter.ratio_threshold) {
if (efilter.site_BF >= efilter.threshold && efilter.site_BF2 >= efilter.ratio_threshold) {
fprintf (stdout, "FILTERED\n");
} else {
fprintf (stdout, "KEPT\n");
}
fprintf (stdout, ">" + (site+1) + "/" + node, " " + efilter.site_BF + ":" +efilter.site_BF2 + "\n");

}*/
}
}


if (efilter.site_BF >= efilter.threshold && efilter.site_BF2 >= efilter.ratio_threshold) {
Expand All @@ -201,8 +206,10 @@ for (p = 0; p < efilter.input[terms.json.partition_count]; p+=1) {
if (efilter.masked_already [ntm] != 1) {
efilter.masked_sites [ntm] + (site + efilter.site_offset);
}
}
//console.log ("Masking everything " + site + " " + node + " " + Abs (efilter.leaf_descendants) / Abs (efilter.sequences));
}
if (efilter.verbose_logging) {}
console.log ("Masking everything " + site + " " + node + " " + Abs (efilter.leaf_descendants) / Abs (efilter.sequences));
}
break;
}
for (ntm, ignore; in; efilter.leaf_descendants[node]) {
Expand Down
20 changes: 1 addition & 19 deletions src/core/formula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2327,14 +2327,6 @@ bool _Formula::ConvertToSimple (_AVLList& variable_index) {
store_constant [used_float_slots++] = this_op->theNumber->Value();
simpleExpressionStatus[i] = -1L - used_float_slots;
} else {
/*if (used_float_slots == available_slots) {
for (long j = 0; j < i; j++) {
if (simpleExpressionStatus [j] < -1L && simpleExpressionStatus [j] > -64L) {
simpleExpressionStatus [j] = -1;
}
}
used_float_slots++;
}*/
simpleExpressionStatus[i] = -1L;
}
} else if (this_op->theData >= 0) {
Expand Down Expand Up @@ -2410,33 +2402,23 @@ void _Formula::ConvertFromSimpleList (_SimpleList const& variableIndex) {
}

//__________________________________________________________________________________
hyFloat _Formula::ComputeSimple (_SimpleFormulaDatum* stack, _SimpleFormulaDatum* varValues, long allocate_local) {
hyFloat _Formula::ComputeSimple (_SimpleFormulaDatum* stack, _SimpleFormulaDatum* varValues) {
if (theFormula.nonempty()) {
long stackTop = 0;
unsigned long upper_bound = NumberOperations();

//if (allocate_local >= 0 && allocate_local <= MEMORYSTEP) {
// stack = (_SimpleFormulaDatum*)theStack.theStack._getStatic();
//}

const hyFloat * constants = (hyFloat*)theStack.theStack._getStatic();

for (unsigned long i=0UL; i<upper_bound; i++) {

if (simpleExpressionStatus[i] >= 0L) {
stack[stackTop++] = varValues[simpleExpressionStatus[i]];

/*if (thisOp->theNumber) {
stack[stackTop++].value = thisOp->theNumber->Value();
continue;*/
} else {
if (simpleExpressionStatus[i] <= -2L && simpleExpressionStatus[i] >= -32L) {
stack[stackTop++].value = constants[-simpleExpressionStatus[i] - 2L];
} else {
if (simpleExpressionStatus[i] == -1L) {
stack[stackTop++].value = ((_Operation**)theFormula.list_data)[i]->theNumber->Value();
//ItemAt (i)->theNumber->Value();
//stack[stackTop++] = varValues[simpleExpressionStatus[i]];
} else {
if (simpleExpressionStatus[i] <= -10000L) {
stackTop--;
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/formula.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class _Formula {
void SimplifyConstants (void);
_Variable * Dereference (bool, _hyExecutionContext* = _hyDefaultExecutionContext);

hyFloat ComputeSimple (_SimpleFormulaDatum* stack, _SimpleFormulaDatum* varValues, long allocate_local = -1L) ;
hyFloat ComputeSimple (_SimpleFormulaDatum* stack, _SimpleFormulaDatum* varValues) ;

hyFloat Newton (_Formula&, _Variable*, hyFloat, hyFloat, hyFloat);
hyFloat Newton (_Formula&, hyFloat, hyFloat, hyFloat, _Variable*);
Expand Down
2 changes: 1 addition & 1 deletion src/core/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2995,7 +2995,7 @@ HBLObjectRef _Matrix::EvaluateSimple (_Matrix* existing_storage) {


for (long f = 0L; f < cmd->formulasToEval.lLength; f++) {
cmd->formulaValues [f] = ((_Formula*)cmd->formulasToEval.list_data[f])->ComputeSimple(cmd->theStack, cmd->varValues, cmd->stackDepth);
cmd->formulaValues [f] = ((_Formula*)cmd->formulasToEval.list_data[f])->ComputeSimple(cmd->theStack, cmd->varValues);
}

long * fidx = cmd->formulaRefs;
Expand Down
24 changes: 1 addition & 23 deletions src/core/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2750,14 +2750,7 @@ void _TheTree::ExponentiateMatrices (_List& expNodes, long tc, long catI


}

//if (hasExpForm && (3*(flatTree.countitems() + flatLeaves.countitems()) < (mes_counter-b4)))
// printf ("%d/%d (%d)\n\n", mes_counter-b4, expNodes.lLength, flatTree.countitems() + flatLeaves.countitems());
//printf ("%ld %d\n", nodesToDo.lLength, hasExpForm);
//ObjectToConsole(&isExplicitForm);

//unsigned long id;


_List * computedExponentials = hasExpForm? new _List (matrixQueue.lLength) : nil;

_SimpleList parallel, serial;
Expand Down Expand Up @@ -2796,21 +2789,6 @@ void _TheTree::ExponentiateMatrices (_List& expNodes, long tc, long catI
(*computedExponentials) [matrixID] = already_computed;
}

/*for (matrixID = 0; matrixID < matrixQueue.lLength; matrixID++) {
if (isExplicitForm.list_data[matrixID] == 0 || !hasExpForm) { // normal matrix to exponentiate
((_CalcNode*) nodesToDo(matrixID))->SetCompExp ((_Matrix*)matrixQueue(matrixID), catID, true);
} else {
if (isExplicitForm.list_data[matrixID] > 0) {
(*computedExponentials) [matrixID] = ((_Matrix*)matrixQueue(matrixID))->Exponentiate(1., true);
} else {
_Matrix *already_computed = ((_Matrix*)matrixQueue(matrixID));
(*computedExponentials) [matrixID] = already_computed;
//printf ("\tNO MATRIX UPDATE %d (%d)\n", matrixID, already_computed->GetReferenceCounter());
//ObjectToConsole( (*computedExponentials) [matrixID] );
//already_computed ->AddAReference();
}
}
}*/

if (computedExponentials) {
_CalcNode * current_node = nil;
Expand Down

0 comments on commit c851484

Please sign in to comment.