Mentions légales du service

Skip to content
Snippets Groups Projects
Commit c05aef89 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Simplify the code fro fibonacci 1p

parent cd9e458f
No related branches found
No related tags found
No related merge requests found
......@@ -122,52 +122,26 @@ void hqr_high_greedy1p_init(hqr_subpiv_t *arg){
ipiv = arg->ipiv;
{
int minMN = 1;
int j, k, height, start, end, firstk = 0;
int *nT = (int*)calloc(minMN, sizeof(int));
int *nZ = (int*)calloc(minMN, sizeof(int));
nT[0] = mt;
nZ[0] = libhqr_imax( mt - p, 0 );
for(k=1; k<minMN; k++) {
height = libhqr_imax(mt-k-p, 0);
nT[k] = height;
nZ[k] = height;
}
k = 0;
while ( (!( ( nT[minMN-1] == mt - (minMN - 1) ) &&
( nZ[minMN-1]+1 == nT[minMN-1] ) ) )
&& ( firstk < minMN ) ) {
height = (nT[k] - nZ[k]) / 2;
int j, height, start, end;
int nT, nZ;
nT = mt;
nZ = libhqr_imax( mt - p, 0 );
while ( !( ( nT == mt ) &&
( nT == nZ+1 ) ) )
{
height = (nT - nZ) / 2;
if ( height == 0 ) {
while ( (firstk < minMN) &&
( nT[firstk] == mt - firstk ) &&
( nZ[firstk]+1 == nT[firstk] ) ) {
firstk++;
}
k = firstk;
continue;
break;
}
start = mt - nZ[k] - 1;
start = mt - nZ - 1;
end = start - height;
nZ[k] += height;
if (k < minMN-1) {
nT[k+1] = nZ[k];
}
nZ += height;
for( j=start; j > end; j-- ) {
ipiv[ k*p + j-k ] = (j - height);
}
k++;
if (k > minMN-1) {
k = firstk;
ipiv[ j ] = (j - height);
}
}
free(nT);
free(nZ);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment