Skip to content

Commit

Permalink
python interface
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-aws committed Jul 29, 2024
1 parent a6c45aa commit 3a4e0a7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/py/Benchmarks/gaussian_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

for i in range(1100):
start_time = timeit.default_timer()
r.DiscreteGaussianSample(sigma_num, sigma_denom, 7)
r.DiscreteGaussianSample(sigma_num, sigma_denom)
elapsed = timeit.default_timer() - start_time
vmc.append(elapsed)

Expand Down
2 changes: 1 addition & 1 deletion docs/py/Benchmarks/gaussian_diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
title_ibm_dpl = 'IBM-DPL, Sigma = ' + str(sigma)

for _ in range(100000):
vmc_data.append(r.DiscreteGaussianSample(sigma_num, sigma_denom, 7))
vmc_data.append(r.DiscreteGaussianSample(sigma_num, sigma_denom))
ibm_dgdp_data.append(discretegauss.sample_dgauss(sigma_squared, rng))
ibm_dpl_data.append(g.randomise(0))

Expand Down
6 changes: 3 additions & 3 deletions docs/py/TestSamplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main():
print(r.BernoulliExpNegSample(i, j), end="\n")

print("Testing DiscreteGaussian("+str(i)+"/"+str(j)+")\n")
print(r.DiscreteGaussianSample(i, j, 7), end="\n")
print(r.DiscreteGaussianSample(i, j), end="\n")

print("Testing DiscreteLaPlace("+str(i)+"/"+str(j)+")\n")
print(r.DiscreteLaplaceSample(i, j), end="\n")
Expand All @@ -36,9 +36,9 @@ def main():
print(r.BernoulliExpNegSample(1, 1000000), end="\n")

print("Testing DiscreteGaussianSample(1000000, 1)\n")
print(r.DiscreteGaussianSample(1000000, 1, 7), end="\n")
print(r.DiscreteGaussianSample(1000000, 1), end="\n")
print("Testing DiscreteGaussianSample(1, 1000000)\n")
print(r.DiscreteGaussianSample(1, 1000000, 7), end="\n")
print(r.DiscreteGaussianSample(1, 1000000), end="\n")

print("Testing DiscreteLaplace(1000000, 1)\n")
print(r.DiscreteLaplaceSample(1000000, 1), end="\n")
Expand Down
3 changes: 3 additions & 0 deletions src/interop/py/Full/Random.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ def Shuffle(self, xs):
a = ArrayFromList(xs)
DafnyVMCPart.Random.Shuffle(self, a)
return list(a)

def DiscreteGaussianSample(self, num, denom):
return DafnyVMCPart.Random.DiscreteGaussianSample(self, num, denom, 7)

0 comments on commit 3a4e0a7

Please sign in to comment.