Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
0a9916c
begin to code minres
Lucas-Haubert Mar 10, 2025
8f712d7
updated llt and ldlt
Lucas-Haubert Mar 10, 2025
681bdcb
minres and qr decomps to debug and test
Lucas-Haubert Mar 10, 2025
f32859f
update
Lucas-Haubert Mar 11, 2025
4e7092f
working on minres
Lucas-Haubert Mar 12, 2025
6a0ce33
upgraded unit tests
Lucas-Haubert Mar 17, 2025
43b6112
added decomps
Lucas-Haubert Mar 19, 2025
65761ed
pre-commit: update
jcarpent Mar 19, 2025
98c85ab
pre-commit: run on all files pre-commit run --all-files
jcarpent Mar 19, 2025
ea7f65f
git: ignore pre-commit previous commit
jcarpent Mar 19, 2025
dfabafc
cmake: fix project URL
jcarpent Mar 19, 2025
32db75d
cmake: modernize the packaging
jcarpent Mar 19, 2025
a122ac3
[cmake] nanobind is a find_package(), because we are not supposed to …
ManifoldFR Mar 19, 2025
42724f3
Add 'tests' subdir to gersemi defs
ManifoldFR Mar 19, 2025
1480a16
[cmake] add all headers to the nanoeigenpy_HEADERS var
ManifoldFR Mar 19, 2025
ce673b1
Nanobind requires Eigen 3.3.1 minimum
ManifoldFR Mar 19, 2025
ad62e4f
Remove redundant include
ManifoldFR Mar 19, 2025
20ea064
Add static_assert in SparseSolverBaseVisitor
ManifoldFR Mar 19, 2025
0ac788e
Add static_assert in SimplicialCholeskyVisitor
ManifoldFR Mar 19, 2025
807901b
Do not use EigenBaseVisitor in SimplicialCholeskyVisitor -- simplicia…
ManifoldFR Mar 19, 2025
a2c7fb2
Re-expose quaternion and angle-axis
ManifoldFR Mar 20, 2025
e62d5b5
Move 'decompositions/base.hpp' to 'nanoeigenpy/eigen-base.hpp'
ManifoldFR Mar 20, 2025
2feea2c
Rework fwd.hpp - introduce macro to check for CXX20
ManifoldFR Mar 20, 2025
cc29d11
src/module.cpp : fix exposing Simplicial sparse solvers
ManifoldFR Mar 20, 2025
1cb6e59
SimplicialCholesky.hpp : return decltype(auto) (hence, reference) fro…
ManifoldFR Mar 20, 2025
1fdb180
[cmake] Add CONFIGURE_DEPENDS
ManifoldFR Mar 20, 2025
4207912
Change typedef
ManifoldFR Mar 20, 2025
21cba24
Fix angle-axis
ManifoldFR Mar 20, 2025
4656b5f
Fix install dir for Python module
ManifoldFR Mar 20, 2025
ad472d9
EigenSolver.hpp : remove unused include, fixup some rv_policy and
ManifoldFR Mar 20, 2025
755ecf6
Add Eigen version, expose SIMD instruction sets in use.
ManifoldFR Mar 20, 2025
bea40b9
decompositions/llt.hpp : do not define variable cl
ManifoldFR Mar 20, 2025
908d82c
renamed hpp and py files with convention
Lucas-Haubert Mar 20, 2025
e7c98f2
Add spaces between copyright pragma once and includes
Lucas-Haubert Mar 20, 2025
1824c51
Convention in the includes between brackets and quotation marks
Lucas-Haubert Mar 20, 2025
8169153
Removed export values in computation info
Lucas-Haubert Mar 20, 2025
037aff3
Removed compute proxy intermediate function in eigen solver
Lucas-Haubert Mar 20, 2025
71a991b
Put references on return types of lambda functions
Lucas-Haubert Mar 20, 2025
ba56853
Added IdVistor and fwd header
Lucas-Haubert Mar 21, 2025
7b9ab61
Convention templates MatrixType and others with underscore
Lucas-Haubert Mar 21, 2025
7bdbbac
Added implicit conversion from AngleAxis to RotationBase
Lucas-Haubert Mar 21, 2025
f7ee9c9
Corrected argument type in compute and put MatrixType
Lucas-Haubert Mar 21, 2025
1ae3eb7
Debuging minres with incorrect solve method
Lucas-Haubert Mar 21, 2025
a7a5142
Added code for solvers to debug and test
Lucas-Haubert Mar 21, 2025
5e63491
Tests geometry
Lucas-Haubert Mar 25, 2025
277f4e4
Merged the upstream/main for pixi
Lucas-Haubert Mar 25, 2025
d7caee9
Removed commentaries
Lucas-Haubert Mar 25, 2025
a504588
[tests] declare all Python tests
ManifoldFR Mar 25, 2025
5a996d1
quaternion : expose "==" operator, test for it
ManifoldFR Mar 25, 2025
498a72b
merge test_quaternion.py into test_geometry
ManifoldFR Mar 25, 2025
0fa56bc
Add 'scipy' to dependencies
ManifoldFR Mar 25, 2025
de465ea
[decompositions] Remove unused "auto cl = "
ManifoldFR Mar 26, 2025
b004fb9
fwd.hpp : fix warning on gcc
ManifoldFR Mar 26, 2025
f678208
utils/is-approx.hpp : no need to use macro, use "static constexpr int"
ManifoldFR Mar 26, 2025
7143c28
Changes minres file
Lucas-Haubert Mar 26, 2025
29b6da2
nanoeigenpy.hpp : change to be an omnibus header
ManifoldFR Mar 26, 2025
a923753
Remove solvers/sparse-solver-base.hpp
ManifoldFR Mar 26, 2025
5b61dbe
minres.hpp : do not use "EigenBase" as argument type, expose overload…
ManifoldFR Mar 26, 2025
06312b7
fwd.hpp : move eigen typedef macro in there
ManifoldFR Mar 26, 2025
77cc71d
Rename sparse/llt.hpp, sparse/ldlt.hpp
ManifoldFR Mar 26, 2025
99413a2
src/module.cpp : slight refactoring of how solvers are exposed
ManifoldFR Mar 26, 2025
b647e1a
decompisitions/simplicial-llt.hpp : remove redundant include
ManifoldFR Mar 26, 2025
6e2d7ae
solvers/iterative-solver-base.hpp : various enhancements
ManifoldFR Mar 26, 2025
dcc90d6
decompositions/sparse-solver-base.hpp : Use Eigen::Ref of dense vecto…
ManifoldFR Mar 26, 2025
5a736b0
tests/test_simplicial_llt : add sparse RHS test
ManifoldFR Mar 26, 2025
8712598
Rename computation-info.hpp to constants.hpp, expose enum Decompositi…
ManifoldFR Mar 26, 2025
4ca4859
decompositions/SelfAdjointEigenSolver : fix the default argument!
ManifoldFR Mar 26, 2025
a7d8ce7
[decompositions] Removed duplicate iterative solver base visitor, fix…
ManifoldFR Mar 26, 2025
165c2a6
Added and tested cholmod support
Lucas-Haubert Mar 27, 2025
1565885
Add suitesparse dependency
ManifoldFR Mar 27, 2025
a465143
pixi : add 'cholmod' feature, set CI to use 'all' env
ManifoldFR Mar 27, 2025
f87fdf6
Update pixi lockfile
ManifoldFR Mar 27, 2025
2e018ed
Corrected compilation for cholmod
Lucas-Haubert Mar 27, 2025
9fe13ab
Remove unused typedefs and include
ManifoldFR Mar 27, 2025
4782c8d
pixi.toml : properly add env value for cholmod
ManifoldFR Mar 27, 2025
411337b
[tests] cmakelists.txt : simplify logic to add the cholmod Python tests
ManifoldFR Mar 27, 2025
9907401
Cholmod : detect feature at compile-time at header inclusion time, no…
ManifoldFR Mar 27, 2025
34ea4c4
tests/test_minres.py : also test for vector RHS
ManifoldFR Mar 27, 2025
288ae11
Code for accelerate to be tested on mac
Lucas-Haubert Mar 27, 2025
4a45d92
Remove more unused typedefs
ManifoldFR Mar 27, 2025
af021a8
tests/test_minres.py : also test minres.solveWithGuess()
ManifoldFR Mar 27, 2025
5cb4247
New CMakeLists.txt to test for accelerate
Lucas-Haubert Mar 27, 2025
6986955
[decompositions] some ctor changes
ManifoldFR Mar 27, 2025
9bfac6b
decompositions.hpp : use correct define
ManifoldFR Mar 28, 2025
4cac78d
format fwd.hpp
ManifoldFR Mar 28, 2025
b205cf3
Undo cholmod changes
ManifoldFR Mar 28, 2025
2612c34
CMakeLists.txt : add stub generation and installation
ManifoldFR Mar 28, 2025
c92e8fe
solveWithGuess() is a const method, use templated proxy for solve()
ManifoldFR Mar 28, 2025
63c54cb
Remove some is_final()
ManifoldFR Mar 28, 2025
2f421b1
Split module.cpp
ManifoldFR Mar 28, 2025
036d142
[tests] change test_minres.py to test_iterative_solvers.py -- test al…
ManifoldFR Mar 28, 2025
6d79083
Use nb::DMap<...> for iterative solvers' constructors
ManifoldFR Mar 28, 2025
c706782
pre-commit-config : add ruff
ManifoldFR Mar 28, 2025
5716740
Add pytest to pixi deps
ManifoldFR Mar 28, 2025
cb16656
[tests] Rewrite test_iterative_solvers using pytest
ManifoldFR Mar 28, 2025
47a7f41
[tests] test_iterative_solvers: do not test x and x_est (unless initi…
ManifoldFR Mar 28, 2025
7256fb4
[tests] test_iterative_solvers: increase max iters AGAIN
ManifoldFR Mar 28, 2025
aa94719
pre-commit : run ruff
ManifoldFR Mar 28, 2025
b1d4246
Updated CMakeLists.txt for Accelerate
Lucas-Haubert Mar 28, 2025
202ed6a
Add workspace support
ManifoldFR Mar 28, 2025
546496c
CMakeLists.txt : remove some warnings from the CXX flags
ManifoldFR Mar 28, 2025
0fc351a
CMakeLists.txt : support FetchContent & CMake installation for jrl-cm…
ManifoldFR Mar 28, 2025
18bf6ce
Set INSTALL_DOCUMENTATION to OFF by default
ManifoldFR Mar 28, 2025
84aa1c2
Add setup_project_finalize()
ManifoldFR Mar 28, 2025
81b4869
add pytest to readme
ManifoldFR Mar 28, 2025
0157381
Update .gitignore
ManifoldFR Mar 28, 2025
3a03dee
Tests Accelerate
Lucas-Haubert Mar 28, 2025
e457b3c
Minor fix to accelerate.hpp : undef the macro, mark function as inline
ManifoldFR Mar 28, 2025
2632c64
Move MINRES to nanoeigenpy/solvers
ManifoldFR Mar 28, 2025
c1ff59c
Removed useless commentaries and prints
Lucas-Haubert Mar 28, 2025
0793288
Add section on optional features (cholmod, accelerate)
ManifoldFR Mar 28, 2025
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
2 changes: 1 addition & 1 deletion .gersemirc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
definitions: [./CMakeLists.txt, ./cmake]
definitions: [./CMakeLists.txt, ./cmake, ./tests]
line_length: 80
indent: 2
warn_about_unknown_commands: false
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pre-commit run -a (format-all, 2025-03-19)
98c85ab243b68db680a0a5f1ccbf238aeb6523ba
2 changes: 1 addition & 1 deletion .github/workflows/macos-linux-windows-pixi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-13, windows-latest]
environment: [default, python-oldest]
environment: [all, all-python-oldest]
build_type: [Release, Debug]

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build*/
.cache/
__pycache__

# pixi environments
.pixi
Expand Down
13 changes: 11 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:
submodules: true
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.7
rev: v20.1.0
hooks:
- id: clang-format
types_or: []
Expand All @@ -27,8 +27,17 @@ repos:
(?x)^(
doc/doxygen-awesome.*
)$
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.11.2
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.19.0
rev: 0.19.2
hooks:
- id: gersemi
- repo: https://github.com/Lucas-C/pre-commit-hooks
Expand Down
215 changes: 194 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,77 @@
#
# Copyright 2025 INRIA
#

cmake_minimum_required(VERSION 3.18)

set(PROJECT_NAME nanoeigenpy)
set(PROJECT_URL https://github.com/ManifoldFR/nanoeigenpy)
set(PROJECT_URL https://github.com/Simple-Robotics/nanoeigenpy)
set(PROJECT_DESCRIPTION "Tools for using Eigen with nanobind")
set(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
set(PROJECT_USE_CMAKE_EXPORT True)

include(cmake/base.cmake)
# To enable jrl-cmakemodules compatibility with workspace we must define the two
# following lines
set(PROJECT_AUTO_RUN_FINALIZE FALSE)
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})

# Check if the submodule cmake have been initialized
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
else()
find_package(jrl-cmakemodules QUIET CONFIG)
if(jrl-cmakemodules_FOUND)
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
)
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
message(
FATAL_ERROR
"\nCan't find jrl-cmakemodules. Please either:\n"
" - use git submodule: 'git submodule update --init'\n"
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
)
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git"
)
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
endif()
endif()

option(INSTALL_DOCUMENTATION "Generate and install the documentation" OFF)

if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0167 NEW)
endif()
if(POLICY CMP0177)
cmake_policy(SET CMP0177 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0177 NEW)
endif()
include("${JRL_CMAKE_MODULES}/base.cmake")
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
include("${JRL_CMAKE_MODULES}/ide.cmake")
include("${JRL_CMAKE_MODULES}/apple.cmake")
project(${PROJECT_NAME} ${PROJECT_ARGS})

string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "-Wcast-qual" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "-Wconversion" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)

find_package(Eigen3 REQUIRED)

add_library(nanoeigenpy_headers INTERFACE)
target_link_libraries(nanoeigenpy_headers INTERFACE Eigen3::Eigen)

find_package(Python REQUIRED COMPONENTS Interpreter Development)

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(
Expand All @@ -30,6 +80,25 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
)
endif()

option(
BUILD_WITH_CHOLMOD_SUPPORT
"Build NanoEigenPy with the Cholmod support"
OFF
)

if(APPLE)
option(
BUILD_WITH_ACCELERATE_SUPPORT
"Build EigenPy with the Accelerate support"
OFF
)
endif(APPLE)

# Find dependencies
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.3.1")

find_package(Python REQUIRED COMPONENTS Interpreter Development)

# Detect the installed nanobind package and import it into CMake
execute_process(
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
Expand All @@ -38,29 +107,133 @@ execute_process(
)
find_package(nanobind CONFIG REQUIRED)

file(GLOB nanoeigenpy_SOURCES src/*.cpp)
nanobind_add_module(nanoeigenpy NB_STATIC NB_SUPPRESS_WARNINGS ${nanoeigenpy_SOURCES})
target_link_libraries(nanoeigenpy PUBLIC nanoeigenpy_headers)
# Setup main targets
file(
GLOB_RECURSE ${PROJECT_NAME}_HEADERS
CONFIGURE_DEPENDS
include/nanoeigenpy/*.hpp
)

add_library(nanoeigenpy_headers INTERFACE)
target_include_directories(
nanoeigenpy_headers
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_link_libraries(nanoeigenpy_headers INTERFACE Eigen3::Eigen)

set(${PROJECT_NAME}_SOURCES src/module.cpp src/solvers.cpp)
nanobind_add_module(nanoeigenpy NB_STATIC NB_SUPPRESS_WARNINGS ${nanoeigenpy_SOURCES} ${nanoeigenpy_HEADERS})
target_link_libraries(nanoeigenpy PRIVATE nanoeigenpy_headers)

# Cholmod
if(BUILD_WITH_CHOLMOD_SUPPORT)
set(
CMAKE_MODULE_PATH
${JRL_CMAKE_MODULES}/find-external/CHOLMOD
${CMAKE_MODULE_PATH}
)
ADD_PROJECT_DEPENDENCY(CHOLMOD REQUIRED FIND_EXTERNAL "CHOLMOD")
message(
STATUS
"Build with CHOLMOD support (LGPL). See CHOLMOD/Doc/License.txt for further details."
)
file(
GLOB ${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_CHOLMOD_HEADERS
include/nanoeigenpy/decompositions/sparse/cholmod/*.hpp
)
list(
APPEND
${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_CHOLMOD_HEADERS}
)
target_link_libraries(nanoeigenpy PRIVATE CHOLMOD::CHOLMOD)
else()
list(
FILTER ${PROJECT_NAME}_HEADERS
EXCLUDE
REGEX "include/nanoeigenpy/decompositions/sparse/cholmod/.*"
)
endif(BUILD_WITH_CHOLMOD_SUPPORT)

# Apple accelerate
if(BUILD_WITH_ACCELERATE_SUPPORT)
if(NOT ${Eigen3_VERSION} VERSION_GREATER_EQUAL "3.4.90")
message(
FATAL_ERROR
"Your version of Eigen is too low. Should be at least 3.4.90. Current version is ${Eigen3_VERSION}."
)
endif()

set(
CMAKE_MODULE_PATH
${JRL_CMAKE_MODULES}/find-external/Accelerate
${CMAKE_MODULE_PATH}
)
find_package(Accelerate REQUIRED)
message(STATUS "Build with Accelerate support framework.")
target_compile_definitions(
nanoeigenpy_headers
INTERFACE -DNANOEIGENPY_WITH_ACCELERATE_SUPPORT
)
endif(BUILD_WITH_ACCELERATE_SUPPORT)

if(BUILD_WITH_ACCELERATE_SUPPORT)
file(
GLOB ${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_ACCELERATE_HEADERS
include/nanoeigenpy/decompositions/sparse/accelerate/*.hpp
)
list(
APPEND
${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_ACCELERATE_HEADERS}
)
else()
list(
FILTER ${PROJECT_NAME}_HEADERS
EXCLUDE
REGEX "include/nanoeigenpy/decompositions/sparse/accelerate/.*"
)
endif(BUILD_WITH_ACCELERATE_SUPPORT)

if(BUILD_WITH_ACCELERATE_SUPPORT)
target_link_libraries(nanoeigenpy PRIVATE Accelerate)
endif()

if(BUILD_TESTING)
add_subdirectory(tests)
endif()

install(
TARGETS nanoeigenpy_headers
EXPORT ${TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
nanobind_add_stub(
nanoeigenpy_stub
INSTALL_TIME
VERBOSE
MODULE nanoeigenpy
OUTPUT nanoeigenpy.pyi
PYTHON_PATH $<TARGET_FILE_DIR:nanoeigenpy>
DEPENDS nanoeigenpy
)

# Install targets
install(
DIRECTORY include/nanoeigenpy
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.hpp"
TARGETS ${PROJECT_NAME}_headers
EXPORT ${TARGETS_EXPORT_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

install(
TARGETS nanoeigenpy
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
LIBRARY DESTINATION ${Python_SITELIB}
)

ADD_HEADER_GROUP(${PROJECT_NAME}_HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)

SETUP_PROJECT_FINALIZE()
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# nanoeigenpy

<p align="left">
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Linter: ruff"></a>
</p>

This is a collection of tools for using Eigen together with nanobind, as a successor to the [eigenpy](https://github.com/stack-of-tasks/eigenpy) support library. Its aim is to help the transition away from Boost.Python.

It reintroduces a few features (e.g. bindings for Eigen matrix decompositions) which are not in [nanobind](https://github.com/wjakob/nanobind) at time of writing.
Expand All @@ -18,6 +22,16 @@ These features were finally added to eigenpy with a lot of developer effort. Thi
- bindings for Eigen's [Geometry module](https://libeigen.gitlab.io/docs/group__Geometry__Module.html) - quaternions, angle-axis representations...
- bindings for Eigen's matrix dense and sparse decompositions and solvers

### Optional features

**nanoeigenpy** also provides bindings for Eigen's [Cholmod](https://eigen.tuxfamily.org/dox/group__CholmodSupport__Module.html) and [Apple Accelerate](https://eigen.tuxfamily.org/dox/group__AccelerateSupport__Module.html) modules.

> [!NOTE]
> The Accelerate module is only available on Eigen's master branch, and not in any official release yet (as of 3/28/2025).
>
> Cholmod is part of the [SuiteSparse](https://github.com/DrTimothyAldenDavis/SuiteSparse) algorithms library. It can be installed standalone from [conda](https://anaconda.org/conda-forge/libcholmod).


## Example usage

The features included in **nanoeigenpy** are distributed in a Python module which can be imported, or through standalone headers which can be included in your own Python bindings code using a CMake target.
Expand Down Expand Up @@ -92,6 +106,7 @@ f(quat)

- the Eigen C++ template library - [conda-forge](https://anaconda.org/conda-forge/eigen) | [repo](https://gitlab.com/libeigen/eigen/)
- nanobind - [conda-forge](https://anaconda.org/conda-forge/nanobind) | [repo](https://github.com/wjakob/nanobind)
- [for testing] pytest - `conda install pytest` or `pip install pytest`

#### Conda

Expand Down
1 change: 1 addition & 0 deletions development/scripts/pixi/activation.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ set CMAKE_COLOR_DIAGNOSTICS=1

:: Set default build value only if not previously set
if not defined NANOEIGENPY_BUILD_TYPE (set NANOEIGENPY_BUILD_TYPE=Release)
if not defined NANOEIGENPY_BUILD_WITH_CHOLMOD (set NANOEIGENPY_BUILD_WITH_CHOLMOD=OFF)
1 change: 1 addition & 0 deletions development/scripts/pixi/activation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ export CMAKE_COLOR_DIAGNOSTICS=1

# Set default build value only if not previously set
export NANOEIGENPY_BUILD_TYPE=${NANOEIGENPY_BUILD_TYPE:=Release}
export NANOEIGENPY_BUILD_WITH_CHOLMOD=${NANOEIGENPY_BUILD_WITH_CHOLMOD:=OFF}
35 changes: 35 additions & 0 deletions include/nanoeigenpy/constants.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/// Copyright 2025 INRIA

#pragma once

#include <nanobind/nanobind.h>
#include <Eigen/Core>

namespace nanoeigenpy {
namespace nb = nanobind;
inline void exposeConstants(nb::module_ m) {
nb::enum_<Eigen::ComputationInfo>(m, "ComputationInfo")
.value("Success", Eigen::Success, "Computation was successful.")
.value("NumericalIssue", Eigen::NumericalIssue,
"The provided data did not satisfy the prerequisites.")
.value("NoConvergence", Eigen::NoConvergence,
"Iterative procedure did not converge.")
.value("InvalidInput", Eigen::InvalidInput,
"The inputs are invalid, or the algorithm has been improperly "
"called. "
"When assertions are enabled, such errors trigger an assert.");
using Eigen::DecompositionOptions;
#define _c(name) value(#name, DecompositionOptions::name)
nb::enum_<DecompositionOptions>(m, "DecompositionOptions")
._c(ComputeFullU)
._c(ComputeThinU)
._c(ComputeFullV)
._c(ComputeThinV)
._c(EigenvaluesOnly)
._c(ComputeEigenvectors)
._c(Ax_lBx)
._c(ABx_lx)
._c(BAx_lx);
#undef _c
}
} // namespace nanoeigenpy
Loading