Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tensornet] Support trajectory simulation for unitary mixture noise channels #2520

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

1tnguyen
Copy link
Collaborator

@1tnguyen 1tnguyen commented Jan 20, 2025

Description

(1) Add support for cutensornetStateApplyUnitaryChannel

  • Perform trajectory-based simulation if there are noise ops applied to the state.

  • Throw error if seeing non-unitary noise ops.

  • MPS has a custom implementation (override) for trajectory sample/observe as it needs to recompute the state for each trajectory.

  • Enable noise tests for tensornet backends.

(2) Some minor updates to tensornet backends

  • Replace a couple of deprecating enums.

  • Make the number of hyper samples a configuration param and add the corresponding doc.

Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jan 20, 2025
Signed-off-by: Thien Nguyen <[email protected]>
Signed-off-by: Thien Nguyen <[email protected]>
Signed-off-by: Thien Nguyen <[email protected]>
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jan 22, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jan 22, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jan 23, 2025
Signed-off-by: Thien Nguyen <[email protected]>
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jan 24, 2025
github-actions bot pushed a commit that referenced this pull request Jan 29, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jan 29, 2025
Signed-off-by: Thien Nguyen <[email protected]>
github-actions bot pushed a commit that referenced this pull request Jan 30, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@1tnguyen 1tnguyen marked this pull request as ready for review January 30, 2025 04:31
return std::make_pair(probs, mats);
}

void SimulatorTensorNetBase::applyNoiseChannel(
Copy link
Collaborator

@sacpis sacpis Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function seems super huge. Can we please modularize the code in it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, refactored in 7542c74

const std::vector<std::complex<double>> matPauliX{
{0.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {0.0, 0.0}};
const std::vector<std::complex<double>> matPauliY{
{0.0, 0.0}, {0.0, 1.0}, {0.0, -1.0}, {0.0, 0.0}};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't PauliY be {0.0, 0.0}, {0.0, -1.0}, {0.0, 1.0}, {0.0, 0.0}?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks.

Fixed in 8720fef also added a specific test case in a7e964b

@@ -153,6 +153,149 @@ class SimulatorMPS : public SimulatorTensorNetBase {
SimulatorTensorNetBase::applyExpPauli(theta, controls, qubitIds, op);
}

/// @brief Sample a subset of qubits
cudaq::ExecutionResult sample(const std::vector<std::size_t> &measuredBits,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's modularize this function as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored in d0fc6e7

return counts;
}

cudaq::observe_result observe(const cudaq::spin_op &ham) override {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this too, please.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored in d0fc6e7

@sacpis
Copy link
Collaborator

sacpis commented Jan 30, 2025

Once we modularize the long functions, can we please throw in some unittests? I will go through the PR again once we have the changes.

@1tnguyen 1tnguyen changed the title [WIP][Tensornet] Support trajectory simulation for unitary mixture noise channels [Tensornet] Support trajectory simulation for unitary mixture noise channels Jan 30, 2025
github-actions bot pushed a commit that referenced this pull request Jan 30, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jan 30, 2025
@1tnguyen
Copy link
Collaborator Author

Once we modularize the long functions, can we please throw in some unittests? I will go through the PR again once we have the changes.

Thanks. I added a new unit test for the matrix representation bug that is not detectable by sample/observe tests. The existing tests in noise_tester.cpp (now enabled for cutensornet backends) would cover noisy simulation functionality.

github-actions bot pushed a commit that referenced this pull request Jan 31, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants