|
Algorithm 2 DFSP diffusion step with splitting
|
INPUT:nk, τD, TransitionMatrixn, StateListn, ErrorTolerancen
|
OUTPUT: Output State |
1: initialize once: PDVLookupTable, nmax←∞, L←0 |
2: ifnk>=nmaxthen
|
3: return Output State←DFSP_Diffusion(⌊nk∕2⌋,L+1) +DFSP_Diffusion(⌈nk∕2⌉,L+1) |
4: else
|
5: ifPDVLookupTable contains nkthen
|
6: PDV←PDVLookupTable[nk] |
7: else
|
8: PDV←exp(TransitionMatrixnk×D∕ℓ2×τD)×[1,0,0,⋯,0]T
|
9: ifPDV[end]>ErrorTolerance∕2Lthen
|
10: nmax←nk
|
11: return Output State←DFSP_Diffusion(⌊nk∕2⌋) +DFSP_Diffusion(⌈nk∕2⌉) |
12: end if
|
13: PDVLookupTable[nk]←PDV
|
14: end if
|
15: Generate a random number X∊U(0,1) |
16: Find the smallest integer μ such that
|
17: return Output State←StateListnk[μ] |
18: end if
|