fork download
  1. Result calculate(Flip_Flop* chn,bool** src,size_t* seq,size_t chnLength,size_t srcLength)
  2. {
  3. size_t changedArrayLength=srcLength*chnLength-1;
  4. bool* changedArray=new bool[changedArrayLength];
  5.  
  6. size_t exeTime=0;
  7. for(size_t i=0;i<srcLength;++i)
  8. {
  9. for(size_t j=0;j<chnLength-1;++j)
  10. {
  11. changedArray[exeTime]=src[i][seq[j]] ^ src[i][seq[j+1]];
  12. exeTime++;
  13. }
  14. if(i!=srcLength-1)
  15. {
  16. changedArray[exeTime]=src[i][seq[chnLength-1]] ^ src[i+1][seq[0]];
  17. exeTime++;
  18. }
  19. }
  20. vector<TestCase*>* cases=new vector<TestCase*>((srcLength-1)*chnLength,NULL);
  21. //vector<TestCase*> cases((srcLength-1)*chnLength);
  22. //#pragma omp parallel for
  23. for(int i=0;i<cases->size();i++)
  24. {
  25. double peakPower=0;
  26. for(size_t j=0;j<chnLength;j++)
  27. {
  28. if(changedArray[i+j])
  29. {
  30. peakPower+=chn[chnLength-j-1].Power();
  31. }
  32. }
  33. cases->at(i)=new TestCase(peakPower,i);
  34. }
  35. return Result(seq,cases);
  36. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty