Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Harshit Garg
    @githg22_gitlab

    @githg22_gitlab - what's the difference between LocalRotationsLayer and ControlledRotations?

    It applies the uncontrolled rotations, so far as I have understood

    Amir Ebrahimi
    @amirebrahimi
    Thank you both.
    Chris Granade
    @cgranade
    @amirebrahimi: This is actually a broader community for Q# developers and users, but it's really cool to see everyone from the contest! If you're interested in the Q# community, I'd encourage checking out what the Q# community has done at https://qsharp.community. There's some neat blog posts, GitHub projects, and so forth hosted there.
    @githg22_gitlab: There's indeed not a formatter for Q# yet, but that could be a great feature request at https://github.com/microsoft/qsharp-compiler/, or if you'd like to contribute one yourself, you may be interested in checking out some other compiler extensions such as the one @crazy4pi314 and @bettinaheim were working on in their stream yesterday at https://www.twitch.tv/videos/649894848 and in @crazy4pi314's fork at https://github.com/crazy4pi314/qsharp-compiler.
    Harshit Garg
    @githg22_gitlab

    @githg22_gitlab: There's indeed not a formatter for Q# yet, but that could be a great feature request at https://github.com/microsoft/qsharp-compiler/, or if you'd like to contribute one yourself, you may be interested in checking out some other compiler extensions such as the one @crazy4pi314 and @bettinaheim were working on in their stream yesterday at https://www.twitch.tv/videos/649894848 and in @crazy4pi314's fork at https://github.com/crazy4pi314/qsharp-compiler.

    I'll check them out thanks

    Amir Ebrahimi
    @amirebrahimi
    Well, that was a lot of fun :) I see you came out right above me @githg22_gitlab. It's quite hilarious to me how much of the time I spent was just about getting the dev environment set up, learning how the Q# QML approach is architected, and figuring out how to reduce the training time iterations.

    @amirebrahimi: This is actually a broader community for Q# developers and users, but it's really cool to see everyone from the contest! If you're interested in the Q# community, I'd encourage checking out what the Q# community has done at https://qsharp.community. There's some neat blog posts, GitHub projects, and so forth hosted there.

    Thanks, @cgranade - I remember hearing about this community a while back I think from an interview you had either on QCN or meQuanics. Good to finally jump into Q# and give it a try. It's an interesting model and very different from the rest. In some ways I feel more restricted though.

    Harshit Garg
    @githg22_gitlab

    Well, that was a lot of fun :) I see you came out right above me @githg22_gitlab. It's quite hilarious to me how much of the time I spent was just about getting the dev environment set up, learning how the Q# QML approach is architected, and figuring out how to reduce the training time iterations.

    Haha. I agree with a lot of time spent over setting up the environment.

    Chris Granade
    @cgranade
    @amirebrahimi: No worries, happy to help, and glad you're having fun jumping into Q#! If I may ask to try and understand, what do you mean by more restricted?
    @githg22_gitlab: No worries, happy to help!
    Sarah Kasier
    @crazy4pi314

    Welcome everyone, its really exciting to see so many new faces here! Hopefully the warm-ups have been going well πŸ˜„

    @githg22_gitlab I have been wanting to work on a Q# linter/code formatter for a while, that would be a great project if you wanted to collaborate with the community here! (also my code would look so much nicer :P )

    Sarah Kasier
    @crazy4pi314
    And to build on what @cgranade mentioned, the qsharp.community group is a great place for sharing and building your Q# code and knowledge! We are always looking for posts on any Q# related projects you are working on, projects for folks to collaborate building and that the community can help maintain as the language evolves. Some great examples of posts can be found on the blog and we have a growing collection of projects too! I am working on a project with some other community members where we are creating a new library to implement memory for a quantum computer (sometimes called qRAM).
    Amir Ebrahimi
    @amirebrahimi

    @cgranade - It's nuanced for me and perhaps just temporary by the current level of documentation or feature set: not being able to construct a gate from a unitary directly, not being able to easily construct a kronecker product of pauli matrices without having to create a new operation, not being able to print the circuit easily (or having the concept of a circuit), etc. I think having used Cirq a little bit and mostly having used Qiskit it's me adjusting to the difference.

    Now on the + side: I love being able to use Visual Studio (keybindings for commenting selected blocks would go a long way though!). I love having the easy connection to work with C#. I love the representation of data structures in QDK.

    Thanks, @crazy4pi314 / @cgranade - Also, happily picked up a copy of your book during ISCA 2020 w/ the promo.
    Sarah Kasier
    @crazy4pi314
    I can address maybe a little bit of this:
    • Re: the kronecker product you don't have to do this in Q#. If you want to apply say XYXZ to a register of 4 qubits you can use the ApplyPauli operation. One of the design goals of Q# is to get the user to be thinking about the algorithms at a higher level and not needing to construct matrices.
    And yeah I use visual studio code and having intelesense there is hella nice
    Chris Granade
    @cgranade

    Thanks for the feedback, I really appreciate it, @amirebrahimi! I think if I could offer some clarification as to some of what you raised, Q# really is at some level about sending instructions to a quantum device, rather than about constructing matrices for those instructions. One of the architects on the Quantum Development Kit team, Alan Geller, summarized it a couple years ago as that Q# exists "because we want to build algorithms, not circuits." From that perspective, matrix decompositions are the things we keep in our heads, or internal to the simulator as we write Q# code.

    It's entirely possible to mesh that with thinking of state vectors and unitary matrices as special kinds of programs, however. The PrepareArbitraryState operation takes an array of complex numbers describing a state vector, and uses them to prepare that state by decomposing that input into the right sequence of instructions needed to do so. The same approach would work well for inputs that represent unitary matrices, of course; if you're interested, that could be a great feature request or even contribution.

    In any case, we definitely really appreciate the feedback; I'll be sure to pass that along. Thanks as well for picking up our book, @crazy4pi314 and I really appreciate it!
    Sarah Kasier
    @crazy4pi314

    Seconded! :sparkling_heart:

    To the bit about not really using circuit representations, that goes to the design goal again where the user shouldn't need to think about specific gate sequences (people building the language and runtime are) to be able to code their quantum program. As a former QC researcher myself who really liked the circuit representations (I was an experimentalist :P ), I have really grown to like not having to use them, and thinking more like I would for writing in any other programming language when I write quantum code (maps/apply/list comprehensions/types etc.).

    Sarah Kasier
    @crazy4pi314
    .m. Me mm
    Amir Ebrahimi
    @amirebrahimi
    Thank you both for this information. Since this is a different approach it might be helpful to call it out from the outset in the documentation for newcomers. I find that "setting the frame" can help to put someone into a specific mindset. Ideally, I'd put this info at every entry point where Q# is mentioned in the docs. I'd be happy to make the PR to the docs assuming this is agreeable, @cgranade. NM, for some reason I thought that the docs were in a github repo. I can create an issue for it though if preferred.
    Sarah Kasier
    @crazy4pi314
    You can find a list of the official repos in the docs or on https://qsharp.community/resources/#
    Amir Ebrahimi
    @amirebrahimi
    Ahh...in that case, I'll just wait to hear from you @cgranade if you like what I'm proposing.
    Amir Ebrahimi
    @amirebrahimi
    @crazy4pi314 - re: your suggestion - would it be something like PrepareArbitraryOperation(unitary : Microsoft.Quantum.Math.Complex[][]) that would then decompose into sequences of instructions?
    Chris Granade
    @cgranade
    @amirebrahimi: I'm not personally in charge of docs (I help out here and there, but my main job is running the Q# libraries), but if you want to file an issue on the docs repo that @crazy4pi314 linked to, or even start a pull request, the docs team can chime in that way. I'm also happy to provide feedback if that'd be helpful.
    Amir Ebrahimi
    @amirebrahimi
    Thanks. Will do. Also in my previous comment I tagged @crazy4pi314, but see that you actually made the suggestion.
    Mridul Sarkar
    @mridulsar
    anyone here have an idea as to why this error is being thrown? I have opened the necessary name space for this. fail: Microsoft.Quantum.IQSharp.Workspace[0]
    QS5022: No identifier with the name "ApplytoEach" exists.
    Sarah Kasier
    @crazy4pi314
    Sometimes that can come up it the version numbers for different components don't match? Without more detail it's hard to diagnose.

    New Show Starting TODAY! πŸŽ‰

    Come join me on #twitchtv and ask me your burning questions about #QSharp, #QuantumComputing more generally, or what its like working in a quantum optics lab or as a quantum software developer!

    πŸ‘€Tuesdays 10am-12pm PDT: twitch.tv/crazy4pi314

    Mridul Sarkar
    @mridulsar
    Thank you for the quick reply! I will post a snippet of code shortly so the question is more clear.
    Sarah Marshall
    @samarsha

    QS5022: No identifier with the name "ApplytoEach" exists.

    Q# is case-sensitive, can you try changing ApplytoEach to ApplyToEach in your code?

    Mridul Sarkar
    @mridulsar
    Oh wow, haha should have got some sleep and worked on it. That did it for me. Thanks for catching that @samarsha
    Sarah Kasier
    @crazy4pi314
    Good catch @samarsha πŸ’—
    Sarah Marshall
    @samarsha
    No problem :) It would be cool if the error message/IDE was more helpful here, there's a feature request for that: microsoft/qsharp-compiler#205
    Chris Granade
    @cgranade
    @samarsha Nice! πŸ’•
    @amirebrahimi: Apologies for missing your message! I guess my suggestion was just that an ApplyUnitaryOperation operation that takes a Complex[][] input to describe a unitary and a LittleEndian register to apply it to would be a nice parallel to the existing PrepareArbitraryState operation.
    Amir Ebrahimi
    @amirebrahimi
    Thanks for confirming, @cgranade. Sounds like something fun to work on. I'll dig around to see how hard it is to convert arbitrary unitaries to gate operations.
    Harshit Garg
    @githg22_gitlab
    Do I need to update my Q# for the codeforces main event?
    I have 2005 one rn
    Just asking in advance
    Since I saw there was a 2006 version release
    Mariia Mykhailova
    @tcNickolas_twitter
    @githg22_gitlab I'm not sure we even have 2005... :-) Codeforces tester uses 0.11.2004.2825, same as in the warmup round
    Harshit Garg
    @githg22_gitlab
    My bad. Must be 2004 then.
    Seems good then, thanks
    Chris Granade
    @cgranade
    You can always see the list of releases for any given package at nuget.org. For instance, the list of versions for the IQ# tool are up at https://www.nuget.org/packages/Microsoft.Quantum.IQSharp. As @tcNickolas_twitter notes, there is no 0.11.2005.* version, as our release for that month came in the early days of June instead.
    Amir Ebrahimi
    @amirebrahimi

    When I have two using blocks one after another, I notice some odd behavior w/ Reset() by looking at the output of DumpRegister(). Ex:

    using (q1 = Qubit()) {
                X(q1);
                Rz(PI() / 2.0, q1);
                DumpRegister((), [q1]);
                let m1 = M(q1);
                Reset(q1);
            }
    using (q1 = Qubit()) {
                ResetAll([q1]);
                DumpRegister((), [q1]);
                Reset(q1);
            }

    Output:

    # wave function for qubits with ids (least to most significant): 0
    ∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]
    ∣1❭:     0.707107 +  0.707107 i  ==     ********************* [ 1.000000 ]      /  [  0.78540 rad ]
    # wave function for qubits with ids (least to most significant): 0
    ∣0❭:     0.707107 +  0.707107 i  ==     ********************* [ 1.000000 ]      /  [  0.78540 rad ]
    ∣1❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]

    It did reset back to |0>, but looks like the state isn't reflecting that correctly. Any idea why?

    Chris Granade
    @cgranade
    @amirebrahimi The state (1 / √2 + 𝑖 / √2) |0⟩ is identical to |0⟩, up to a global phase, such that the state reported in the last call to DumpRegister((), _) shows that the register is in fact in the |0⟩ state following the call to the ResetAll operation.
    Chris Granade
    @cgranade
    @amirebrahimi Another way to see that is to write out the coefficient of each basis state in what's called phasor notation. For instance, 0 = 𝑒^{𝑖 0 Ο€}, while (1 / √2 + 𝑖 / √2) = 𝑒^{𝑖 Ο€ / 4}, so that you can think of (1 / √2 + 𝑖 / √2) as being a 45Β° phase. If you use IQ# to call DumpMachine, then you can get the rich HTML output, which visualizes that coefficient as an arrow rotated by 45Β°.
    Sarah Kasier
    @crazy4pi314
    Also a heads up, @bettinaheim and I'll will be working on extending the Q# compiler today on stream in about 30min : twitch.tv/crazy4pi314