I believe it can. If it is some kind of matematical iterative formula, there are (usually) ways to convert it into a standalone formula that would not depend on the previous result.
Otherwise, maybe some scans algorithm?
To tell you more I think we need to see your exact problem.
I’ve posted it in the past and made some progress however I’m still not happy with the results, and therefore I decided to ask a more general question to see if there
is indeed some sort of a parallel algorithm to do such thing.
Anyway here is the code and some insights:
The above loop/code cant be parallelized either as the results need to be checked serially.
iTimePlusCeeWindow - iTimeMinusCeeWindow can be assumed (at the moment) to be between 0…40
iTimeEnd - iTimeBegin can be 1…4000
int ceeWindow = ( int ) m_multifocParamSelectionWindow;
for( int iTime = iTimeBegin; iTime < iTimeEnd; iTime++ )
int iTimePlusCeeWindow = __min( iTime + ceeWindow, iTimeEnd-1 );
int iTimeMinusCeeWindow = __max( iTime - ceeWindow, 0 );
bool is_best = true;
double dCurrentCor = pCorTemp[ iTime ];
for ( int iSliceTime = iTimeMinusCeeWindow; iSliceTime <= iTimePlusCeeWindow; iSliceTime++ )
if ( m_ppCor_Temp_cre_angle_best[ i_rCre ][ iSliceTime ] > dCurrentCor )
is_best = false;
if ( is_best )
for ( int iSliceTime = iTimeMinusCeeWindow; iSliceTime < iTimePlusCeeWindow; iSliceTime++ )
m_ppCor_Temp_cre_angle_best[ i_rCre ][ iSliceTime ] = pCorTemp[ iSliceTime ];
m_ppStack_Temp_cre_angle_best[ i_rCre ][ iSliceTime ] = pStack_Temp_cre_angle[ iSliceTime ];