Giter VIP home page Giter VIP logo

Comments (11)

CatalinaAlbornoz avatar CatalinaAlbornoz commented on July 23, 2024

Hi @amanuelanteneh, thanks for reporting this.
Can you please post the output of running: import thewalrus; thewalrus.about() ?

Also, if you can post your full code it will make it easier to see if we can reproduce your problem.

from thewalrus.

amanuelanteneh avatar amanuelanteneh commented on July 23, 2024

Hi @CatalinaAlbornoz,
Here is the output of thewalrus.about():

The Walrus: a Python library for for the calculation of hafnians, Hermite polynomials, and Gaussian boson sampling.
Copyright 2018-2021 Xanadu Quantum Technologies Inc.

Python version:            3.8.8
Platform info:             Linux-3.10.0-1127.19.1.el7.x86_64-x86_64-with-glibc2.10
Installation path:         /home/ph/.local/lib/python3.8/site-packages/thewalrus
The Walrus version:        0.19.0
Numpy version:             1.19.2
Scipy version:             1.5.2
SymPy version:             1.6.2
Numba version:             0.51.2

This is the full function that i use to generate the samples and the only place I use functions from the walrus:

def generateSamples(adjMatrix, numSamples, meanN, displacement, maxPhotons):
  modes = adjMatrix.shape[0]

  A = adjMatrix
  Q = gen_Qmat_from_graph(A, meanN)
  V = Covmat(Q, hbar=2) #the covaraince matrix of the pure gaussian state 
  d = np.full( shape=(2*modes), fill_value=displacement, dtype=np.float64 ) 
  samples = torontonian_sample_state(cov=V, mu=d, samples=numSamples, max_photons=maxPhotons)

  return(samples)

It takes in the adjacency matrix of a graph and uses functions from the walrus to embed the matrix into a GBS device which i then sample from. I call this function multiple times for a dataset of graphs. The function seems to run in the expected amount of time when displacement equals 0 but for displacements of 0.1 and 0.25 on each mode the runtime increases very drastically (from about 8 hours to over 7 days) which i don't believe should be the case.

from thewalrus.

CatalinaAlbornoz avatar CatalinaAlbornoz commented on July 23, 2024

Thank you @amanuelanteneh. We will take a look into this.

from thewalrus.

amanuelanteneh avatar amanuelanteneh commented on July 23, 2024

@CatalinaAlbornoz Thanks! It might also be that this isn't how the displacement is meant to be specified however I can't find any example code on how to sample from a displaced Gaussian state using thewalrus so I'm unsure.

from thewalrus.

ziofil avatar ziofil commented on July 23, 2024

The slowdown should only be 2x. How many modes are you working with?

from thewalrus.

amanuelanteneh avatar amanuelanteneh commented on July 23, 2024

@ziofil on average the number of nodes in the graphs I'm looking at is about 25 so around 50 modes on average.

from thewalrus.

ziofil avatar ziofil commented on July 23, 2024

Those are a lot of modes... I'm wondering if the slowdown is due to other effects (like memory swapping and so on). Could you try with fewer modes and see if the slowdown is the same?

from thewalrus.

ziofil avatar ziofil commented on July 23, 2024

also, how sparse is your adjacency matrix?

from thewalrus.

amanuelanteneh avatar amanuelanteneh commented on July 23, 2024

The adjacency matrices range in sparsity but the majority seem fairly sparse.

from thewalrus.

CatalinaAlbornoz avatar CatalinaAlbornoz commented on July 23, 2024

Thank you @amanuelanteneh. Does having fewer modes give you the same slowdown? Or do you have the same slowdown with fewer modes?

from thewalrus.

amanuelanteneh avatar amanuelanteneh commented on July 23, 2024

Hello, I've been running some more simulations and it appears that the issue is no longer a problem. Sorry for the delay in response.

from thewalrus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.