Coder Social home page Coder Social logo

Comments (6)

david-pl avatar david-pl commented on July 29, 2024 1

Hi!

First off, an example including LazyTensor is currently under development by @Datseris and it is correct that it's meant as a tool for composite particle systems.

Now, concerning your example: the basis arguments in the LazyTensor function are the left and the right basis of the composite operator, i.e. the basis for the operator Tpx ⊗ Tpx. Therefore, each of them has to be a composite basis. In other words, b_pos and b_mom describe a single particle in position and momentum space, respectively. In order to use them for the LazyTensor you need them to describe the product space, which you can do by tensor(b_pos, b_pos) or simply b_pos^2. Also, you need to pass them in opposite order as you did.

Another problem here, though, is with the current lack of a tensor product implementation of FFTOperator (see qojulia/QuantumOptics.jl#190). So you can build the LazyTensor as you do, but you cannot use it for much. If you are really interested in the composite transformation operator, you can build and use it by converting it with full(T_px) like this:

b_pos = PositionBasis(-10, 10, 200)
b_mom = MomentumBasis(b_pos)
T_px = transform(b_mom, b_pos)
T = LazyTensor(b_mom^2, b_pos^2, [1,2], [T_px, T_px]) # LazyTensor that can't be used for much
T_full = LazyTensor(b_mom^2, b_pos^2, [1,2], [T_px, T_px]) # LazyTensor that can be applied to states

Note, though, that using this composite FFTOperator in combination with a LazyProduct like in the documentation, e.g. for

p = momentum(b_mom)
LazyProduct(T_full, tensor(p, p))

will not give you any advantage in performance. This is because we had to convert the FFTOperator to DenseOperator with full(). Implementing the tensor product for FFTOperator is on the list of coming implementations, for now though it is better to simply use p = momentum(b_pos).

I hope this helps!

Cheers,
David

from quantumoptics.jl-examples.

Datseris avatar Datseris commented on July 29, 2024

ooooops @david-pl forgot to do the PR. I will get to it after lunch!

from quantumoptics.jl-examples.

liuzheng1990 avatar liuzheng1990 commented on July 29, 2024

@david-pl Thanks very much, David! That really helps. I'm looking forward to seeing the tensor product of FFTOperator implemented. By then, the lazy objects will be a good tool for simulating many-particle systems. By the way, I guess there was a typo in the T_full = LazyTensor(...) line? I looks identical to its preceding line :)

from quantumoptics.jl-examples.

david-pl avatar david-pl commented on July 29, 2024

@liuzheng1990 You're welcome! Oh yes, sorry! It should be

T_full = full( LazyTensor(b_mom^2, b_pos^2, [1,2], [T_px, T_px]))

of course.

from quantumoptics.jl-examples.

david-pl avatar david-pl commented on July 29, 2024

@liuzheng1990 New implementations such that the FFTOperator and lazy operations can be combined are now merged into the master branch of QuantumOptics.jl. Additionally, the example by @Datseris can now be found here: https://github.com/qojulia/QuantumOptics.jl-examples/blob/master/notebooks/wavepacket2D.ipynb
I am currently updating the docs and the example will appear in the documentation once it is ready to be uploaded to the website.

from quantumoptics.jl-examples.

david-pl avatar david-pl commented on July 29, 2024

The example mentioned above has been on-line in the docs for some time now and can be found here: https://qojulia.org/documentation/examples/wavepacket2D.html

from quantumoptics.jl-examples.

Related Issues (5)

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.