Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ jobs:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-14 g++-14 clang-18
sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++
sudo ln -s /usr/bin/gcc-14 /usr/local/bin/gcc
sudo ln -s /usr/bin/g++-14 /usr/local/bin/g++
sudo apt-get install -y ninja-build gcc-16 g++-16 clang-22
sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++
sudo ln -s /usr/bin/gcc-16 /usr/local/bin/gcc
sudo ln -s /usr/bin/g++-16 /usr/local/bin/g++

- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/check-build-reproducibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ jobs:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-14 g++-14 clang-18
sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++
sudo ln -s /usr/bin/gcc-14 /usr/local/bin/gcc
sudo ln -s /usr/bin/g++-14 /usr/local/bin/g++
sudo apt-get install -y ninja-build gcc-16 g++-16 clang-22
sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++
sudo ln -s /usr/bin/gcc-16 /usr/local/bin/gcc
sudo ln -s /usr/bin/g++-16 /usr/local/bin/g++

- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/check-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ jobs:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-16 g++-16

Comment thread
TonyXiang8787 marked this conversation as resolved.
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0

- name: Install most linters from uv
run: |
CC=gcc-14 CXX=g++-14 uv sync --locked --group lint
CC=gcc-16 CXX=g++-16 uv sync --locked --group lint

- name: Run mypy
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang-18 clang-tidy-18
sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++
sudo apt-get install -y ninja-build clang-22 clang-tidy-18
sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++
sudo ln -s /usr/bin/clang-tidy-18 /usr/local/bin/clang-tidy

- name: Install uv
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
CMAKE_PREFIX_PATH: /home/linuxbrew/.linuxbrew
LLVM_COV: llvm-cov-18
LLVM_COV: llvm-cov-22
HOMEBREW_FORCE_BREWED_CURL: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -34,9 +34,9 @@ jobs:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang-18 lcov gcovr
sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++
sudo apt-get install -y ninja-build clang-22 lcov gcovr
sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: Install pgm-build-deps
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/thread-sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang-18
sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++
sudo apt-get install -y ninja-build clang-22
sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++

- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
Expand Down
6 changes: 3 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ build:
- graphviz
- graphviz-tools
- libgvplugin-neato-layout8
- gcc-14
- g++-14
- gcc-16
- g++-16
tools:
python: "3.14"
jobs:
Expand All @@ -26,7 +26,7 @@ build:
create_environment:
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
install:
- CC=gcc-14 CXX=g++-14 UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --locked --group doc
- CC=gcc-16 CXX=g++-16 UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --locked --group doc
post_install:
# remove API DLL define in header
- find power_grid_model_c/power_grid_model_c/include -name *.h -exec sed -i -r "s/#define PGM.*//g" {} \;
Expand Down
36 changes: 18 additions & 18 deletions docs/advanced_documentation/build-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ Below is a list of tested compilers:

#### Linux

* gcc >= 14.0:
* Version 14.x tested using the version in the `manylinux_2_28` container.
* Version 14.x tested using the `musllinux` build with custom compiler.
* Version 14.x tested in CI.
* Clang >= 18.0:
* Version 18.x tested in CI.
* Version 18.x tested in CI with code quality checks.
* gcc >= 16.0:
* Version 16.x tested using the version in the `manylinux_2_28` container.
* Version 16.x tested using the `musllinux` build with custom compiler.
* Version 16.x tested in CI.
* Clang >= 22.0:
* Version 22.x tested in CI.
* Version 22.x tested in CI with code quality checks.

