// You'd think that work items that span entire rows rather than squarish 2d regions would be faster because they'd // have fewer calls to metric.setTree1, but it turns out they're about 5% slower. [Robb P. Matzke 2014-09-27] void init() { WorkItem toDo; while (workList.next().assignTo(toDo)) { for (size_t i=toDo.iBegin; i<toDo.iEnd; ++i) { if (i<functions1.size()) { metric.setTree1(functions1[i]); for (size_t j=toDo.jBegin; j<toDo.jEnd; ++j) { if (j<functions2.size()) { distance(i, j) = metric.compute(functions2[j]).relativeCost(); } else { distance(i, j) = 0.0; } } } else { for (size_t j=toDo.jBegin; j<toDo.jEnd; ++j) { distance(i, j) = 0.0; } } } } }