Closed
Conversation
Add an apply_noise operator. Teach the bridge to recognize cudaq::apply_noise and lower it. Add a pass to erase apply_noise operations. Modify QIR codegen to generate the C++ callback. Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Collaborator
|
Probably coming in a bit too early, but pulled this to kick the tires. Couple of bugs for this kraus_channel #include "cudaq.h"
namespace test {
struct my_channel : public ::cudaq::kraus_channel {
my_channel(const std::vector<double> ¶ms) {
std::vector<cudaq::complex> k0v{std::sqrt(1 - params[0]), 0, 0,
std::sqrt(1 - params[0])},
k1v{0, std::sqrt(params[0]), std::sqrt(params[0]), 0};
push_back(cudaq::kraus_op(k0v));
push_back(cudaq::kraus_op(k1v));
}
};
} // namespace test
__qpu__ void test2(double d) {
cudaq::qubit q;
x(q);
cudaq::apply_noise<test::my_channel>(d, q);
}
First one is that we do want apply_noise implemented such that the kraus_channel is returned from the noise_model. As of now we get an error for KrausChannelT not be default constructible. /workspaces/cuda-quantum/runtime/cudaq/qis/qubit_qis.h:49:17: error: no matching constructor for initialization of 'test::my_channel'
KrausChannelT channel;Next issue is that the double argument here is passed by reference, so the type that the bridge sees is ericNoise.cpp:23:3: error: apply_noise argument types not supported.
cudaq::apply_noise<test::my_channel>(d, q);
^ |
qubits, which cannot be copied. Thread the pointer through all the places where there were floating-point types. Update tests. Add a bit more smart to the cudaq::apply_noise stub. Automatically counts the leading number of floating-point arguments, so the user doesn't have to supply this information. Uses the applyNoiseImpl<> template as is. Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an apply_noise operator.
Teach the bridge to recognize cudaq::apply_noise and lower it.
Add a pass to erase apply_noise operations.
Modify QIR codegen to generate the C++ callback.
Description