```{Admonition} Additional information
Wheel builds for Linux are done inside containers using `cibuildwheel`:
Expand All @@ -72,10 +72,10 @@ These are handled automatically in CI. For local development, use your system's

#### Windows

* MSVC >= 19.0:
* Latest release tested in CI (e.g. Visual Studio 2022, IDE or build tools).
* Clang CL >= 19.0:
* Latest release tested in CI (e.g. Visual Studio 2022, IDE or build tools).
* MSVC >= 19.5.*:
* Latest release tested in CI (e.g. Visual Studio 2026, IDE or build tools).
* Clang CL >= 20.1.8:
* Latest release tested in CI (e.g. Visual Studio 2026, IDE or build tools).

#### macOS

Expand All @@ -85,7 +85,7 @@ These are handled automatically in CI. For local development, use your system's
```{note}
Once your compiler of choice is installed, you need to define the environment variables `CC` and `CXX` to specify the
compiler.
For example `export CC=clang-18` and `export CXX=clang++-18` to select the `clang` compiler in Ubuntu.
For example `export CC=clang-22` and `export CXX=clang++-22` to select the `clang` compiler in Ubuntu.
```

### Build System for CMake Project
Expand Down Expand Up @@ -263,7 +263,7 @@ At the time of writing, the set-up is done as follows:

```shell
sudo apt update && sudo apt upgrade # make sure you're up to date
sudo apt install build-essential gcc g++ clang-18 procps curl file git # install initial dependencies
sudo apt install build-essential gcc g++ clang-22 procps curl file git # install initial dependencies
```

Then install Homebrew using the setup recommendations in [Homebrew](https://brew.sh).
Expand All @@ -281,9 +281,9 @@ brew install \
Append the following lines into the file `${HOME}/.bashrc` (required for `scikit-build` for the Python installation):

```shell
export CXX=clang++ # or g++ or g++-14 or ...
export CC=clang # or gcc or gcc-14 or ...
export LLVM_COV=llvm-cov-18 # only if you want to use one of the llvm features
export CXX=clang++ # or g++ or g++-16 or ...
export CC=clang # or gcc or gcc-16 or ...
export LLVM_COV=llvm-cov-22 # only if you want to use one of the llvm features
export CLANG_TIDY=clang-tidy-18 # only if you want to use one of the clang-tidy presets
```

Expand Down Expand Up @@ -319,9 +319,9 @@ As a quick start, from the root of the repository:
You need to install the MSVC compiler.
You can either install the whole Visual Studio IDE or just the build tools.

* [Visual Studio Build Tools](https://aka.ms/vs/17/release/vs_BuildTools.exe) (free)
* [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2026) (free)
* Select C++ build tools
* Full [Visual Studio](https://visualstudio.microsoft.com/vs/) (All three versions are suitable.
* Full [Visual Studio](https://visualstudio.microsoft.com/downloads/) (All three versions are suitable.
Check the license!)
* Select Desktop Development with C++
* [Optional] Select `C++ Clang tools for Windows`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ template <symmetry_tag sym_type> struct PolarComplexRandVar {
}
};

template <symmetry_tag sym, template <symmetry_tag> typename RandVarType>
requires std::same_as<RandVarType<sym>, UniformComplexRandVar<sym>> ||
std::same_as<RandVarType<sym>, IndependentComplexRandVar<sym>>
inline auto conj(RandVarType<sym> var) {
template <typename RandVarType>
requires std::same_as<RandVarType, UniformComplexRandVar<typename RandVarType::sym>> ||
std::same_as<RandVarType, IndependentComplexRandVar<typename RandVarType::sym>>
inline auto conj(RandVarType var) {
Comment thread
TonyXiang8787 marked this conversation as resolved.
var.value = conj(var.value);
return var;
}
Expand All @@ -268,11 +268,12 @@ template <symmetry_tag sym> inline auto conj(PolarComplexRandVar<sym> var) {

namespace statistics {
// Var(s x) ≈ Var(x) * ||s||^2
template <symmetry_tag sym, template <symmetry_tag> typename RandVarType>
requires is_in_list_c<RandVarType<sym>, UniformRealRandVar<sym>, IndependentRealRandVar<sym>,
UniformComplexRandVar<sym>, IndependentComplexRandVar<sym>>
inline auto scale(RandVarType<sym> const& var, double scale_factor) {
return RandVarType<sym>{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)};
template <typename RandVarType>
requires is_in_list_c<
RandVarType, UniformRealRandVar<typename RandVarType::sym>, IndependentRealRandVar<typename RandVarType::sym>,
UniformComplexRandVar<typename RandVarType::sym>, IndependentComplexRandVar<typename RandVarType::sym>>
inline auto scale(RandVarType const& var, double scale_factor) {
return RandVarType{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)};
}

template <typename RandVarType>
Expand All @@ -281,10 +282,11 @@ inline auto scale(RandVarType const& var, RealValue<asymmetric_t> const& scale_f
return RandVarType{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)};
}

template <symmetry_tag sym, template <symmetry_tag> typename RandVarType>
requires is_in_list_c<RandVarType<sym>, UniformComplexRandVar<sym>, IndependentComplexRandVar<sym>>
inline auto scale(RandVarType<sym> const& var, DoubleComplex const& scale_factor) {
return RandVarType<sym>{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)};
template <typename RandVarType>
requires is_in_list_c<RandVarType, UniformComplexRandVar<typename RandVarType::sym>,
IndependentComplexRandVar<typename RandVarType::sym>>
inline auto scale(RandVarType const& var, DoubleComplex const& scale_factor) {
return RandVarType{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)};
}

inline auto scale(IndependentComplexRandVar<asymmetric_t> const& var, ComplexValue<asymmetric_t> const& scale_factor) {
Expand Down
Loading