Skip to content

Commit 1885ac8

Browse files
committed
Optimized qpp::sample()
Signed-off-by: Vlad Gheorghiu <vsoftco@gmail.com>
1 parent b48158c commit 1885ac8

15 files changed

Lines changed: 347 additions & 271 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ mat.txt
6666
examples/_*.cpp
6767
out.tmp
6868
TODO.txt
69+
NOTES.txt
6970
test
7071

7172
# pyqpp

CHANGES.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Version 7.0.0 - xx December 2025
1+
# Version 7.0.0 - xx March 2026
22

33
- Significant performance improvements (10x to 1000x) for qubit state
44
manipulation and qubit circuit execution through extensive optimizations of
5-
`qpp::apply()` and `qpp::applyCTRL()`
5+
`qpp::apply()`, `qpp::applyCTRL()`, and `qpp::measure_seq()`.
66
- **pyqpp** is now feature complete, providing Python users with
77
complete access to the full **Quantum++** API
8-
- Switched back to MAJOR.MINOR.PATCH release versioning system:
8+
- Switched to MAJOR.MINOR.PATCH release versioning system:
99
- MAJOR -- introduces significant changes that break backward compatibility
1010
- MINOR -- may include limited or minor compatibility breaks
1111
- PATCH -- fully backward compatible fixes and improvements
12-
- Renamed the `qpp::Bit_circuit` to `qpp::BitCircuit` and
12+
- Renamed the class `qpp::Bit_circuit` to `qpp::BitCircuit` and the class
1313
`qpp::Dynamic_bitset` to `qpp::DynamicBitset` in ["qpp/classes/reversible.hpp"]
1414
- Renamed the class `internal::QCircuitConditionalStep` to
1515
`internal::QCircuitRuntimeStep`, and the corresponding
@@ -22,14 +22,16 @@
2222
`qpp::QCircuit::set_dits_runtime(mutable_dits_functor_t dits)`. Here
2323
`mutable_dits_functor_t` is an alias to an internal mutable functor defined
2424
in ["qpp/internal/classes/qcircuit_runtime_step.hpp"]
25-
- Changed `cond_func_t` type alias to `cond_pred_t` for
26-
Boolean predicates in conditional statements and moved the type alias from
25+
- Changed `cond_func_t` type alias to `cond_pred_t` for Boolean predicates in
26+
conditional statements and moved the type alias from
2727
["qpp/types.hpp"] to
2828
["qpp/internal/classes/qcircuit_runtime_step.hpp"]; alias to an internal type.
2929
- Added
3030
["examples/circuits/runtime_set_dits.cpp"](https://github.com/softwareQinc/qpp/blob/main/examples/circuits/runtime_set_dits.cpp)
3131
- Conditional statements are now indented with tabs when displaying
32-
qpp::QCircuit instances
32+
`qpp::QCircuit` instances
33+
- API change in `qpp::sample(A, target, dims)` overload, added the overall
34+
outcome probability to its return type `std::tuple<std::vector<idx>, realT>`
3335
- Bumped Eigen3 minimum required version to 5.0.0
3436
- Bumped CMake minimum required version to 3.20
3537
- Modernized CMake configuration files
@@ -40,9 +42,9 @@
4042
in ["benchmarks"](https://github.com/softwareQinc/qpp/blob/main/benchmarks)
4143
- Bugfixes for `qpp::QFT()` and `qpp::TFQ()`
4244
- Added `pyqpp.QEngine.get_stats_to_JSON()` to display the measurement
43-
statistics in JSON format from `pyqpp`
44-
- Finalized pyqpp, now all Quantum++ functions have corresponding bindings in
45-
Python
45+
statistics in JSON format from **pyqpp**
46+
- **pyqpp** is feature-complete, now all Quantum++ functions have corresponding
47+
bindings in Python
4648

4749
# Version 6.0 - 14 April 2025
4850

docker/Dockerfile

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
1-
FROM ubuntu:latest
2-
ENV TZ="America/Toronto"
3-
RUN apt-get update && \
4-
apt-get -y update && \
5-
apt-get install -yq tzdata && \
6-
ln -fs /usr/share/zoneinfo/America/Toronto /etc/localtime && \
7-
dpkg-reconfigure -f noninteractive tzdata
1+
FROM python:3.11-slim-bookworm
82

9-
RUN apt-get install -y build-essential python3 python3-pip python3-dev \
10-
python3-venv libeigen3-dev cmake sudo git vim
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
build-essential \
5+
cmake \
6+
libeigen3-dev \
7+
git \
8+
vim \
9+
sudo
1110

12-
# Enable a normal user with sudo access
13-
RUN useradd -m -c "softwareQ" sq
14-
RUN echo '%sq ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
11+
# Create user with sudo access in one go
12+
RUN useradd -m -c "softwareQ" sq && \
13+
echo 'sq ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
1514

16-
# Create a Python 3 virtual environment
1715
USER sq
1816
WORKDIR /home/sq
19-
RUN python3 -m venv venv
2017

21-
# Install Jupyter and other dependencies, followed by pyqpp
22-
COPY requirements.txt ./
23-
RUN . venv/bin/activate && pip install --no-cache-dir --upgrade pip && \
24-
pip install --no-cache-dir -r requirements.txt && \
25-
pip install --no-cache-dir git+https://github.com/softwareqinc/qpp
18+
COPY --chown=sq:sq requirements.txt ./
19+
RUN python3 -m venv venv && \
20+
./venv/bin/pip install --no-cache-dir --upgrade pip && \
21+
./venv/bin/pip install --no-cache-dir -r requirements.txt && \
22+
./venv/bin/pip install --no-cache-dir git+https://github.com/softwareqinc/qpp@v7.0.0
2623

27-
# Clone and install Quantum++ and qpp_qasm
28-
RUN git clone --depth 1 --branch main https://github.com/softwareqinc/qpp
29-
WORKDIR /home/sq/qpp
30-
RUN cmake -B build && \
31-
cmake --build build --target qpp_qasm && \
32-
sudo cmake --build build --target install && \
33-
sudo cp build/qpp_qasm /usr/local/bin
24+
# Clone Quantum++ and build qpp_qasm
25+
RUN git clone --depth 1 --branch main https://github.com/softwareqinc/qpp && \
26+
cmake -S qpp -B qpp/build && \
27+
cmake --build qpp/build --target qpp_qasm && \
28+
sudo cmake --build qpp/build --target install && \
29+
sudo cp qpp/build/qpp_qasm /usr/local/bin && \
30+
rm -rf qpp/build # Clean up build artifacts
3431

3532
# Create a notebook directory for Jupyter
3633
RUN mkdir notebooks
34+
ENV PATH="/home/sq/venv/bin:$PATH"
35+
# CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--notebook-dir=./notebooks"]

include/qpp/MATLAB/matlab.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace qpp {
5757
* // loads a previously saved Eigen ket
5858
* // from the MATLAB file "input.mat"
5959
* ket psi = load_MATLAB<ket>("input.mat");
60-
* \endcode
60+
* @endcode
6161
*
6262
* @tparam Derived Complex Eigen type
6363
* @param mat_file MATLAB .mat file
@@ -140,7 +140,7 @@ load_MATLAB(const std::string& mat_file, const std::string& var_name) {
140140
* // loads a previously saved Eigen dynamic double matrix
141141
* // from the MATLAB file "input.mat"
142142
* rmat mat = load_MATLAB<rmat>("input.mat");
143-
* \endcode
143+
* @endcode
144144
*
145145
* @tparam Derived Non-complex Eigen type
146146
* @param mat_file MATLAB .mat file

include/qpp/classes/exception.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace exception {
7171
* };
7272
* } // namespace exception
7373
* } // namespace qpp
74-
* \endcode
74+
* @endcode
7575
*/
7676
class Exception : public std::exception {
7777
protected:

0 commit comments

Comments
 (0)