Skip to content

Commit

Permalink
Version 4.3 (#153)
Browse files Browse the repository at this point in the history
Version 4.3
  • Loading branch information
vsoftco authored May 26, 2023
1 parent 6b12b94 commit 3051aea
Show file tree
Hide file tree
Showing 53 changed files with 152 additions and 150 deletions.
76 changes: 8 additions & 68 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,70 +1,10 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
BinPackParameters: true
BinPackArguments: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: true
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
Language: Cpp
ColumnLimit: 80
Standard: c++17
IndentWidth: 4
TabWidth: 4
UseTab: Never
PointerAlignment: Left
SpacesBeforeTrailingComments: 1
Standard: Cpp11
IndentWidth: 4
TabWidth: 4
#UseTab: ForIndentation
UseTab: Never
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: true
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
SortIncludes: false
...
IndentCaseLabels: true
AlwaysBreakTemplateDeclarations: Yes
26 changes: 14 additions & 12 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,11 @@ jobs:
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake -B "${{github.workspace}}"/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DEIGEN3_INSTALL_DIR="${{env.EIGEN3_WIN_INSTALL_DIR}}" \
-DWITH_UNIT_TESTS=ON -DWITH_EXAMPLES=ON
else
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_UNIT_TESTS=ON \
-DWITH_EXAMPLES=ON
export EIGEN3_INSTALL_DIR="${{env.EIGEN3_WIN_INSTALL_DIR}}"
fi
cmake -B "${{github.workspace}}"/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_UNIT_TESTS=ON \
-DWITH_EXAMPLES=ON
- name: Install Quantum++
shell: bash
Expand All @@ -62,11 +58,9 @@ jobs:
run: |
cd "${{github.workspace}}"/examples/standalone
if [ "$RUNNER_OS" == "Windows" ]; then
cmake -B build \
-DEIGEN3_INSTALL_DIR="${{env.EIGEN3_WIN_INSTALL_DIR}}"
else
cmake -B build
export EIGEN3_INSTALL_DIR="${{env.EIGEN3_WIN_INSTALL_DIR}}"
fi
cmake -B build
- name: Build standalone example
run: |
Expand All @@ -91,3 +85,11 @@ jobs:
- name: Run unit tests
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} -E qpp_Timer

- name: Install pyqpp
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export EIGEN3_INSTALL_DIR="${{env.EIGEN3_WIN_INSTALL_DIR}}"
fi
pip3 install .
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ examples/_*.cpp
out.tmp
.cmake/
Testing/
mat.txt
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Pre-release
Version 4.3 - 26 May 2023
- This is a maintenance release
- Fixed pyqpp installation on Windows under MSVC
- Migrated all continuous integration to GitHub actions
- Minor updates in qasmtools

Version 4.2 - 13 May 2023
- Quantum++ is now available on Homebrew (macOS/Linux), and can be
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.15)
set(QPP_VERSION_NUM 4.2)
set(QPP_VERSION_NUM 4.3)
set(QPP_VERSION_STR "${QPP_VERSION_NUM}")
project(qpp VERSION ${QPP_VERSION_NUM} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
Expand Down
5 changes: 3 additions & 2 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = Quantum++
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v4.2
PROJECT_NUMBER = v4.3

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down Expand Up @@ -174,7 +174,8 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.

STRIP_FROM_PATH = include
STRIP_FROM_PATH = include \
.

# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
Expand Down
17 changes: 15 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,30 @@ sudo cmake --build build --target install

which installs Quantum++ in `/usr/local/include/qpp`.

To uninstall, execute

```bash
sudo cmake --build build --target uninstall
```

### Windows

To install Quantum++ on a Windows platform, execute in an
Administrator Developer Command Prompt
Administrator Command Prompt

```shell
cmake --build build --target INSTALL
```

which installs Quantum++ in `C:\Program Files (x86)\qpp`.

To uninstall, execute in an Administrator Command Prompt

```shell
cmake --build build --target UNINSTALL
```


### FreeBSD

We are proud to be part of the [FreeBSD](https://www.freebsd.org/) operating
Expand Down Expand Up @@ -228,7 +241,7 @@ does.
For MSVC, this translates into downloading the Eigen3 archive
form [https://eigen.tuxfamily.org](https://eigen.tuxfamily.org), unzipping it
to e.g. `C:\path\to\eigen-3.x.x\`, followed by executing the following in an
Administrator Developer Command Prompt
Administrator Command Prompt

```shell
cd C:\path\to\eigen-3.x.x\
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Quantum++

## Version 4.2 - 13 May 2023
## Version 4.3 - 26 May 2023

[![GitHub actions](https://github.com/softwareqinc/qpp/actions/workflows/cmake.yml/badge.svg)](https://github.com/softwareQinc/qpp/actions)

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Version 4.2 - 13 May 2023
Version 4.3 - 26 May 2023
2 changes: 1 addition & 1 deletion examples/channels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main() {
std::cout << disp(transpose(evalsupop)) << '\n';

std::cout << ">> Their absolute values are:\n";
for (idx i = 0; i < (idx) evalsupop.size(); ++i)
for (idx i = 0; i < (idx)evalsupop.size(); ++i)
std::cout << std::abs(evalsupop(i)) << " ";

// verification
Expand Down
2 changes: 1 addition & 1 deletion examples/input_output.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Input/output
// Source: ./examples/input_output.cpp
#include <iostream>
#include <fstream>
#include <iostream>

#include "qpp.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/matlab_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Source: ./examples/matlab_io.cpp
#include <iostream>

#include "qpp.h"
#include "MATLAB/matlab.hpp" // must be explicitly included
#include "qpp.h"

int main() {
using namespace qpp;
Expand Down
2 changes: 1 addition & 1 deletion examples/timing2.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Timing
// Source: ./examples/timing2.cpp
#include <numeric>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>

#include "qpp.h"
Expand Down
20 changes: 10 additions & 10 deletions include/MATLAB/matlab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ load_MATLAB(const std::string& mat_file, const std::string& var_name) {
// populate the result
#if MX_HAS_INTERLEAVED_COMPLEX
dyn_mat<cplx> result(mxGetM(pa), mxGetN(pa));
std::memcpy((void*) result.data(), (void*) mxGetComplexDoubles(pa),
std::memcpy((void*)result.data(), (void*)mxGetComplexDoubles(pa),
sizeof(cplx) * result.size());
mxDestroyArray(pa);
matClose(pmat);
Expand All @@ -99,11 +99,11 @@ load_MATLAB(const std::string& mat_file, const std::string& var_name) {
dyn_mat<double> result_im(mxGetM(pa), mxGetN(pa));

// populate the real part of the created array
std::memcpy((void*) result_re.data(), (void*) mxGetPr(pa),
std::memcpy((void*)result_re.data(), (void*)mxGetPr(pa),
sizeof(double) * result_re.size());

if (mxIsComplex(pa)) // populate the imaginary part if exists
std::memcpy((void*) result_im.data(), (void*) mxGetPi(pa),
std::memcpy((void*)result_im.data(), (void*)mxGetPi(pa),
sizeof(double) * result_im.size());
else // set to zero the imaginary part
std::memset(result_im.data(), 0, sizeof(double) * result_im.size());
Expand Down Expand Up @@ -169,10 +169,10 @@ load_MATLAB(const std::string& mat_file, const std::string& var_name) {

// populate the result
#if MX_HAS_INTERLEAVED_COMPLEX
std::memcpy((void*) result.data(), (void*) mxGetDoubles(pa),
std::memcpy((void*)result.data(), (void*)mxGetDoubles(pa),
sizeof(double) * result.size());
#else
std::memcpy((void*) result.data(), (void*) mxGetPr(pa),
std::memcpy((void*)result.data(), (void*)mxGetPr(pa),
sizeof(double) * result.size());
#endif // MX_HAS_INTERLEAVED_COMPLEX

Expand Down Expand Up @@ -222,19 +222,19 @@ save_MATLAB(const Eigen::MatrixBase<Derived>& A, const std::string& mat_file,

// populate the MATLAB structure
#if MX_HAS_INTERLEAVED_COMPLEX
std::memcpy((void*) mxGetComplexDoubles(pa), (void*) rA.data(),
std::memcpy((void*)mxGetComplexDoubles(pa), (void*)rA.data(),
sizeof(cplx) * rA.size());
#else
// cast the input to a double (internal MATLAB format)
dyn_mat<double> tmp_re = rA.real();
dyn_mat<double> tmp_im = rA.imag();

// populate the real part of the created array
std::memcpy((void*) mxGetPr(pa), (void*) tmp_re.data(),
std::memcpy((void*)mxGetPr(pa), (void*)tmp_re.data(),
sizeof(double) * tmp_re.size());

// populate the imaginary part of the created array
std::memcpy((void*) mxGetPi(pa), (void*) tmp_im.data(),
std::memcpy((void*)mxGetPi(pa), (void*)tmp_im.data(),
sizeof(double) * tmp_im.size());
#endif // MX_HAS_INTERLEAVED_COMPLEX

Expand Down Expand Up @@ -289,10 +289,10 @@ save_MATLAB(const Eigen::MatrixBase<Derived>& A, const std::string& mat_file,

// populate the MATLAB structure
#if MX_HAS_INTERLEAVED_COMPLEX
std::memcpy((void*) mxGetDoubles(pa), (void*) rA.data(),
std::memcpy((void*)mxGetDoubles(pa), (void*)rA.data(),
sizeof(double) * rA.size());
#else
std::memcpy((void*) mxGetPr(pa), (void*) rA.data(),
std::memcpy((void*)mxGetPr(pa), (void*)rA.data(),
sizeof(double) * rA.size());
#endif // MX_HAS_INTERLEAVED_COMPLEX

Expand Down
4 changes: 2 additions & 2 deletions include/classes/circuits/engines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ class QNoisyEngine : public QEngine {
}
// }
// execute the circuit step
(void) QEngine::execute(elem);
(void)QEngine::execute(elem);

return *this;
}
Expand All @@ -1128,7 +1128,7 @@ class QNoisyEngine : public QEngine {
st_ = initial_engine_state;

for (auto&& elem : *qc_ptr_) {
(void) execute(elem);
(void)execute(elem);
}

// we measured at least one qudit
Expand Down
2 changes: 1 addition & 1 deletion include/qasm/qasm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ class QCircuitBuilder final : public ast::Visitor {

void visit(ast::RegisterDecl& decl) override {
std::vector<idx> indices(decl.size());
for (idx i = 0; i < (idx) decl.size(); i++) {
for (idx i = 0; i < (idx)decl.size(); i++) {
indices[i] =
decl.is_quantum() ? ctx.alloc_qubit() : ctx.alloc_bit();
}
Expand Down
4 changes: 4 additions & 0 deletions include/qpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@

// Quantum++ headers

// clang-format off

// do not change the order in this group, interdependencies
#include "types.hpp"
#include "traits.hpp"
Expand Down Expand Up @@ -143,6 +145,8 @@
#include "qasmtools/parser/parser.hpp"
#include "qasm/qasm.hpp"

// clang-format on

/**
* \namespace qpp
* \brief Quantum++ main namespace
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pyqpp"
version = "4.2"
version = "4.3"
description = "Python 3 wrapper for Quantum++"
authors = [
{name = "softwareQ Inc.", email = "info@softwareq.ca"},
Expand Down
2 changes: 1 addition & 1 deletion pyqpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(pyqpp)
cmake_minimum_required(VERSION 3.15)
project(pyqpp)

#### Eigen3
message(STATUS "Detecting Eigen3")
Expand Down
2 changes: 1 addition & 1 deletion pyqpp/include/pyqpp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#ifndef PYQPP_COMMON_H_
#define PYQPP_COMMON_H_

#include <pybind11/pybind11.h>
#include <pybind11/eigen.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "qpp.h"
Expand Down
Loading

0 comments on commit 3051aea

Please sign in to comment.