You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation relies on this recursive function; however it seems likely that it should be possible to compute without recursion, or at least with less of it:
static private size_tunorderedlength(size_t size)(insize_t ilen){
staticif(size ==0){
return ilen >0 ? 1 : 0;
}elsestaticif(size ==1){
return ilen;
}elsestaticif(size ==2){
// Same as `ilen + unorderedlength!size(ilen - 1)`// And as `ilen * (ilen + 1) / 2`, but without overflowimmutable x = ilen +1;
return (ilen /2) * x + ((ilen & 1) * x) /2;
}else{
if(ilen <=1){
return ilen;
}else{
return unorderedlength!(size)(ilen -1) + unorderedlength!(size -1)(ilen);
}
}
}
The text was updated successfully, but these errors were encountered:
pineapplemachine
changed the title
Investigate more efficient length function for UnorderedCartPowerRange in mach.range.cartpower
Investigate more efficient length function for UnorderedCartPowerRange in mach.range.cartpower
Mar 3, 2017
The current implementation relies on this recursive function; however it seems likely that it should be possible to compute without recursion, or at least with less of it:
The text was updated successfully, but these errors were encountered: