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

croposp [WP][FEATURE]: implement triple indexer

parent 953a25eb
......@@ -61,8 +61,28 @@ namespace croposp {
const unsigned int& l) const
{
unsigned int retval=0;
unsigned int npairs=this->pairs();
unsigned int size=this->size();
TFXX_assert((i!=k) && (k!=l) && (l!=i),
"triple indices must be unique");
"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");
if (this->Mpairs_first)
{
unsigned int ii=i;
if (ii>k) { --ii; }
if (ii>l) { --ii; }
retval=this->Mpairs.operator()(k,l)+ii*npairs;
}
else
{
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*npairs;
}
return(retval);
} // unsigned int Triples::operator()(const unsigned int& i,
// const unsigned int& k,
......
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