Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Vlad Gheorghiu <[email protected]>
  • Loading branch information
vsoftco committed Nov 27, 2024
1 parent c8c8387 commit 2540583
Show file tree
Hide file tree
Showing 12 changed files with 369 additions and 132 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- Simplified MATLAB detection via CMake `find_package()` function. Users should
only use `-DQPP_MATLAB=ON` when building with MATLAB support, all other
MATLAB-related CMake flags have been removed.
- Bugfix in qpp::adjoint(QCircuit);

# Version 5.1 - 1 March 2024

Expand Down
1 change: 1 addition & 0 deletions examples/bb84.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// BB84 quantum key establishment
// Source: ./examples/bb84.cpp

#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <numeric>
Expand Down
13 changes: 13 additions & 0 deletions include/qpp/classes/exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,19 @@ class InvalidConditional : public Exception {
using Exception::Exception;
};

/**
* \class qpp::exception::CircuitContainsConditionals
* \brief Circuit contains conditional statements
*/
class CircuitContainsConditionals : public Exception {
public:
std::string description() const override {
return "Circuit contains conditionals";
}

using Exception::Exception;
};

} /* namespace exception */
} /* namespace qpp */

Expand Down
2 changes: 1 addition & 1 deletion include/qpp/classes/gates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ class Gates final : public internal::Singleton<const Gates> // const Singleton
// ctrl + gate subsystem vector
std::vector<idx> ctrlgate = ctrl;
std::sort(ctrlgate.begin(), ctrlgate.end());
ctrlgate.insert(ctrlgate.end(), target.begin(), target.end());
ctrlgate.insert(ctrlgate.end(), target.cbegin(), target.cend());
// FIXME if needed
// std::sort(ctrlgate.begin(), ctrlgate.end());

Expand Down
22 changes: 6 additions & 16 deletions include/qpp/classes/qbase_engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,17 @@ class QBaseEngine : public IQEngineTraits, public IDisplay, public IJSON {
* \note This function is a no-op in qpp::QBaseEngine; override it in all
* derived classes to achieve the desired behaviour
*
* \param elem Step to be executed
* \param it Iterator to the step to be executed
* \return Reference to the current instance
*/
virtual QBaseEngine& execute(
[[maybe_unused]] const typename QCircuitTraits<QCT>::value_type& elem) {
virtual QBaseEngine&
execute([[maybe_unused]] typename QCircuitTraits<QCT>::iterator_type it) {
return *this;
};

QBaseEngine& execute([[maybe_unused]]
typename QCircuitTraits<QCT>::value_type step) {}

/**
* \brief Executes the entire quantum circuit description
* \note This function is a no-op in qpp::QBaseEngine; override it in all
Expand Down Expand Up @@ -165,19 +168,6 @@ class QBaseEngine : public IQEngineTraits, public IDisplay, public IJSON {
return *this;
}

/**
* \brief Executes one step in the quantum circuit description
*
* \note Do not override!
*
* \param it Iterator to the step to be executed
* \return Reference to the current instance
*/
QBaseEngine&
execute(const typename QCircuitTraits<QCT>::iterator_type& it) {
return this->execute(*it);
}

/**
* \brief Quantum circuit description, lvalue ref qualifier
*
Expand Down
Loading

0 comments on commit 2540583

Please sign in to comment.