Commit bcd7e86f authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp [WP][FEATURE]: let both triple modes provide reasonable index values

parent 7940c3c2
......@@ -155,7 +155,7 @@ int main(int iargc, char* argv[])
cout << TFXX_value(i) << " "
<< TFXX_value(k) << " "
<< TFXX_value(l) << " "
<< TFXX_value(triples_pf(i,k,l)) << endl;
<< TFXX_value(triples_sf(i,k,l)) << endl;
}
}
}
......
......@@ -66,18 +66,21 @@ namespace croposp {
"triple indices must be unique; report this as a bug");
TFXX_assert((i<size) && (k<size) && (l<size),
"index value(s) out of range; report this as a bug");
croposp::Pairs pairs(size-1);
unsigned int kk=k;
unsigned int ll=l;
if (kk>i) { --kk; }
if (ll>i) { --ll; }
if (this->Mpairs_first)
{
croposp::Pairs pairs(size-1);
unsigned int kk=k;
unsigned int ll=l;
if (kk>i) { --kk; }
if (ll>i) { --ll; }
retval=pairs(kk,ll)+i*pairs.pairs();
}
else
{
retval=pairs(kk,ll)*pairs.size()+i;
unsigned int ii=i;
if (ii>k) { --ii; }
if (ii>l) { --ii; }
retval=this->Mpairs.operator()(k,l)*(this->size()-2)+ii;
}
return(retval);
} // unsigned int Triples::operator()(const unsigned int& i,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment