Skip to content

Commit 46c8c98

Browse files
vsoftcoenum-class
andauthoredJul 29, 2024··
Improvements (#176)
* WIP * Simplified MATLAB detection * Update CHANGES.md * Formatting * Minor update POSIX-compliance Signed-off-by: Vlad Gheorghiu <[email protected]> * Update Signed-off-by: Vlad Gheorghiu <[email protected]> * add .txt extension VERSION conflicts with cpp20 <version> on macOS, hence renamed to VERSION.txt Signed-off-by: Vlad Gheorghiu <[email protected]> * Update Signed-off-by: Vlad Gheorghiu <[email protected]> * Update Signed-off-by: Vlad Gheorghiu <[email protected]> * fix Signed-off-by: Vlad Gheorghiu <[email protected]> * Minor update Signed-off-by: Vlad Gheorghiu <[email protected]> * improve performance of multiidx2n (#173) * improve performance of multiidx2n * minor cleanup * minor fix * CCNOT example (#175) * add toffoli example * fix typo * Updated CCNOT example Signed-off-by: Vlad Gheorghiu <[email protected]> * Minor typos Signed-off-by: Vlad Gheorghiu <[email protected]> --------- Signed-off-by: Vlad Gheorghiu <[email protected]> Co-authored-by: Saman <[email protected]>
1 parent 0753d9e commit 46c8c98

19 files changed

+146
-174
lines changed
 

‎.github/workflows/cmake.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818

1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121

2222
- name: Configure Quantum++
2323
run: cmake -B build
@@ -55,7 +55,7 @@ jobs:
5555
- name: Run unit tests
5656
run: ctest --test-dir build -E qpp_Timer
5757

58-
- name: Uninstall
58+
- name: Uninstall Quantum++
5959
shell: bash
6060
run: |
6161
if [ "$RUNNER_OS" == "Windows" ]; then
@@ -65,5 +65,12 @@ jobs:
6565
fi
6666
6767
- name: Install pyqpp
68+
shell: bash
6869
run: |
69-
pip3 install --user .
70+
python3 -m venv venv
71+
if [ "$RUNNER_OS" == "Windows" ]; then
72+
venv/Scripts/activate
73+
else
74+
. venv/bin/activate
75+
fi
76+
pip3 install .

‎CHANGES.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Pre-release
2+
3+
- Simplified MATLAB detection via CMake `find_package()` function. Users should
4+
only use `-DQPP_MATLAB=ON` when building with MATLAB support, all other
5+
MATLAB-related CMake flags have been removed.
6+
17
# Version 5.1 - 1 March 2024
28

39
- Replaced ["CHANGES"] by ["CHANGES.md"],
@@ -308,7 +314,7 @@
308314
attribute `[[qpp::parallel]]`. Since C++17, unknown attributes are supposed
309315
to be ignored by the compiler (and one can use this technique to define
310316
custom attributes). Warnings are explicitly disabled for
311-
clang/gcc/MSVC/icc. If your compiler emits a warning, please disable it
317+
Clang/GCC/MSVC/Intel. If your compiler emits a warning, please disable it
312318
with the corresponding `#pragma` directive at the beginning of ["qpp.h"]
313319
- Added from-string constructor for `qpp::Bit_circuit` and
314320
`qpp::Dynamic_bitset`
@@ -911,13 +917,13 @@
911917
as using traits over-complicated the design and it was not worth it.
912918
- Marked final all classes that are not intended to be used as base classes.
913919
- Modified the `CMakeLists.txt`, which now:
914-
- supports only GNU gcc and LLVM/Apple clang; otherwise, emits an error
915-
during the CMake running phase
920+
- supports only GCC and LLVM/Apple clang; otherwise, emits an error during
921+
the CMake running phase
916922
- adds `-D_NO_THREAD_LOCAL` definition for conditional compiling the
917923
source code without support for `std::thread_local` (if using e.g.,
918924
LLVM/Apple clang with libc++, as libc++ does not yet support
919925
`std::thread_local`)
920-
- uses OpenMP only if the compiler is detected as GNU gcc
926+
- uses OpenMP only if the compiler is detected as GCC
921927

922928
# Version 0.7 - 22 April 2015
923929

‎CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,21 @@ if(${Python3_FOUND})
5252
endif()
5353

5454
# BEGIN LOCAL stuff, you don't need those in standalone projects
55-
option(SANITIZE "Enable code sanitizing (only for gcc/clang)" OFF)
55+
option(SANITIZE "Enable code sanitizing (only for GCC/Clang)" OFF)
5656

5757
# Dependencies, do not modify unless you know what you're doing
5858
include(cmake/qpp_eigen3.cmake)
5959

6060
# Dependencies, do not modify unless you know what you're doing
61-
include(cmake/qpp_dependencies.cmake)
61+
include(cmake/qpp_MATLAB.cmake)
6262

6363
# Dependencies, do not modify unless you know what you're doing
64-
include(cmake/qpp_MATLAB.cmake)
64+
include(cmake/qpp_dependencies.cmake)
6565

6666
# Unit testing
6767
add_subdirectory(${CMAKE_SOURCE_DIR}/unit_tests/ EXCLUDE_FROM_ALL SYSTEM)
6868

69-
# Enable all warnings for GNU gcc and Clang/AppleClang
69+
# Enable all warnings for GCC and Clang/AppleClang
7070
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID}
7171
STREQUAL "GNU")
7272
add_compile_options("-pedantic" "-Wall" "-Wextra" "-Weffc++")

‎INSTALL.md

+11-29
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# Installation instructions
22

33
**Quantum++** is a header-only library that uses [CMake](https://cmake.org/) as
4-
its build/install system. **Quantum++** is platform-independent,
5-
supporting [UNIX](https://www.opengroup.org/membership/forums/platform/unix)
6-
(including
7-
[macOS](https://www.apple.com/macos/)) and UNIX-like operating systems
8-
(e.g., [Linux](https://www.linux.org)), as well
9-
as [Windows](https://www.microsoft.com/en-us/windows).
4+
its build/install system. **Quantum++** is platform-independent, supporting
5+
[UNIX](https://www.opengroup.org/membership/forums/platform/unix) (including
6+
[macOS](https://www.apple.com/macos/)) and UNIX-like operating systems (e.g.,
7+
[Linux](https://www.linux.org)), as well as
8+
[Windows](https://www.microsoft.com/en-us/windows).
109

1110
---
1211

1312
## Pre-requisites
1413

15-
- C++17 compliant compiler, e.g., [gcc](https://gcc.gnu.org/)
16-
, [clang](https://clang.llvm.org)
14+
- C++17 compliant compiler, e.g., [GCC](https://gcc.gnu.org/)
15+
, [Clang](https://clang.llvm.org)
1716
, [MSVC](https://visualstudio.microsoft.com/vs/) etc.
1817
- [CMake](https://cmake.org/)
1918
- [Eigen 3](https://eigen.tuxfamily.org) linear algebra library. If missing, it
@@ -25,13 +24,8 @@ as [Windows](https://www.microsoft.com/en-us/windows).
2524
Python 3 wrapper
2625
- [MATLAB](https://www.mathworks.com/products/matlab/) compiler shared
2726
libraries and include header files, in case you want to enable
28-
interoperability with MATLAB. If enabled, allows applications build with
27+
interoperability with MATLAB. If enabled, allows applications built with
2928
**Quantum++** to save/load **Quantum++** matrices and vectors to/from MATLAB.
30-
The locations of the MATLAB compiler shared libraries and header files are
31-
platform-specific, e.g., under Linux, they may be located under
32-
`/usr/local/MATLAB/R2021a/bin/glnxa64` and
33-
`/usr/local/MATLAB/R2021a/extern/include`, respectively. On your platform the
34-
locations may of course differ.
3529

3630
---
3731

@@ -103,19 +97,7 @@ their corresponding `CMakeLists.txt` via `findpackage(qpp ...)`.
10397
| `QPP_FP` | `default`, etc. [`default` by default] | Floating-point type (`qpp::realT`) |
10498
| `QPP_IDX` | `default`, etc. [`default` by default] | Integer index type (`qpp::idx`) |
10599
| | | |
106-
| `SANITIZE` | `ON/OFF` [`OFF` by default] | Enable code sanitizing (only for gcc/clang) |
107-
108-
If `QPP_MATLAB=ON` and the system could not detect your MATLAB installation,
109-
you can manually specify the path to MATLAB's installation directory via the
110-
additional CMake argument
111-
112-
MATLAB_INSTALL_DIR=/path/to/MATLAB
113-
114-
If you are still receiving errors, you can manually specify the path to
115-
MATLAB's required libraries and header files via the additional arguments
116-
117-
MATLAB_LIB_DIR=/path/to/MATLAB/libs
118-
MATLAB_INCLUDE_DIR=/path/to/MATLAB/headers
100+
| `SANITIZE` | `ON/OFF` [`OFF` by default] | Enable code sanitizing (only for GCC/Clang) |
119101

120102
---
121103

@@ -273,8 +255,8 @@ If building under Windows
273255
with [MATLAB](https://www.mathworks.com/products/matlab/) support, please add
274256
the
275257
location of
276-
`libmx.dll` and `libmat.dll` (the `.dll` **and not** the `.lib` files) to
277-
your `PATH` environment variable. In our case they are located
258+
`libmx.dll` and `libmat.dll` (the `.dll` **and not** the `.lib` files) to your
259+
`PATH` environment variable. For example, on our platform they are located
278260
under `C:\Program Files\MATLAB\R2021a\bin\win64`.
279261

280262
---

‎LICENSE ‎LICENSE.txt

File renamed without changes.

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Copyright (c) 2017 - 2024 softwareQ Inc. All rights reserved.
5151

5252
[Quantum++](https://github.com/softwareQinc/qpp) is distributed under the MIT
5353
license. Please see the
54-
[`LICENSE`](https://github.com/softwareQinc/qpp/blob/main/LICENSE) file for
55-
more details.
54+
[`LICENSE.txt`](https://github.com/softwareQinc/qpp/blob/main/LICENSE.txt)
55+
file for more details.
5656

5757
---
5858

‎VERSION ‎VERSION.txt

File renamed without changes.

‎cmake/examples.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ add_custom_target(examples COMMENT "Examples")
88
foreach(file ${EXAMPLE_FILES})
99
get_filename_component(TARGET_NAME ${file} NAME_WE)
1010
# Do not build "examples/matlab_io.cpp" if there's no MATLAB support
11-
if(${TARGET_NAME} STREQUAL "matlab_io" AND NOT BUILD_WITH_MATLAB)
11+
if(${TARGET_NAME} STREQUAL "matlab_io" AND NOT MATLAB_FOUND)
1212
continue()
1313
endif()
1414
add_executable(${TARGET_NAME} EXCLUDE_FROM_ALL ${file})

‎cmake/qpp_MATLAB.cmake

+6-100
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,13 @@
11
# MATLAB support, disabled by default
22
option(QPP_MATLAB "MATLAB support" OFF)
33
if(${QPP_MATLAB})
4-
message(STATUS "Detecting MATLAB")
5-
# Try to find it automatically
6-
find_package(
7-
Matlab
8-
OPTIONAL_COMPONENTS MX_LIBRARY MAT_LIBRARY
9-
QUIET)
4+
message(STATUS "Detecting MATLAB...")
5+
find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY MAT_LIBRARY)
106
if(MATLAB_FOUND)
11-
message(STATUS "Detecting MATLAB - done (in ${Matlab_ROOT_DIR})")
127
include_directories(SYSTEM ${Matlab_INCLUDE_DIRS})
13-
if(WIN32)
14-
if(MSVC)
15-
set(MATLAB_LIB_DIR
16-
"${Matlab_ROOT_DIR}/extern/lib/win64/microsoft"
17-
CACHE PATH "Custom path to MATLAB lib directory")
18-
elseif(MINGW)
19-
set(MATLAB_LIB_DIR
20-
"${Matlab_ROOT_DIR}/extern/lib/win64/mingw64"
21-
CACHE PATH "Custom path to MATLAB lib directory")
22-
else()
23-
message(FATAL_ERROR "Platform not supported, aborting.")
24-
endif()
25-
elseif(UNIX AND NOT APPLE)
26-
set(MATLAB_LIB_DIR
27-
"${Matlab_ROOT_DIR}/bin/glnxa64"
28-
CACHE PATH "Custom path to MATLAB lib directory")
29-
elseif(APPLE)
30-
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64")
31-
message(
32-
FATAL_ERROR
33-
"arm64 architecture is not (yet) supported by MATLAB, aborting.")
34-
endif()
35-
set(MATLAB_LIB_DIR
36-
"${Matlab_ROOT_DIR}/bin/maci64"
37-
CACHE PATH "Custom path to MATLAB lib directory")
38-
else()
39-
message(FATAL_ERROR "Platform not supported, aborting.")
40-
endif()
41-
link_directories(${MATLAB_LIB_DIR})
42-
add_compile_definitions(QPP_MATLAB)
43-
set(BUILD_WITH_MATLAB TRUE)
44-
else() # Location manually specified
45-
set(MATLAB_INSTALL_DIR
46-
""
47-
CACHE PATH "Custom path to MATLAB installation")
48-
if(IS_DIRECTORY ${MATLAB_INSTALL_DIR})
49-
# MATLAB include files
50-
set(MATLAB_INCLUDE_DIR
51-
"${MATLAB_INSTALL_DIR}/extern/include"
52-
CACHE PATH "Custom path to MATLAB include directory")
53-
if(IS_DIRECTORY ${MATLAB_INCLUDE_DIR})
54-
include_directories(SYSTEM ${MATLAB_INCLUDE_DIR})
55-
else()
56-
message(FATAL_ERROR "Possibly corrupted MATLAB include headers")
57-
endif()
58-
# MATLAB linker files
59-
if(WIN32)
60-
if(MSVC)
61-
set(MATLAB_LIB_DIR
62-
"${MATLAB_INSTALL_DIR}/extern/lib/win64/microsoft"
63-
CACHE PATH "Custom path to MATLAB lib directory")
64-
elseif(MINGW64)
65-
set(MATLAB_LIB_DIR
66-
"${MATLAB_INSTALL_DIR}/extern/lib/win64/mingw64"
67-
CACHE PATH "Custom path to MATLAB lib directory")
68-
else()
69-
message(FATAL_ERROR "Platform not supported, aborting.")
70-
endif()
71-
elseif(UNIX AND NOT APPLE)
72-
set(MATLAB_LIB_DIR
73-
"${MATLAB_INSTALL_DIR}/bin/glnxa64"
74-
CACHE PATH "Custom path to MATLAB lib directory")
75-
elseif(APPLE)
76-
set(MATLAB_LIB_DIR
77-
"${MATLAB_INSTALL_DIR}/bin/maci64"
78-
CACHE PATH "Custom path to MATLAB lib directory")
79-
else()
80-
message(FATAL_ERROR "Platform not supported, aborting.")
81-
endif()
82-
if(IS_DIRECTORY ${MATLAB_LIB_DIR})
83-
link_directories(${MATLAB_LIB_DIR})
84-
else()
85-
message(FATAL_ERROR "Possibly corrupted MATLAB compiler libraries")
86-
endif()
87-
# Everything is OK, inject definition (as #define) in the source
88-
message(STATUS "Detecting MATLAB - done (in ${MATLAB_INSTALL_DIR})")
89-
add_compile_definitions(QPP_MATLAB)
90-
set(BUILD_WITH_MATLAB TRUE)
91-
else()
92-
message(FATAL_ERROR "Could not detect MATLAB, aborting")
93-
endif()
94-
endif()
95-
# MATLAB linking dependencies to be injected in the main CMakeLists.txt
96-
if(${BUILD_WITH_MATLAB})
97-
if(WIN32)
98-
if(MSVC)
99-
set(QPP_MATLAB_LINK_DEPS libmx libmat)
100-
elseif(MINGW)
101-
set(QPP_MATLAB_LINK_DEPS mx mat)
102-
endif()
103-
else()
104-
set(QPP_MATLAB_LINK_DEPS mx mat)
105-
endif()
8+
set(QPP_MATLAB_LINK_DEPS Matlab::mat Matlab::mx)
9+
message(STATUS "Detected MATLAB in: ${Matlab_ROOT_DIR}")
10+
else()
11+
message(FATAL_ERROR "Could not detect MATLAB, aborting")
10612
endif()
10713
endif()

‎cmake/qpp_dependencies.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
152152
add_compile_options(-stdlib=libc++)
153153
endif()
154154

155-
# GNU gcc additional debug settings
155+
# GCC additional debug settings
156156
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
157157
# if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ## use the "no-weak" debugging
158158
# flag only when debugging under OS X, ## as gdb cannot step in template

‎cmake/qpp_uninstall.cmake.in

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ endif()
77
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
88
string(REGEX REPLACE "\n" ";" files "${files}")
99
foreach(file ${files})
10-
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
11-
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10+
message(STATUS "Uninstalling ${file}")
11+
if(IS_SYMLINK "${file}" OR EXISTS "${file}")
1212
execute_process(
13-
COMMAND @CMAKE_COMMAND@ -E rm $ENV{DESTDIR}${file}
13+
COMMAND @CMAKE_COMMAND@ -E rm -f "${file}"
1414
OUTPUT_VARIABLE rm_out
1515
RESULT_VARIABLE rm_retval)
16-
if(NOT "${rm_retval}" STREQUAL 0)
17-
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
16+
if(${rm_retval})
17+
message(FATAL_ERROR "Problem when removing ${file}")
1818
endif()
19-
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
20-
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
19+
else()
20+
message(STATUS "File ${file} does not exist.")
2121
endif()
2222
endforeach()
2323

‎examples/toffoli.cpp

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Toffoli gate simulation
2+
// Source: ./examples/toffoli.cpp
3+
4+
#include <iostream>
5+
6+
#include "qpp/qpp.h"
7+
8+
int main() {
9+
using namespace qpp;
10+
11+
std::cout << ">> Toffoli gate simulation\n\n";
12+
13+
ket psi_in = randket(8);
14+
std::cout << ">> Input state:\n";
15+
std::cout << disp(dirac(psi_in)) << "\n\n";
16+
17+
/**
18+
* Toffoli gate (control control not)
19+
*
20+
* ---+---
21+
* |
22+
* ---+---
23+
* |
24+
* ---X---
25+
*/
26+
ket result = apply(psi_in, gt.TOF, {0, 1, 2});
27+
std::cout << ">> Toffoli gate output state:\n";
28+
std::cout << disp(dirac(result)) << "\n\n";
29+
30+
/**
31+
* Toffoli with T and CNOT
32+
*
33+
* -------------+-------------+-----+---T---+--
34+
* | | | |
35+
* -----+-------------+----------T--X--T_d--X--
36+
* | | | |
37+
* --H--X--T_d--X--T--X--T_d--X--T--H----------
38+
*/
39+
result = apply(psi_in, gt.H, {2});
40+
result = applyCTRL(result, gt.X, {1}, {2});
41+
result = apply(result, adjoint(gt.T), {2});
42+
result = applyCTRL(result, gt.X, {0}, {2});
43+
result = apply(result, gt.T, {2});
44+
result = applyCTRL(result, gt.X, {1}, {2});
45+
result = apply(result, adjoint(gt.T), {2});
46+
result = applyCTRL(result, gt.X, {0}, {2});
47+
result = apply(result, gt.T, {1});
48+
result = apply(result, gt.T, {2});
49+
result = applyCTRL(result, gt.X, {0}, {1});
50+
result = apply(result, gt.T, {0});
51+
result = apply(result, adjoint(gt.T), {1});
52+
result = apply(result, gt.H, {2});
53+
result = applyCTRL(result, gt.X, {0}, {1});
54+
std::cout << ">> Toffoli with T and CNOT output state:\n";
55+
std::cout << disp(dirac(result)) << "\n\n";
56+
57+
/**
58+
* Sleator Weinfurter construction
59+
* V * V = X
60+
*
61+
* -----+-------+---+---
62+
* | | |
63+
* --+--X---+---X-------
64+
* | | |
65+
* --V-----V_d------V---
66+
*/
67+
cmat sqrtx{cmat::Zero(2, 2)};
68+
sqrtx << 0.5 + 0.5 * 1_i, 0.5 - 0.5 * 1_i, 0.5 - 0.5 * 1_i, 0.5 + 0.5 * 1_i;
69+
result = applyCTRL(psi_in, sqrtx, {1}, {2});
70+
result = applyCTRL(result, gt.X, {0}, {1});
71+
result = applyCTRL(result, adjoint(sqrtx), {1}, {2});
72+
result = applyCTRL(result, gt.X, {0}, {1});
73+
result = applyCTRL(result, sqrtx, {0}, {2});
74+
std::cout
75+
<< ">> Barenco et. al. [quant-ph/9503016] construction output state:\n";
76+
std::cout << disp(dirac(result)) << "\n\n";
77+
}

‎include/qpp/input_output.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ template <typename Scalar,
6363
inline internal::IOManipScalar<Scalar> disp(Scalar scalar,
6464
IOManipScalarOpts opts = {}) {
6565
return internal::IOManipScalar<Scalar>{scalar, opts};
66-
};
66+
}
6767

6868
/**
6969
* \brief Complex number std::ostream manipulator

‎include/qpp/instruments.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636

3737
#include <Eigen/Dense>
3838

39-
// #include <iostream>
40-
4139
#include "qpp/functions.hpp"
4240
#include "qpp/operations.hpp"
4341
#include "qpp/types.hpp"

‎include/qpp/internal/util.hpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,11 @@ template <typename V, typename T = V, typename U = T>
105105
#endif
106106
// no error checks in release version to improve speed
107107

108-
// static allocation for speed!
109-
// allocate twice the size for matrices reshaped as vectors
110-
T part_prod[2 * internal::maxn];
111-
108+
T part_prod = 1;
112109
T result = 0;
113-
part_prod[numdims - 1] = 1;
114110
for (std::size_t i = 1; i < numdims; ++i) {
115-
part_prod[numdims - i - 1] = part_prod[numdims - i] * dims[numdims - i];
116-
result += midx[numdims - i - 1] * part_prod[numdims - i - 1];
111+
part_prod *= dims[numdims - i];
112+
result += midx[numdims - i - 1] * part_prod;
117113
}
118114

119115
return result + midx[numdims - 1];

‎include/qpp/qpp.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@
3939
#ifndef QPP_QPP_H_
4040
#define QPP_QPP_H_
4141

42-
// ignore warnings for unknown C++17 attributes (we use such "custom" attributes
43-
// internally, the compiler is supposed to ignore them according to the C++17
44-
// standard)
42+
// Ignore warnings for unknown C++17 attributes (we use such "custom"
43+
// attributes internally, the compiler is supposed to ignore them according to
44+
// the C++17 standard)
4545

46-
// Intel icc
46+
// Intel
4747
#if defined(__INTEL_COMPILER)
4848
#pragma warning(disable : 3924)
4949

50-
// clang
50+
// Clang
5151
#elif defined(__clang__)
5252
#pragma clang diagnostic ignored "-Wunknown-attributes"
5353

54-
// gcc
54+
// GCC
5555
#elif defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
5656
#pragma GCC diagnostic ignored "-Wattributes"
5757

‎prettyprint.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

33
# $@ - List of directories
44

@@ -14,11 +14,11 @@ else
1414
echo "Error: $CLANG_FORMAT executable not found." >&2
1515
exit 1
1616
fi
17-
echo "Code formatting with '$CLANG_FORMAT' the folders:"
17+
echo "Code formatting with '$CLANG_FORMAT' the directories:"
1818
fi
1919

20-
for folder in "$@"; do
21-
echo "$folder"
22-
find "$folder" \( -iname '*.cpp' -o -iname '*.c' -o -iname '*.h' \
20+
for directory in "$@"; do
21+
echo "$directory"
22+
find "$directory" \( -iname '*.cpp' -o -iname '*.c' -o -iname '*.h' \
2323
-o -iname '*.hpp' \) -exec "$CLANG_FORMAT" -style=file -i {} +
2424
done

‎stress_tests/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ include(../cmake/qpp_eigen3.cmake)
3131
# Dependencies, do not modify unless you know what you're doing
3232
include(../cmake/qpp_dependencies.cmake)
3333

34-
# Enable all warnings for GNU gcc and Clang/AppleClang
34+
# Enable all warnings for GCC and Clang/AppleClang
3535
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID}
3636
STREQUAL "GNU")
3737
add_compile_options("-pedantic" "-Wall" "-Wextra" "-Weffc++")

‎unit_tests/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ cmake_policy(SET CMP0076 NEW)
3434
# Build all tests in ${TEST_FILES}
3535
foreach(file ${TEST_FILES})
3636
# Do not build "tests/MATLAB/matlab.cpp" if there's no MATLAB support
37-
if(${file} STREQUAL "tests/MATLAB/matlab.cpp" AND NOT BUILD_WITH_MATLAB)
37+
if(${file} STREQUAL "tests/MATLAB/matlab.cpp" AND NOT MATLAB_FOUND)
3838
continue()
3939
endif()
4040
target_sources(${TARGET_NAME} PUBLIC ${file})

0 commit comments

Comments
 (0)
Please sign in to comment.