diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..305926ef
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,71 @@
+---
+AlignAfterOpenBracket: Align
+AlignConsecutiveMacros: 'true'
+AlignConsecutiveAssignments: 'true'
+AlignConsecutiveDeclarations: 'false'
+AlignEscapedNewlines: Right
+AlignOperands: 'true'
+AlignTrailingComments: 'true'
+AllowAllArgumentsOnNextLine: 'true'
+AllowAllConstructorInitializersOnNextLine: 'true'
+AllowAllParametersOfDeclarationOnNextLine: 'true'
+AllowShortBlocksOnASingleLine: 'true'
+AllowShortCaseLabelsOnASingleLine: 'true'
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: WithoutElse
+AllowShortLambdasOnASingleLine: All
+AllowShortLoopsOnASingleLine: 'true'
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: 'true'
+AlwaysBreakTemplateDeclarations: 'Yes'
+BinPackArguments: 'false'
+BinPackParameters: 'true'
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeTernaryOperators: 'true'
+BreakConstructorInitializers: AfterColon
+BreakInheritanceList: BeforeColon
+BreakStringLiterals: 'true'
+ColumnLimit: '100'
+CompactNamespaces: 'true'
+ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
+ConstructorInitializerIndentWidth: '8'
+ContinuationIndentWidth: '2'
+Cpp11BracedListStyle: 'true'
+DerivePointerAlignment: 'false'
+DisableFormat: 'false'
+FixNamespaceComments: 'true'
+IncludeBlocks: Merge
+IndentCaseLabels: 'true'
+IndentPPDirectives: AfterHash
+IndentWidth: '4'
+IndentWrappedFunctionNames: 'false'
+KeepEmptyLinesAtTheStartOfBlocks: 'false'
+Language: Cpp
+MaxEmptyLinesToKeep: '1'
+NamespaceIndentation: All
+PointerAlignment: Right
+SortIncludes: 'false'
+SortUsingDeclarations: 'true'
+SpaceAfterCStyleCast: 'false'
+SpaceAfterLogicalNot: 'false'
+SpaceAfterTemplateKeyword: 'false'
+SpaceBeforeAssignmentOperators: 'true'
+SpaceBeforeCpp11BracedList: 'true'
+SpaceBeforeCtorInitializerColon: 'true'
+SpaceBeforeInheritanceColon: 'true'
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: 'true'
+SpaceInEmptyParentheses: 'false'
+SpacesBeforeTrailingComments: '1'
+SpacesInAngles: 'false'
+SpacesInCStyleCastParentheses: 'false'
+SpacesInContainerLiterals: 'false'
+SpacesInParentheses: 'false'
+SpacesInSquareBrackets: 'false'
+Standard: Cpp11
+TabWidth: '4'
+UseTab: Always
+AccessModifierOffset: -4
+...
diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml
index c25b8d64..c460ddae 100644
--- a/.github/workflows/continuous-integration.yaml
+++ b/.github/workflows/continuous-integration.yaml
@@ -268,6 +268,11 @@ jobs:
pretty: "LibRapid_Windows-Latest_MSVC_C++23"
steps:
+ - name: Workflow Telemetry
+ uses: runforesight/workflow-telemetry-action@v1.8.7
+ with:
+ theme: "dark"
+
- name: Checkout LibRapid
uses: actions/checkout@v4
with:
@@ -693,7 +698,7 @@ jobs:
name: Trigger Documentation Build
needs: [ compile, build-docs, quodona, code-coverage ]
runs-on: ubuntu-latest
- if: github.event_name != 'pull_request'
+ if: github.event_name == 'push'
steps:
- name: Checkout LibRapid
uses: actions/checkout@v4
diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml
index c0823fa4..aad51502 100644
--- a/.github/workflows/wheels.yaml
+++ b/.github/workflows/wheels.yaml
@@ -270,8 +270,13 @@ jobs:
# pythonType: "pp"
steps:
+ - name: Workflow Telemetry
+ uses: runforesight/workflow-telemetry-action@v1.8.7
+ with:
+ theme: "dark"
+
- name: Checkout LibRapid
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
submodules: recursive
@@ -284,28 +289,30 @@ jobs:
run: pip install -r requirements.txt
- name: Install XCode
- if: matrix.os == 'macos-latest'
+ if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1.5.1
with:
xcode-version: latest
- # This doesn't work for some reason
- # - name: Install Clang
- # if: matrix.os == 'macos-latest'
- # uses: KyleMayes/install-llvm-action@v1
- # with:
- # version: "15.0"
- # directory: "./llvm"
- # env: on
-
- name: Install Clang
- if: matrix.os == 'macos-latest'
+ if: runner.os == 'macOS'
run: |
rm -f '/usr/local/bin/2to3*'
brew install llvm libomp
+ - name: Install Clang
+ if: runner.os == 'Windows'
+ uses: KyleMayes/install-llvm-action@v1
+ with:
+ version: '15.0'
+ directory: ${RUNNER_TOOL_CACHE}
+ env: on
+
- name: Build Wheels
if: runner.os == 'macOS'
+ run: |
+ python -m pip install cibuildwheel
+ python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: ${{ matrix.pythonType }}${{ matrix.pythonVersion }}-${{ matrix.platformID }}
CIBW_ARCHS: all
@@ -321,15 +328,15 @@ jobs:
LIBRAPID_GET_FFTW: OFF
CC: /usr/local/opt/llvm/bin/clang
CXX: /usr/local/opt/llvm/bin/clang++
- # CC: $(brew --prefix llvm)/bin/clang
- # CXX: $(brew --prefix llvm)/bin/clang++
+ CIBW_ENVIRONMENT: CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
+ CMAKE_C_COMPILER: /usr/local/opt/llvm/bin/clang
+ CMAKE_CXX_COMPILER: /usr/local/opt/llvm/bin/clang++
+ - name: Build Wheels
+ if: runner.os == 'Windows'
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
-
- - name: Build Wheels
- if: runner.os != 'macOS'
env:
CIBW_BUILD: ${{ matrix.pythonType }}${{ matrix.pythonVersion }}-${{ matrix.platformID }}
CIBW_ARCHS: all
@@ -342,10 +349,29 @@ jobs:
GITHUB_ACTIONS: ON
LIBRAPID_GET_BLAS: ON
LIBRAPID_GET_FFTW: OFF
+ CC: ${RUNNER_TOOL_CACHE}/llvm/bin/clang
+ CXX: ${RUNNER_TOOL_CACHE}/llvm/bin/clang++
+ CIBW_ENVIRONMENT: CC=${RUNNER_TOOL_CACHE}/llvm/bin/clang CXX=${RUNNER_TOOL_CACHE}/llvm/bin/clang++
+ CMAKE_C_COMPILER: ${RUNNER_TOOL_CACHE}/llvm/bin/clang
+ CMAKE_CXX_COMPILER: ${RUNNER_TOOL_CACHE}/llvm/bin/clang++
+ - name: Build Wheels
+ if: runner.os == 'Linux'
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
+ env:
+ CIBW_BUILD: ${{ matrix.pythonType }}${{ matrix.pythonVersion }}-${{ matrix.platformID }}
+ CIBW_ARCHS: all
+ CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
+ CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
+ CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux_image }}
+ CIBW_MANYLINUX_PYPY_I686_IMAGE: ${{ matrix.manylinux_image }}
+ CIBW_BUILD_VERBOSITY: 1
+ CMAKE_BUILD_PARALLEL_LEVEL: 1
+ GITHUB_ACTIONS: ON
+ LIBRAPID_GET_BLAS: ON
+ LIBRAPID_GET_FFTW: OFF
- name: Store Artifacts
uses: actions/upload-artifact@v3
@@ -359,7 +385,7 @@ jobs:
steps:
- name: Checkout LibRapid
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
submodules: recursive
@@ -392,7 +418,7 @@ jobs:
steps:
- name: Checkout LibRapid
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
submodules: recursive
@@ -545,7 +571,7 @@ jobs:
#
# steps:
# - name: Checkout LibRapid
- # uses: actions/checkout@v3
+ # uses: actions/checkout@v4
# with:
# submodules: recursive
#
diff --git a/.gitignore b/.gitignore
index 631f057f..54ac7d3b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,5 +32,7 @@ librapid/librapid.egg-info
librapid/bindings/python/generated
dist/
+librapid/bindings/generators/*.hpp
+librapid/bindings/generators/*.cpp
*.pyc
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index e421c7e9..5ee5fc0f 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -8,7 +8,7 @@ formats: all
build:
os: ubuntu-22.04
tools:
- python: "3.11"
+ python: "mambaforge-22.9"
# Build documentation in the docs/ directory with Sphinx
sphinx:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2430a564..fac31980 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@ cmake_policy(SET CMP0077 NEW)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(STATUS "[ LIBRAPID ] LibRapid is a top-level project. Using C++23")
set(CMAKE_CXX_STANDARD 23)
+ message(STATUS "[ LIBRAPID ] Building ${CMAKE_BUILD_TYPE}")
endif ()
# LibRapid requires C++20 or later
@@ -83,11 +84,28 @@ file(GLOB_RECURSE LIBRAPID_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/librapid/cxxblas/*.cxx" # Source files
)
+# Extract system information
+set(IS_LINUX OFF)
+set(IS_MACOS OFF)
+set(IS_WINDOWS OFF)
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(IS_LINUX ON)
+endif ()
+if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(IS_MACOS ON)
+endif ()
+if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set(IS_WINDOWS ON)
+
+ # Disable shared libraries, since they just cause problems on Windows
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
+endif ()
+
if (${SKBUILD})
message(STATUS "[ LIBRAPID ] Building for Python")
set(module_name "_librapid")
-
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
+ set(LIBRAPID_QUIET ON) # Disable warnings for a cleaner output.
message(STATUS "[ LIBRAPID ] Cloning PyBind11")
FetchContent_Declare(
@@ -117,28 +135,34 @@ if (${SKBUILD})
# Enable BLAS
if (NOT ${LIBRAPID_NO_BLAS})
set(LIBRAPID_USE_BLAS ON)
- endif()
+ endif ()
# Get BLAS if the environment variable is set
if ($ENV{LIBRAPID_GET_BLAS})
set(LIBRAPID_GET_BLAS ON)
- endif()
+ endif ()
# Use fast math if the environment variable is set
if ($ENV{LIBRAPID_FAST_MATH})
set(LIBRAPID_FAST_MATH ON)
- endif()
+ endif ()
# Get FFTW if the environment variable is set
if ($ENV{LIBRAPID_GET_FFTW})
set(LIBRAPID_GET_FFTW ON)
- endif()
+ endif ()
# Use CUDA/OpenCL only when not inside GitHub Actions
if (NOT $ENV{GITHUB_ACTIONS})
set(LIBRAPID_USE_CUDA ON)
set(LIBRAPID_USE_OPENCL ON)
- endif()
+ set(LIBRAPID_NATIVE_ARCH ON)
+ else()
+ set(LIBRAPID_NO_ALWAYS_INLINE ON) # Reduce compile memory
+ endif ()
+
+ set(LIBRAPID_USE_OMP ON)
+ set(LIBRAPID_OPTIMISE_SMALL_ARRAYS OFF)
# Disable multiprec
set(LIBRAPID_USE_MULTIPREC OFF)
@@ -146,22 +170,28 @@ if (${SKBUILD})
file(GLOB_RECURSE PYTHON_SOURCES
- "${CMAKE_CURRENT_SOURCE_DIR}/librapid/bindings/python/*.hpp" # Header files
- "${CMAKE_CURRENT_SOURCE_DIR}/librapid/bindings/python/*.cpp" # Source files
+ "${CMAKE_CURRENT_SOURCE_DIR}/librapid/bindings/python/*.hpp" # Header files
+ "${CMAKE_CURRENT_SOURCE_DIR}/librapid/bindings/python/*.cpp" # Source files
)
pybind11_add_module(
- ${module_name} MODULE
+ ${module_name} MODULE
- ${LIBRAPID_SOURCES}
- ${PYTHON_SOURCES}
+ ${LIBRAPID_SOURCES}
+ ${PYTHON_SOURCES}
)
+ target_compile_definitions(${module_name} PUBLIC
+ LIBRAPID_PYTHON
+ LIBRAPID_NO_ALWAYS_INLINE
+ WIN32_LEAN_AND_MEAN
+ )
install(TARGETS ${module_name} DESTINATION .)
-else()
+else ()
set(module_name "librapid")
- add_library(${module_name} STATIC ${LIBRAPID_SOURCES})
-endif()
+ add_library(${module_name} STATIC ${LIBRAPID_SOURCES}
+ librapid/include/librapid/core/log.hpp)
+endif ()
# clang-format off
target_compile_definitions(${module_name} PUBLIC LIBRAPID_MAJOR=${LIBRAPID_MAJOR})
@@ -177,23 +207,6 @@ if (LIBRAPID_USE_PRECOMPILED_HEADER)
target_precompile_headers(${module_name} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/librapid/include/librapid/core/librapidPch.hpp")
endif ()
-# Extract system information
-set(IS_LINUX OFF)
-set(IS_MACOS OFF)
-set(IS_WINDOWS OFF)
-if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- set(IS_LINUX ON)
-endif ()
-if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
- set(IS_MACOS ON)
-endif ()
-if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
- set(IS_WINDOWS ON)
-
- # Disable shared libraries, since they just cause problems on Windows
- set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
-endif ()
-
if (MINGW)
message(FATAL_ERROR "LibRapid does not compile with MinGW. Please use MSVC or Clang instead.")
endif ()
diff --git a/README.md b/README.md
index 6b7625e5..86ab9eb7 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,8 @@
-![C++ Version](https://img.shields.io/badge/C++-20/23-purple.svg?style=flat&logo=c%2B%2B) ![License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat) [![Discord](https://img.shields.io/discord/848914274105557043?color=blue&label=Discord&logo=Discord)](https://discord.gg/cGxTFTgCAC)
+![C++ Version](https://img.shields.io/badge/C++-20/23-purple.svg?style=flat&logo=c%2B%2B) ![License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat) [![Discord](https://img.shields.io/discord/848914274105557043?color=blue&label=Discord&logo=Discord)](https://discord.gg/cGxTFTgCAC)![PyPI - Downloads](https://img.shields.io/pypi/dm/librapid?label=PyPI%20Downloads&link=https%3A%2F%2Fpypi.org%2Fproject%2Flibrapid%2F)
+
---
diff --git a/docs/environment.yaml b/docs/environment.yaml
index d51e6434..e2ea391d 100644
--- a/docs/environment.yaml
+++ b/docs/environment.yaml
@@ -2,8 +2,8 @@ name: docs # doxygen
channels:
- conda-forge
dependencies:
- - python=3.9
- - doxygen=1.9.1
+ - python=3.12
+ - doxygen=1.9.8
- pip
- pip:
- -r requirements.txt
diff --git a/docs/source/apiReference.md b/docs/source/apiReference.md
index 2bb431b4..79dda40c 100644
--- a/docs/source/apiReference.md
+++ b/docs/source/apiReference.md
@@ -44,6 +44,21 @@ Complex numbers and their operations.
Mathematical sets.
:::
+:::{grid-item-card} {octicon}`stack` Bitset
+:link: bitset/bitset
+:link-type: doc
+
+Optimised arrays of Boolean values with support for
+bitwise operations.
+:::
+
+:::{grid-item-card} {octicon}`book` Maps
+:link: map.map
+:link-type: doc
+
+Maps and dictionary-like objects.
+:::
+
:::{grid-item-card} {octicon}`number` Mathematics
:link: math/math
:link-type: doc
@@ -75,6 +90,8 @@ Arrays, Matrices and Linear Algebra
Vectors
Complex Numbers
Sets
+Bitset
+Map