LLNL/quandary

Extending Gate Class

Closed this issue · 2 comments

It says in the manual that “New, user-defined gates can be easily added to the code by extending the Gate class in the corresponding .cpp and .hpp files.”. Is this really enough? It seems that I also need to make changes in https://github.com/LLNL/quandary/blob/master/src/optimproblem.cpp (see, for example, lines 75-82).

I want to add a new gate which depend on a new parameter other than the ones provided in Gate class, let’s call the parameter gate_param_. Other than updating gate.hpp and gate.cpp, what else should I change?

When Quandary parses the .cfg file, will it look for gate_param and expect a list of gate parameters without further changes? If not, what should I do to define gate_param as a configuration option in .cfg file?

I think I’ve figured it out. I’ve updated the following files to define parametrized gates. I will commit the changes soon.

Files to be updated:

optimproblem.hpp
gate.hpp

optimproblem.cpp
main.cpp
gate.cpp

.cfg files

Great! Please create a pull request then. Thanks!