06: Do minor speed improvements
This commit is contained in:
@ -294,8 +294,8 @@
|
||||
" s_i_n = -state[site]@nhat\n",
|
||||
" for nbr in neighboring_sites(site,w):\n",
|
||||
" s_j_n = state[nbr]@nhat\n",
|
||||
" p_add = 1 - np.exp(-2*beta*s_i_n*s_j_n)\n",
|
||||
" if np.sign(s_i_n) == np.sign(s_j_n) and rng.uniform() < p_add:\n",
|
||||
" one_minus_p_add = np.exp(-2*beta*s_i_n*s_j_n)\n",
|
||||
" if np.sign(s_i_n) == np.sign(s_j_n) and rng.uniform() > one_minus_p_add:\n",
|
||||
" state[nbr] -= 2*s_j_n*nhat\n",
|
||||
" unvisited.appendleft(nbr)\n",
|
||||
" cluster_size += 1\n",
|
||||
@ -311,7 +311,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 107,
|
||||
"execution_count": 109,
|
||||
"id": "3f810041",
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
@ -342,7 +342,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 108,
|
||||
"execution_count": 110,
|
||||
"id": "bde560e4",
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
|
||||
Reference in New Issue
Block a user