Random step vector.
()
| 18 | return (a * np.exp(-b * (x - xs)**2)).sum(axis=0) |
| 19 | |
| 20 | def g(): |
| 21 | '''Random step vector.''' |
| 22 | return np.random.uniform(-1,1) |
| 23 | |
| 24 | def metropolis_step(x, f=f, g=g): |
| 25 | '''Perform one full iteration and return new position.''' |