hyhound 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. hyhound-1.1.1/CMakeLists.txt +111 -0
  2. hyhound-1.1.1/LICENSE +165 -0
  3. hyhound-1.1.1/PKG-INFO +103 -0
  4. hyhound-1.1.1/cmake/Debug.cmake +23 -0
  5. hyhound-1.1.1/cmake/Develop.cmake +12 -0
  6. hyhound-1.1.1/cmake/Warnings.cmake +128 -0
  7. hyhound-1.1.1/conanfile.py +129 -0
  8. hyhound-1.1.1/pyproject.toml +84 -0
  9. hyhound-1.1.1/python/CMakeLists.txt +113 -0
  10. hyhound-1.1.1/python/README.rst +66 -0
  11. hyhound-1.1.1/python/dispatch.py.cpp +22 -0
  12. hyhound-1.1.1/python/hyhound/__init__.py +8 -0
  13. hyhound-1.1.1/python/hyhound/_hyhound.py +14 -0
  14. hyhound-1.1.1/python/hyhound/_hyhound.pyi +419 -0
  15. hyhound-1.1.1/python/hyhound/py.typed +0 -0
  16. hyhound-1.1.1/python/hyhound.py.cpp +659 -0
  17. hyhound-1.1.1/python/test/test_update_cholesky.py +111 -0
  18. hyhound-1.1.1/src/CMakeLists.txt +118 -0
  19. hyhound-1.1.1/src/cmake/BuildTime.cmake +24 -0
  20. hyhound-1.1.1/src/cmake/Config.cmake.in +45 -0
  21. hyhound-1.1.1/src/cmake/CoreConfig.cmake.in +9 -0
  22. hyhound-1.1.1/src/cmake/Install.cmake +141 -0
  23. hyhound-1.1.1/src/cmake/Library.cmake +52 -0
  24. hyhound-1.1.1/src/cmake/OCPConfig.cmake.in +10 -0
  25. hyhound-1.1.1/src/cmake/hyhound-build-time.cpp.in +4 -0
  26. hyhound-1.1.1/src/cmake/hyhound-version.h.in +22 -0
  27. hyhound-1.1.1/src/config.hpp.in +33 -0
  28. hyhound-1.1.1/src/hyhound/include/hyhound/householder-apply-serial.tpp +136 -0
  29. hyhound-1.1.1/src/hyhound/include/hyhound/householder-updowndate-micro-kernels.tpp +110 -0
  30. hyhound-1.1.1/src/hyhound/include/hyhound/householder-updowndate-serial.tpp +172 -0
  31. hyhound-1.1.1/src/hyhound/include/hyhound/householder-updowndate.hpp +142 -0
  32. hyhound-1.1.1/src/hyhound/include/hyhound/micro-kernels/common.hpp +84 -0
  33. hyhound-1.1.1/src/hyhound/include/hyhound/micro-kernels/householder-updowndate-diag.tpp +86 -0
  34. hyhound-1.1.1/src/hyhound/include/hyhound/micro-kernels/householder-updowndate-full.tpp +76 -0
  35. hyhound-1.1.1/src/hyhound/include/hyhound/micro-kernels/householder-updowndate-tail.tpp +98 -0
  36. hyhound-1.1.1/src/hyhound/include/hyhound/micro-kernels/householder-updowndate.hpp +85 -0
  37. hyhound-1.1.1/src/hyhound/include/hyhound/micro-kernels/matrix-accessor.hpp +91 -0
  38. hyhound-1.1.1/src/hyhound/include/hyhound/updown.hpp +65 -0
  39. hyhound-1.1.1/src/hyhound/src/householder-updowndate-serial.cpp.in +32 -0
  40. hyhound-1.1.1/src/hyhound/src/hyhound.cpp +0 -0
  41. hyhound-1.1.1/src/hyhound/src/micro-kernels/Codegen.cmake +51 -0
  42. hyhound-1.1.1/src/hyhound/src/micro-kernels/householder-updowndate-diag.cpp.in +20 -0
  43. hyhound-1.1.1/src/hyhound/src/micro-kernels/householder-updowndate-full.cpp.in +20 -0
  44. hyhound-1.1.1/src/hyhound/src/micro-kernels/householder-updowndate-tail.cpp.in +59 -0
  45. hyhound-1.1.1/src/ocp/include/hyhound/ocp/riccati.hpp +110 -0
  46. hyhound-1.1.1/src/ocp/include/hyhound/ocp/schur.hpp +95 -0
  47. hyhound-1.1.1/src/ocp/src/riccati/factor.cpp +42 -0
  48. hyhound-1.1.1/src/ocp/src/riccati/solve.cpp +71 -0
  49. hyhound-1.1.1/src/ocp/src/riccati/update.cpp +71 -0
  50. hyhound-1.1.1/src/ocp/src/schur/factor.cpp +71 -0
  51. hyhound-1.1.1/src/ocp/src/schur/solve.cpp +95 -0
  52. hyhound-1.1.1/src/ocp/src/schur/update.cpp +99 -0
  53. hyhound-1.1.1/src/util/include/hyhound/assume.hpp +18 -0
  54. hyhound-1.1.1/src/util/include/hyhound/cneg.hpp +73 -0
  55. hyhound-1.1.1/src/util/include/hyhound/loop.hpp +53 -0
  56. hyhound-1.1.1/src/util/include/hyhound/lut.hpp +41 -0
  57. hyhound-1.1.1/src/util/include/hyhound/unroll.h +35 -0
  58. hyhound-1.1.1/test/CMakeLists.txt +38 -0
  59. hyhound-1.1.1/test/test-downdate.cpp +135 -0
  60. hyhound-1.1.1/test/test-ocp.cpp +105 -0
  61. hyhound-1.1.1/test/test-updowndate.cpp +128 -0
@@ -0,0 +1,111 @@
1
+ cmake_minimum_required(VERSION 3.24...4.1)
2
+ set(CMAKE_CXX_SCAN_FOR_MODULES Off)
3
+ project(hyhound
4
+ VERSION 1.1.1
5
+ DESCRIPTION "Hyperbolic Householder transformations for Cholesky factorization up- and downdates"
6
+ HOMEPAGE_URL "https://github.com/kul-optec/hyhound"
7
+ LANGUAGES CXX
8
+ )
9
+ include(CTest)
10
+ set(PY_VERSION_SUFFIX "")
11
+
12
+ # Make sure that the Python and CMake versions match
13
+ set(PY_FULL_VERSION ${PROJECT_VERSION}${PY_VERSION_SUFFIX})
14
+ if (DEFINED PY_BUILD_CMAKE_PROJECT_VERSION)
15
+ if (NOT "${PY_BUILD_CMAKE_PROJECT_VERSION}" MATCHES "^${PY_FULL_VERSION}$")
16
+ message(FATAL_ERROR "Version number does not match "
17
+ "(${PY_BUILD_CMAKE_PROJECT_VERSION} - ${PY_FULL_VERSION}).")
18
+ endif()
19
+ endif()
20
+
21
+ # Options
22
+ include(CMakeDependentOption)
23
+ set(HYHOUND_DENSE_REAL_TYPE "double" "float" CACHE STRING
24
+ "The floating point types that the functions are instantiated for")
25
+ set(HYHOUND_DENSE_INDEX_TYPE "long long" CACHE STRING
26
+ "The main integer type for indices and sizes")
27
+ # Target options
28
+ option(HYHOUND_HAVE_TWO_512_FMA_UNITS
29
+ "Does the CPU have 0.5 CPI 512-bit FMA" Off)
30
+ set(HYHOUND_MAX_HYH_KERNEL_WIDTH "8" CACHE STRING
31
+ "Kernel size limit for the 'diagonal' kernels")
32
+ set(HYHOUND_MAX_HYH_KERNEL_HEIGHT "32" CACHE STRING
33
+ "Kernel size limit for the 'below-diagonal' kernels")
34
+ # Enable/disable optional components
35
+ option(HYHOUND_WITH_TESTS
36
+ "Build the tests" ${BUILD_TESTING})
37
+ option(HYHOUND_WITH_OCP
38
+ "Build the OCP solvers" Off)
39
+ option(HYHOUND_WITH_BENCHMARKS
40
+ "Build the benchmarks" Off)
41
+ option(HYHOUND_WITH_PYTHON
42
+ "Build the Python interface" Off)
43
+ option(HYHOUND_WITH_PYTHON_DISPATCH
44
+ "Build the AVX2/AVX-512 dispatch logic for the Python interface" Off)
45
+ # Developer options
46
+ option(HYHOUND_WARNINGS_AS_ERRORS
47
+ "Enable -Werror or /WX" Off)
48
+ option(HYHOUND_WITH_ACCURATE_BUILD_TIME
49
+ "Update the build time on every build" On)
50
+ option(HYHOUND_VERIFY_ASSUMPTIONS
51
+ "Check assumptions at run time instead of blindly assuming" Off)
52
+ option(HYHOUND_FORCE_TEST_DISCOVERY
53
+ "Query the test executables even when cross-compiling" Off)
54
+ option(HYHOUND_DEVELOPER_MODE
55
+ "Enable developer options such as ccache and colored compiler output" Off)
56
+
57
+ # Installation paths
58
+ include(GNUInstallDirs)
59
+ set(HYHOUND_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}"
60
+ CACHE PATH "Installation directory for archives and libraries")
61
+ set(HYHOUND_INSTALL_CMAKEDIR "${HYHOUND_INSTALL_LIBDIR}/cmake/hyhound"
62
+ CACHE PATH "Installation directory for CMake configuration files")
63
+ set(HYHOUND_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}"
64
+ CACHE PATH "Installation directory for binaries and DLLs")
65
+ set(HYHOUND_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}"
66
+ CACHE PATH "Installation directory for headers")
67
+ option(HYHOUND_STANDALONE
68
+ "Install with relative RPATH to locate its own shared libraries" On)
69
+
70
+ # Development
71
+ if (PROJECT_IS_TOP_LEVEL)
72
+ set(CMAKE_EXPORT_COMPILE_COMMANDS On)
73
+ endif()
74
+ if (HYHOUND_DEVELOPER_MODE)
75
+ include(cmake/Develop.cmake)
76
+ endif()
77
+
78
+ # Compiler warnings
79
+ include(cmake/Warnings.cmake)
80
+ add_warnings_target(warnings ${HYHOUND_WARNINGS_AS_ERRORS})
81
+ add_library(hyhound::warnings ALIAS warnings)
82
+
83
+ # Other compiler and CMake options
84
+ set(CMAKE_RELEASE_POSTFIX "")
85
+ set(CMAKE_DEBUG_POSTFIX "_d")
86
+ set(CMAKE_RELWITHDEBINFO_POSTFIX "_rd")
87
+ set(CMAKE_MINSIZEREL_POSTFIX "_rs")
88
+
89
+ # Locating dependencies
90
+ if (DEFINED ENV{MKLROOT})
91
+ list(PREPEND CMAKE_FIND_ROOT_PATH "$ENV{MKLROOT}")
92
+ endif()
93
+
94
+ # Libraries
95
+ add_subdirectory(src)
96
+
97
+ # Tests
98
+ if (HYHOUND_WITH_TESTS)
99
+ enable_testing()
100
+ add_subdirectory(test)
101
+ endif()
102
+
103
+ # Benchmarks
104
+ if (HYHOUND_WITH_BENCHMARKS)
105
+ add_subdirectory(benchmarks)
106
+ endif()
107
+
108
+ # Python interface
109
+ if (HYHOUND_WITH_PYTHON)
110
+ add_subdirectory(python)
111
+ endif()
hyhound-1.1.1/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
hyhound-1.1.1/PKG-INFO ADDED
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyhound
3
+ Version: 1.1.1
4
+ Summary: Hyperbolic Householder transformations for Up- and Downdating Cholesky factorizations.
5
+ Keywords: linear-algebra,cholesky,update,downdate,matrix
6
+ Author-Email: Pieter P <pieter.p.dev@outlook.com>
7
+ License-Expression: LGPL-3.0-or-later
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: Microsoft :: Windows
22
+ Classifier: Operating System :: MacOS
23
+ Classifier: Typing :: Typed
24
+ Project-URL: Documentation, https://kul-optec.github.io/hyhound
25
+ Project-URL: Source, https://github.com/kul-optec/hyhound
26
+ Project-URL: Bug Tracker, https://github.com/kul-optec/hyhound/issues
27
+ Requires-Python: >=3.9
28
+ Requires-Dist: numpy<3
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest<9,>=7.2.0; extra == "test"
31
+ Provides-Extra: docs
32
+ Requires-Dist: sphinx==8.2.3; extra == "docs"
33
+ Requires-Dist: sphinx-book-theme==1.1.4; extra == "docs"
34
+ Requires-Dist: numpydoc==1.9.0; extra == "docs"
35
+ Requires-Dist: breathe==4.36.0; extra == "docs"
36
+ Description-Content-Type: text/x-rst
37
+
38
+ .. image:: https://img.shields.io/badge/arXiv-Preprint-b31b1b
39
+ :target: https://arxiv.org/abs/2503.15372v1
40
+ :alt: arXiv Preprint
41
+
42
+ .. image:: https://github.com/kul-optec/hyhound/actions/workflows/linux.yml/badge.svg
43
+ :target: https://github.com/kul-optec/hyhound/actions/workflows/linux.yml
44
+ :alt: CI: Linux
45
+
46
+ .. image:: https://img.shields.io/pypi/dm/hyhound?label=PyPI&logo=python
47
+ :target: https://pypi.org/project/hyhound
48
+ :alt: PyPI Downloads
49
+
50
+
51
+ hyhound
52
+ =======
53
+
54
+ **Hy**\perbolic **Ho**\useholder transformations for **U**\p- ‘**n**’ **D**\owndating Cholesky factorizations.
55
+
56
+
57
+ Purpose
58
+ -------
59
+
60
+ Given a Cholesky factor :math:`L` of a dense matrix :math:`H`, the
61
+ ``hyhound::update_cholesky`` function computes the Cholesky factor
62
+ :math:`\tilde L` of the matrix
63
+
64
+ .. math::
65
+
66
+ \tilde H = \tilde L \tilde L^\top = H + A \Sigma A^\top,
67
+
68
+ where :math:`H,\tilde H\in\mathbb{R}^{n\times n}` with :math:`H \succ 0`
69
+ and :math:`\tilde H \succ 0`, :math:`A \in \mathbb{R}^{n\times m}`,
70
+ :math:`\Sigma \in \mathbb{R}^{m\times m}` diagonal,
71
+ and :math:`L, \tilde L\in\mathbb{R}^{n\times n}` lower triangular.
72
+
73
+ Computing :math:`\tilde L` in this way is done in
74
+ :math:`mn^2 + \mathcal{O}(n^2 + mn)` operations rather than the
75
+ :math:`\tfrac16 n^3 + \tfrac12 mn^2 + \mathcal{O}(n^2 + mn)` operations
76
+ required for the explicit evaluation and factorization of :math:`\tilde H`.
77
+ When :math:`m \ll n`, this results in a considerable speedup over full
78
+ factorization, enabling efficient low-rank updates of Cholesky
79
+ factorizations, for use in e.g. iterative algorithms for numerical
80
+ optimization.
81
+
82
+ Additionally, hyhound includes efficient routines for updating
83
+ factorizations of the Riccati recursion for optimal control problems.
84
+
85
+
86
+ Preprint
87
+ --------
88
+
89
+ The paper describing the algorithms in this repository can be found on arXiv:
90
+ `https://arxiv.org/abs/2503.15372v1 <https://arxiv.org/abs/2503.15372v1>`_
91
+
92
+ .. code-block:: bibtex
93
+
94
+ @misc{pas_blocked_2025,
95
+ title = {Blocked {Cholesky} factorization updates of the {Riccati} recursion using hyperbolic {Householder} transformations},
96
+ url = {http://arxiv.org/abs/2503.15372},
97
+ doi = {10.48550/arXiv.2503.15372},
98
+ publisher = {arXiv},
99
+ author = {Pas, Pieter and Patrinos, Panagiotis},
100
+ month = mar,
101
+ year = {2025},
102
+ note = {Accepted for publication in the Proceedings of CDC 2025}
103
+ }
@@ -0,0 +1,23 @@
1
+ # Strip and install debug information
2
+ function(hyhound_install_debug_syms target component dest_lib dest_bin)
3
+ if (MSVC)
4
+ install(FILES "$<TARGET_PDB_FILE:${target}>"
5
+ DESTINATION ${dest_bin}
6
+ CONFIGURATIONS Debug RelWithDebInfo
7
+ COMPONENT ${component}
8
+ OPTIONAL EXCLUDE_FROM_ALL)
9
+ elseif (CMAKE_STRIP AND CMAKE_OBJCOPY)
10
+ set(DEBUG_FILE "$<TARGET_FILE_NAME:${target}>.debug")
11
+ add_custom_command(TARGET ${target} POST_BUILD
12
+ COMMAND "${CMAKE_STRIP}" "--only-keep-debug" "$<TARGET_FILE:${target}>" "-o" "${DEBUG_FILE}"
13
+ COMMAND "${CMAKE_STRIP}" "--strip-debug" "$<TARGET_FILE:${target}>"
14
+ COMMAND "${CMAKE_OBJCOPY}" "--add-gnu-debuglink=${DEBUG_FILE}" "$<TARGET_FILE:${target}>"
15
+ COMMAND "${CMAKE_COMMAND}" "-E" "echo" "Stripped into ${DEBUG_FILE}"
16
+ WORKING_DIRECTORY $<TARGET_FILE_DIR:${target}>)
17
+ install(FILES "$<TARGET_FILE_DIR:${target}>/${DEBUG_FILE}"
18
+ DESTINATION ${dest_lib}
19
+ CONFIGURATIONS Debug RelWithDebInfo
20
+ COMPONENT ${component}
21
+ EXCLUDE_FROM_ALL)
22
+ endif()
23
+ endfunction()
@@ -0,0 +1,12 @@
1
+ set(CMAKE_EXPORT_COMPILE_COMMANDS On)
2
+ set(CMAKE_C_COMPILER_LAUNCHER "sccache")
3
+ set(CMAKE_CXX_COMPILER_LAUNCHER "sccache")
4
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
5
+ add_compile_options(-fdiagnostics-color=always)
6
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
7
+ add_compile_options(-fcolor-diagnostics)
8
+ endif()
9
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
10
+ add_compile_options(-ffunction-sections)
11
+ add_link_options(LINKER:--gc-sections)
12
+ endif()
@@ -0,0 +1,128 @@
1
+ function(add_warnings_target tgt_name warnings_as_errors)
2
+
3
+ # GCC, Clang, AppleClang
4
+ set(COMMON_WARNINGS_CXX
5
+ -fdiagnostics-show-option
6
+ -Wall
7
+ -Wextra
8
+ -pedantic
9
+ -Wpedantic
10
+ -pedantic-errors
11
+ -Wdouble-promotion
12
+ -Wswitch-default
13
+ -Wswitch-enum
14
+ -Wno-missing-braces
15
+ -Wno-psabi
16
+ -Wimplicit-fallthrough
17
+ -Wuninitialized
18
+ -Wconversion
19
+ -Wno-sign-conversion
20
+ )
21
+ set(COMMON_WARNINGS_Fortran
22
+ -fdiagnostics-show-option
23
+ -Wall
24
+ -Wextra
25
+ -Wpedantic
26
+ -fimplicit-none
27
+ )
28
+ set(COMMON_WARNINGS_C
29
+ -fdiagnostics-show-option
30
+ -Wall
31
+ -Wextra
32
+ -pedantic
33
+ -Wpedantic
34
+ -pedantic-errors
35
+ -Wimplicit-fallthrough
36
+ -Wuninitialized
37
+ -Wconversion
38
+ -Wno-sign-conversion
39
+ )
40
+ # GCC
41
+ set(GCC_WARNINGS_CXX
42
+ -Wno-error=unused-but-set-variable
43
+ -Wsuggest-override
44
+ -Wno-error=attributes
45
+ -ftemplate-backtrace-limit=99
46
+ )
47
+ if (NOT CMAKE_CXX_CLANG_TIDY)
48
+ list(APPEND GCC_WARNINGS_CXX -fconcepts-diagnostics-depth=99)
49
+ endif()
50
+ # Clang, AppleClang
51
+ set(CLANG_WARNINGS_CXX
52
+ -Wno-error=unknown-warning-option
53
+ -Wno-newline-eof
54
+ -Wno-error=unused-but-set-variable
55
+ -Winconsistent-missing-override
56
+ -Wno-gnu-zero-variadic-macro-arguments
57
+ -Wunreachable-code
58
+ -Wunreachable-code-break
59
+ -Wunreachable-code-fallthrough
60
+ -Wunreachable-code-return
61
+ -Wunreachable-code-aggressive
62
+ -Wno-error=self-assign-overloaded
63
+ -Wno-non-c-typedef-for-linkage
64
+ -Wno-return-type-c-linkage
65
+ )
66
+ # Flang
67
+ set(FLANG_WARNINGS_Fortran
68
+ -fimplicit-none
69
+ )
70
+ # MSVC (Microsoft)
71
+ set(MSVC_WARNINGS_CXX
72
+ /W3
73
+ /wd4127 # conditional expression is constant
74
+ /wd4458 # declaration of 'x' hides class member
75
+ /wd4251 # 'x' needs to have dll-interface to be used by clients of 'y'
76
+ /wd4305 # 'initializing': truncation from 'double' to 'float'
77
+ /wd4661 # no suitable definition provided for explicit template instantiation request
78
+ /wd5030 # attribute 'attribute-name' is not recognized
79
+ )
80
+ set(MSVC_WARNINGS_C
81
+ /W4
82
+ )
83
+ # Intel ICC
84
+ set(INTEL_WARNINGS_CXX
85
+ -Wall
86
+ -Wextra
87
+ )
88
+ set(INTEL_WARNINGS_Fortran
89
+ -Wall
90
+ -Wextra
91
+ )
92
+ set(INTEL_WARNINGS_C
93
+ -Wall
94
+ -Wextra
95
+ )
96
+
97
+ # Add target that defines all the warning options in its interface.
98
+ add_library(${tgt_name} INTERFACE)
99
+
100
+ foreach (LANG C CXX Fortran)
101
+ # Enable warnings as errors
102
+ if (warnings_as_errors)
103
+ list(APPEND COMMON_WARNINGS_${LANG} -Werror)
104
+ list(APPEND MSVC_WARNINGS_${LANG} /WX)
105
+ list(APPEND INTEL_WARNINGS_${LANG} -Werror)
106
+ list(APPEND FLANG_WARNINGS_${LANG} -Werror)
107
+ endif()
108
+ if (CMAKE_${LANG}_COMPILER_ID MATCHES "GNU")
109
+ target_compile_options(${tgt_name} INTERFACE
110
+ $<$<COMPILE_LANGUAGE:${LANG}>:$<BUILD_INTERFACE:${COMMON_WARNINGS_${LANG}} ${GCC_WARNINGS_${LANG}}>>)
111
+ elseif (CMAKE_${LANG}_COMPILER_ID MATCHES ".*Clang")
112
+ target_compile_options(${tgt_name} INTERFACE
113
+ $<$<COMPILE_LANGUAGE:${LANG}>:$<BUILD_INTERFACE:${COMMON_WARNINGS_${LANG}} ${CLANG_WARNINGS_${LANG}}>>)
114
+ elseif (CMAKE_${LANG}_COMPILER_ID MATCHES "Flang")
115
+ target_compile_options(${tgt_name} INTERFACE
116
+ $<$<COMPILE_LANGUAGE:${LANG}>:$<BUILD_INTERFACE:${FLANG_WARNINGS_${LANG}}>>)
117
+ elseif (CMAKE_${LANG}_COMPILER_ID MATCHES "MSVC")
118
+ target_compile_options(${tgt_name} INTERFACE
119
+ $<$<COMPILE_LANGUAGE:${LANG}>:$<BUILD_INTERFACE:${MSVC_WARNINGS_${LANG}}>>)
120
+ elseif (CMAKE_${LANG}_COMPILER_ID MATCHES "Intel")
121
+ target_compile_options(${tgt_name} INTERFACE
122
+ $<$<COMPILE_LANGUAGE:${LANG}>:$<BUILD_INTERFACE:${INTEL_WARNINGS_${LANG}}>>)
123
+ elseif (DEFINED CMAKE_${LANG}_COMPILER_ID)
124
+ message(WARNING "No known warnings for this ${LANG} compiler (${CMAKE_${LANG}_COMPILER_ID})")
125
+ endif()
126
+ endforeach()
127
+
128
+ endfunction()
@@ -0,0 +1,129 @@
1
+ import os
2
+
3
+ from conan import ConanFile
4
+ from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
5
+ from conan.tools.build import can_run
6
+ from conan.tools.files import save
7
+ from conan.tools.scm import Git
8
+
9
+
10
+ class HyhoundRecipe(ConanFile):
11
+ name = "hyhound"
12
+ version = "1.1.1"
13
+
14
+ # Optional metadata
15
+ license = "LGPL-3.0-or-later"
16
+ author = "Pieter P <pieter.p.dev@outlook.com>"
17
+ url = "https://github.com/kul-optec/hyhound"
18
+ description = "Hyperbolic Householder transformations for Cholesky factorization up- and downdates."
19
+ topics = "scientific software"
20
+
21
+ # Binary configuration
22
+ package_type = "library"
23
+ settings = "os", "compiler", "build_type", "arch"
24
+ bool_hyhound_options = {
25
+ "with_ocp": False,
26
+ "with_benchmarks": False,
27
+ "with_python": False,
28
+ "with_python_dispatch": False,
29
+ }
30
+ options = {
31
+ "shared": [True, False],
32
+ "fPIC": [True, False],
33
+ "real_type": ["double;float", "float;double", "double", "float"],
34
+ "with_conan_python": [True, False],
35
+ } | {k: [True, False] for k in bool_hyhound_options}
36
+ default_options = {
37
+ "shared": False,
38
+ "fPIC": True,
39
+ "real_type": "double;float",
40
+ "with_conan_python": False,
41
+ } | bool_hyhound_options
42
+
43
+ # Sources are located in the same place as this recipe, copy them to the recipe
44
+ exports_sources = (
45
+ "CMakeLists.txt",
46
+ "src/*",
47
+ "cmake/*",
48
+ "test/*",
49
+ "benchmarks/*",
50
+ "LICENSE",
51
+ "README.md",
52
+ )
53
+
54
+ def export_sources(self):
55
+ git = Git(self)
56
+ status_cmd = "status . --short --no-branch --untracked-files=no"
57
+ dirty = bool(git.run(status_cmd).strip())
58
+ hash = git.get_commit() + ("-dirty" if dirty else "")
59
+ print("Commit hash:", hash)
60
+ save(self, os.path.join(self.export_sources_folder, "commit.txt"), hash)
61
+
62
+ generators = ("CMakeDeps",)
63
+
64
+ def requirements(self):
65
+ self.requires(
66
+ "guanaqo/1.0.0-alpha.22", transitive_headers=True, transitive_libs=True
67
+ )
68
+ if self.options.with_ocp:
69
+ self.requires("eigen/5.0.0", transitive_headers=True)
70
+ elif self.options.with_benchmarks:
71
+ self.requires("eigen/5.0.0")
72
+ else:
73
+ self.test_requires("eigen/5.0.0")
74
+ if self.options.with_benchmarks:
75
+ self.requires("benchmark/1.9.4")
76
+ if self.options.with_python:
77
+ self.requires("nanobind/2.9.2")
78
+ if self.options.with_python_dispatch:
79
+ self.requires("cpu_features/0.10.1")
80
+ if self.options.with_conan_python:
81
+ self.requires("tttapa-python-dev/3.13.7")
82
+
83
+ def build_requirements(self):
84
+ self.test_requires("gtest/1.17.0")
85
+ self.tool_requires("cmake/[>=3.24 <4.2]")
86
+
87
+ def config_options(self):
88
+ if self.settings.get_safe("os") == "Windows":
89
+ self.options.rm_safe("fPIC")
90
+
91
+ def configure(self):
92
+ with_tests = not self.conf.get("tools.build:skip_test", default=False)
93
+ if self.options.with_benchmarks or self.options.with_ocp or with_tests:
94
+ self.options["guanaqo/*"].with_blas = True
95
+
96
+ def layout(self):
97
+ cmake_layout(self)
98
+ self.cpp.build.builddirs.append("")
99
+
100
+ def generate(self):
101
+ tc = CMakeToolchain(self)
102
+ for k in self.bool_hyhound_options:
103
+ value = self.options.get_safe(k)
104
+ if value is not None and value.value is not None:
105
+ tc.variables["HYHOUND_" + k.upper()] = bool(value)
106
+ guanaqo = self.dependencies["guanaqo"]
107
+ index_type = guanaqo.options.get_safe("blas_index_type", default="int")
108
+ real_type = str(self.options.real_type)
109
+ print("index_type:", index_type)
110
+ print("real_type: ", real_type)
111
+ tc.variables["HYHOUND_DENSE_INDEX_TYPE"] = index_type
112
+ tc.variables["HYHOUND_DENSE_REAL_TYPE"] = real_type
113
+ if can_run(self):
114
+ tc.variables["HYHOUND_FORCE_TEST_DISCOVERY"] = True
115
+ tc.generate()
116
+
117
+ def build(self):
118
+ cmake = CMake(self)
119
+ cmake.configure()
120
+ cmake.build()
121
+ cmake.test()
122
+
123
+ def package(self):
124
+ cmake = CMake(self)
125
+ cmake.install()
126
+
127
+ def package_info(self):
128
+ self.cpp_info.set_property("cmake_find_mode", "none")
129
+ self.cpp_info.builddirs.append(os.path.join("lib", "cmake", "hyhound"))