Skip to main content
. 2010 Feb 16;132(7):074101. doi: 10.1063/1.3310809
 
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:   PDVPDVLookupTable[nk]
7: else
8:   PDV←exp(TransitionMatrixnk×D∕ℓ2×τD)×[1,0,0,⋯,0]T
9:   ifPDV[end]>ErrorTolerance∕2Lthen
10:    nmaxnk
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 XU(0,1)
16:  Find the smallest integer μ such that j=1μPDV[j]>X
17:  return Output State←StateListnk[μ]
18: end if