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

♻️ Refactor functions to avoid the generateDensityMatrix flag #337

Open
33Gjl1Xe opened this issue Jun 15, 2022 · 0 comments
Open

♻️ Refactor functions to avoid the generateDensityMatrix flag #337

33Gjl1Xe opened this issue Jun 15, 2022 · 0 comments
Labels
DD Anything related to the DD package enhancement New feature or request good first issue Good for newcomers

Comments

@33Gjl1Xe
Copy link
Contributor

I am not a fan of adding the generateDensityMatrix flag to a ton of functions.

Unfortunately, C++ does not allow two functions that only differ in their return values. Otherwise it would be rather easy to get rid of this generateDensityMatrix parameter, which is only relevant for density matrices.

One potential solution for this would be to refactor these methods in the following fashion:

template<class LeftOperandNode, class RightOperandNode, class ResultNode>
void multiply2(const const Edge<LeftOperandNode>& x, const Edge<RightOperandNode>& y, Edge<ResultNode>& result, Qubit var, Qubit start = 0) {
  ...
}

This would allow for specializations of Matrix * Matrix -> Matrix and Matrix * Matrix -> Density Matrix.

Originally posted by @burgholzer in cda-tum/dd_package#72 (comment)

@33Gjl1Xe 33Gjl1Xe changed the title I am not a fan of adding the generateDensityMatrix flag to a ton of functions. Refactor functions to avoid the generateDensityMatrix flag Jun 15, 2022
@burgholzer burgholzer transferred this issue from cda-tum/dd_package Jun 15, 2023
@burgholzer burgholzer added enhancement New feature or request good first issue Good for newcomers DD Anything related to the DD package labels Jun 15, 2023
@burgholzer burgholzer changed the title Refactor functions to avoid the generateDensityMatrix flag ♻️ Refactor functions to avoid the generateDensityMatrix flag Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DD Anything related to the DD package enhancement New feature or request good first issue Good for newcomers
Projects
Status: Todo
Status: Todo
Development

No branches or pull requests

2 participants