xad 2.1.0__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 (196) hide show
  1. xad-2.1.0/.clang-format +88 -0
  2. xad-2.1.0/.flake8 +3 -0
  3. xad-2.1.0/.gitignore +62 -0
  4. xad-2.1.0/.gitmodules +6 -0
  5. xad-2.1.0/.pre-commit-config.yaml +58 -0
  6. xad-2.1.0/CHANGELOG.md +49 -0
  7. xad-2.1.0/CMakeLists.txt +36 -0
  8. xad-2.1.0/CODE_OF_CONDUCT.md +144 -0
  9. xad-2.1.0/CONTRIBUTING.md +149 -0
  10. xad-2.1.0/LICENSE.md +672 -0
  11. xad-2.1.0/PKG-INFO +135 -0
  12. xad-2.1.0/README.md +98 -0
  13. xad-2.1.0/pyproject.toml +118 -0
  14. xad-2.1.0/samples/adj_1st.py +71 -0
  15. xad-2.1.0/samples/fwd_1st.py +56 -0
  16. xad-2.1.0/samples/swap_pricer.py +91 -0
  17. xad-2.1.0/src/CMakeLists.txt +100 -0
  18. xad-2.1.0/src/double_caster.hpp +64 -0
  19. xad-2.1.0/src/exceptions.hpp +53 -0
  20. xad-2.1.0/src/math.hpp +212 -0
  21. xad-2.1.0/src/module.cpp +63 -0
  22. xad-2.1.0/src/pybind11/.appveyor.yml +50 -0
  23. xad-2.1.0/src/pybind11/.clang-format +38 -0
  24. xad-2.1.0/src/pybind11/.clang-tidy +83 -0
  25. xad-2.1.0/src/pybind11/.cmake-format.yaml +73 -0
  26. xad-2.1.0/src/pybind11/.codespell-ignore-lines +36 -0
  27. xad-2.1.0/src/pybind11/.gitattributes +1 -0
  28. xad-2.1.0/src/pybind11/.gitignore +58 -0
  29. xad-2.1.0/src/pybind11/.pre-commit-config.yaml +158 -0
  30. xad-2.1.0/src/pybind11/.readthedocs.yml +20 -0
  31. xad-2.1.0/src/pybind11/AGENTS.md +99 -0
  32. xad-2.1.0/src/pybind11/CMakeLists.txt +444 -0
  33. xad-2.1.0/src/pybind11/CMakePresets.json +93 -0
  34. xad-2.1.0/src/pybind11/LICENSE +29 -0
  35. xad-2.1.0/src/pybind11/README.rst +215 -0
  36. xad-2.1.0/src/pybind11/SECURITY.md +13 -0
  37. xad-2.1.0/src/pybind11/include/pybind11/attr.h +730 -0
  38. xad-2.1.0/src/pybind11/include/pybind11/buffer_info.h +209 -0
  39. xad-2.1.0/src/pybind11/include/pybind11/cast.h +2452 -0
  40. xad-2.1.0/src/pybind11/include/pybind11/chrono.h +227 -0
  41. xad-2.1.0/src/pybind11/include/pybind11/common.h +2 -0
  42. xad-2.1.0/src/pybind11/include/pybind11/complex.h +97 -0
  43. xad-2.1.0/src/pybind11/include/pybind11/conduit/README.txt +15 -0
  44. xad-2.1.0/src/pybind11/include/pybind11/conduit/pybind11_conduit_v1.h +116 -0
  45. xad-2.1.0/src/pybind11/include/pybind11/conduit/pybind11_platform_abi_id.h +87 -0
  46. xad-2.1.0/src/pybind11/include/pybind11/conduit/wrap_include_python_h.h +72 -0
  47. xad-2.1.0/src/pybind11/include/pybind11/critical_section.h +56 -0
  48. xad-2.1.0/src/pybind11/include/pybind11/detail/argument_vector.h +417 -0
  49. xad-2.1.0/src/pybind11/include/pybind11/detail/class.h +848 -0
  50. xad-2.1.0/src/pybind11/include/pybind11/detail/common.h +1418 -0
  51. xad-2.1.0/src/pybind11/include/pybind11/detail/cpp_conduit.h +75 -0
  52. xad-2.1.0/src/pybind11/include/pybind11/detail/descr.h +231 -0
  53. xad-2.1.0/src/pybind11/include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h +39 -0
  54. xad-2.1.0/src/pybind11/include/pybind11/detail/exception_translation.h +71 -0
  55. xad-2.1.0/src/pybind11/include/pybind11/detail/function_record_pyobject.h +191 -0
  56. xad-2.1.0/src/pybind11/include/pybind11/detail/function_ref.h +101 -0
  57. xad-2.1.0/src/pybind11/include/pybind11/detail/holder_caster_foreign_helpers.h +104 -0
  58. xad-2.1.0/src/pybind11/include/pybind11/detail/init.h +548 -0
  59. xad-2.1.0/src/pybind11/include/pybind11/detail/internals.h +1082 -0
  60. xad-2.1.0/src/pybind11/include/pybind11/detail/native_enum_data.h +227 -0
  61. xad-2.1.0/src/pybind11/include/pybind11/detail/pybind11_namespace_macros.h +82 -0
  62. xad-2.1.0/src/pybind11/include/pybind11/detail/struct_smart_holder.h +398 -0
  63. xad-2.1.0/src/pybind11/include/pybind11/detail/type_caster_base.h +1734 -0
  64. xad-2.1.0/src/pybind11/include/pybind11/detail/typeid.h +65 -0
  65. xad-2.1.0/src/pybind11/include/pybind11/detail/using_smart_holder.h +22 -0
  66. xad-2.1.0/src/pybind11/include/pybind11/detail/value_and_holder.h +92 -0
  67. xad-2.1.0/src/pybind11/include/pybind11/eigen/common.h +9 -0
  68. xad-2.1.0/src/pybind11/include/pybind11/eigen/matrix.h +723 -0
  69. xad-2.1.0/src/pybind11/include/pybind11/eigen/tensor.h +520 -0
  70. xad-2.1.0/src/pybind11/include/pybind11/eigen.h +12 -0
  71. xad-2.1.0/src/pybind11/include/pybind11/embed.h +260 -0
  72. xad-2.1.0/src/pybind11/include/pybind11/eval.h +160 -0
  73. xad-2.1.0/src/pybind11/include/pybind11/functional.h +140 -0
  74. xad-2.1.0/src/pybind11/include/pybind11/gil.h +203 -0
  75. xad-2.1.0/src/pybind11/include/pybind11/gil_safe_call_once.h +283 -0
  76. xad-2.1.0/src/pybind11/include/pybind11/gil_simple.h +37 -0
  77. xad-2.1.0/src/pybind11/include/pybind11/iostream.h +301 -0
  78. xad-2.1.0/src/pybind11/include/pybind11/native_enum.h +76 -0
  79. xad-2.1.0/src/pybind11/include/pybind11/numpy.h +2412 -0
  80. xad-2.1.0/src/pybind11/include/pybind11/operators.h +202 -0
  81. xad-2.1.0/src/pybind11/include/pybind11/options.h +92 -0
  82. xad-2.1.0/src/pybind11/include/pybind11/pybind11.h +4031 -0
  83. xad-2.1.0/src/pybind11/include/pybind11/pytypes.h +2726 -0
  84. xad-2.1.0/src/pybind11/include/pybind11/stl/filesystem.h +114 -0
  85. xad-2.1.0/src/pybind11/include/pybind11/stl.h +666 -0
  86. xad-2.1.0/src/pybind11/include/pybind11/stl_bind.h +868 -0
  87. xad-2.1.0/src/pybind11/include/pybind11/subinterpreter.h +465 -0
  88. xad-2.1.0/src/pybind11/include/pybind11/trampoline_self_life_support.h +65 -0
  89. xad-2.1.0/src/pybind11/include/pybind11/type_caster_pyobject_ptr.h +61 -0
  90. xad-2.1.0/src/pybind11/include/pybind11/typing.h +293 -0
  91. xad-2.1.0/src/pybind11/include/pybind11/warnings.h +75 -0
  92. xad-2.1.0/src/pybind11/noxfile.py +151 -0
  93. xad-2.1.0/src/pybind11/pybind11/__init__.py +19 -0
  94. xad-2.1.0/src/pybind11/pybind11/__main__.py +109 -0
  95. xad-2.1.0/src/pybind11/pybind11/_version.py +34 -0
  96. xad-2.1.0/src/pybind11/pybind11/commands.py +140 -0
  97. xad-2.1.0/src/pybind11/pybind11/py.typed +0 -0
  98. xad-2.1.0/src/pybind11/pybind11/setup_helpers.py +493 -0
  99. xad-2.1.0/src/pybind11/pyproject.toml +221 -0
  100. xad-2.1.0/src/pybind11/tools/FindCatch.cmake +74 -0
  101. xad-2.1.0/src/pybind11/tools/FindEigen3.cmake +86 -0
  102. xad-2.1.0/src/pybind11/tools/FindPythonLibsNew.cmake +320 -0
  103. xad-2.1.0/src/pybind11/tools/JoinPaths.cmake +23 -0
  104. xad-2.1.0/src/pybind11/tools/check-style.sh +44 -0
  105. xad-2.1.0/src/pybind11/tools/cmake_uninstall.cmake.in +23 -0
  106. xad-2.1.0/src/pybind11/tools/codespell_ignore_lines_from_errors.py +40 -0
  107. xad-2.1.0/src/pybind11/tools/libsize.py +38 -0
  108. xad-2.1.0/src/pybind11/tools/make_changelog.py +150 -0
  109. xad-2.1.0/src/pybind11/tools/make_global.py +33 -0
  110. xad-2.1.0/src/pybind11/tools/pybind11.pc.in +7 -0
  111. xad-2.1.0/src/pybind11/tools/pybind11Common.cmake +468 -0
  112. xad-2.1.0/src/pybind11/tools/pybind11Config.cmake.in +240 -0
  113. xad-2.1.0/src/pybind11/tools/pybind11GuessPythonExtSuffix.cmake +94 -0
  114. xad-2.1.0/src/pybind11/tools/pybind11NewTools.cmake +340 -0
  115. xad-2.1.0/src/pybind11/tools/pybind11Tools.cmake +217 -0
  116. xad-2.1.0/src/pybind11/tools/test-pybind11GuessPythonExtSuffix.cmake +185 -0
  117. xad-2.1.0/src/real.hpp +203 -0
  118. xad-2.1.0/src/tape.hpp +109 -0
  119. xad-2.1.0/src/xad/.clang-format +90 -0
  120. xad-2.1.0/src/xad/.gitignore +399 -0
  121. xad-2.1.0/src/xad/.lgtm.yml +6 -0
  122. xad-2.1.0/src/xad/CHANGELOG.md +242 -0
  123. xad-2.1.0/src/xad/CMakeLists.txt +106 -0
  124. xad-2.1.0/src/xad/CMakeSettings.json +15 -0
  125. xad-2.1.0/src/xad/CODE_OF_CONDUCT.md +144 -0
  126. xad-2.1.0/src/xad/CONTRIBUTING.md +111 -0
  127. xad-2.1.0/src/xad/LICENSE.md +672 -0
  128. xad-2.1.0/src/xad/README.md +108 -0
  129. xad-2.1.0/src/xad/VERSION +1 -0
  130. xad-2.1.0/src/xad/XAD.natvis +6 -0
  131. xad-2.1.0/src/xad/cmake/XADConfig.cmake.in +30 -0
  132. xad-2.1.0/src/xad/cmake/XADSetupCompiler.cmake +197 -0
  133. xad-2.1.0/src/xad/cmake/XADSetupOptions.cmake +80 -0
  134. xad-2.1.0/src/xad/cmake/XADSetupTesting.cmake +98 -0
  135. xad-2.1.0/src/xad/cmake/XADSetupVersion.cmake +97 -0
  136. xad-2.1.0/src/xad/src/CMakeLists.txt +244 -0
  137. xad-2.1.0/src/xad/src/Tape.cpp +756 -0
  138. xad-2.1.0/src/xad/src/XAD/ABool.hpp +259 -0
  139. xad-2.1.0/src/xad/src/XAD/ARealDirect.hpp +83 -0
  140. xad-2.1.0/src/xad/src/XAD/AlignedAllocator.hpp +97 -0
  141. xad-2.1.0/src/xad/src/XAD/BinaryDerivativeImpl.hpp +70 -0
  142. xad-2.1.0/src/xad/src/XAD/BinaryExpr.hpp +124 -0
  143. xad-2.1.0/src/xad/src/XAD/BinaryFunctors.hpp +69 -0
  144. xad-2.1.0/src/xad/src/XAD/BinaryMathFunctors.hpp +304 -0
  145. xad-2.1.0/src/xad/src/XAD/BinaryOperatorMacros.hpp +160 -0
  146. xad-2.1.0/src/xad/src/XAD/BinaryOperators.hpp +333 -0
  147. xad-2.1.0/src/xad/src/XAD/CheckpointCallback.hpp +37 -0
  148. xad-2.1.0/src/xad/src/XAD/ChunkContainer.hpp +403 -0
  149. xad-2.1.0/src/xad/src/XAD/Complex.hpp +2680 -0
  150. xad-2.1.0/src/xad/src/XAD/Config.hpp.in +55 -0
  151. xad-2.1.0/src/xad/src/XAD/Exceptions.hpp +69 -0
  152. xad-2.1.0/src/xad/src/XAD/Expression.hpp +122 -0
  153. xad-2.1.0/src/xad/src/XAD/FRealDirect.hpp +80 -0
  154. xad-2.1.0/src/xad/src/XAD/Hessian.hpp +135 -0
  155. xad-2.1.0/src/xad/src/XAD/Interface.hpp +241 -0
  156. xad-2.1.0/src/xad/src/XAD/JITBackendInterface.hpp +86 -0
  157. xad-2.1.0/src/xad/src/XAD/JITCompiler.hpp +328 -0
  158. xad-2.1.0/src/xad/src/XAD/JITCompilerTLS.cpp +60 -0
  159. xad-2.1.0/src/xad/src/XAD/JITExprTraits.hpp +122 -0
  160. xad-2.1.0/src/xad/src/XAD/JITGraph.hpp +193 -0
  161. xad-2.1.0/src/xad/src/XAD/JITGraphInterpreter.cpp +550 -0
  162. xad-2.1.0/src/xad/src/XAD/JITGraphInterpreter.hpp +82 -0
  163. xad-2.1.0/src/xad/src/XAD/JITOpCodeTraits.hpp +220 -0
  164. xad-2.1.0/src/xad/src/XAD/Jacobian.hpp +177 -0
  165. xad-2.1.0/src/xad/src/XAD/Literals.hpp +973 -0
  166. xad-2.1.0/src/xad/src/XAD/Macros.hpp +82 -0
  167. xad-2.1.0/src/xad/src/XAD/MathFunctions.hpp +134 -0
  168. xad-2.1.0/src/xad/src/XAD/OperationsContainer.hpp +367 -0
  169. xad-2.1.0/src/xad/src/XAD/OperationsContainerPaired.hpp +321 -0
  170. xad-2.1.0/src/xad/src/XAD/RealDirect.hpp +110 -0
  171. xad-2.1.0/src/xad/src/XAD/ReusableRange.hpp +124 -0
  172. xad-2.1.0/src/xad/src/XAD/StdCompatibility.hpp +505 -0
  173. xad-2.1.0/src/xad/src/XAD/Tape.hpp +347 -0
  174. xad-2.1.0/src/xad/src/XAD/TapeContainer.hpp +50 -0
  175. xad-2.1.0/src/xad/src/XAD/TapeGapList.hpp +37 -0
  176. xad-2.1.0/src/xad/src/XAD/Traits.hpp +103 -0
  177. xad-2.1.0/src/xad/src/XAD/TypeTraits.hpp +46 -0
  178. xad-2.1.0/src/xad/src/XAD/UnaryExpr.hpp +167 -0
  179. xad-2.1.0/src/xad/src/XAD/UnaryFunctors.hpp +93 -0
  180. xad-2.1.0/src/xad/src/XAD/UnaryMathFunctors.hpp +465 -0
  181. xad-2.1.0/src/xad/src/XAD/UnaryOperatorMacros.hpp +211 -0
  182. xad-2.1.0/src/xad/src/XAD/UnaryOperators.hpp +531 -0
  183. xad-2.1.0/src/xad/src/XAD/Vec.hpp +195 -0
  184. xad-2.1.0/src/xad/src/XAD/Version.hpp.in +35 -0
  185. xad-2.1.0/src/xad/src/XAD/XAD.hpp +63 -0
  186. xad-2.1.0/tests/test_exceptions.py +74 -0
  187. xad-2.1.0/tests/test_math_functions_derivatives.py +502 -0
  188. xad-2.1.0/tests/test_package.py +28 -0
  189. xad-2.1.0/tests/test_real_operations.py +645 -0
  190. xad-2.1.0/tests/test_tape.py +149 -0
  191. xad-2.1.0/xad/__init__.py +60 -0
  192. xad-2.1.0/xad/adj_1st/__init__.py +105 -0
  193. xad-2.1.0/xad/exceptions/__init__.py +39 -0
  194. xad-2.1.0/xad/fwd_1st/__init__.py +88 -0
  195. xad-2.1.0/xad/math/__init__.py +177 -0
  196. xad-2.1.0/xad/py.typed +0 -0
@@ -0,0 +1,88 @@
1
+ ---
2
+ Language: Cpp
3
+ # BasedOnStyle: Google
4
+ AccessModifierOffset: -2
5
+ AlignAfterOpenBracket: Align
6
+ AlignConsecutiveAssignments: false
7
+ AlignConsecutiveDeclarations: false
8
+ AlignEscapedNewlinesLeft: false
9
+ AlignOperands: true
10
+ AlignTrailingComments: true
11
+ AllowAllParametersOfDeclarationOnNextLine: true
12
+ AllowShortBlocksOnASingleLine: false
13
+ AllowShortCaseLabelsOnASingleLine: false
14
+ AllowShortIfStatementsOnASingleLine: false
15
+ AllowShortLoopsOnASingleLine: true
16
+ AllowShortFunctionsOnASingleLine: All
17
+ AlwaysBreakAfterDefinitionReturnType: false
18
+ AlwaysBreakTemplateDeclarations: true
19
+ AlwaysBreakBeforeMultilineStrings: true
20
+ BreakBeforeBinaryOperators: None
21
+ BreakBeforeTernaryOperators: true
22
+ BreakConstructorInitializersBeforeComma: false
23
+ BreakAfterJavaFieldAnnotations: false
24
+ BreakStringLiterals: true
25
+ BinPackParameters: true
26
+ BinPackArguments: true
27
+ BraceWrapping:
28
+ AfterClass: true
29
+ AfterControlStatement: true
30
+ AfterEnum: true
31
+ AfterFunction: true
32
+ AfterNamespace: false
33
+ AfterObjCDeclaration: false
34
+ AfterStruct: true
35
+ AfterUnion: true
36
+ BeforeCatch: true
37
+ BeforeElse: true
38
+ IndentBraces: false
39
+ ColumnLimit: 100
40
+ ConstructorInitializerAllOnOneLineOrOnePerLine: true
41
+ ConstructorInitializerIndentWidth: 4
42
+ ContinuationIndentWidth: 4
43
+ DerivePointerAlignment: true
44
+ ExperimentalAutoDetectBinPacking: false
45
+ IndentCaseLabels: true
46
+ IndentWrappedFunctionNames: false
47
+ IndentFunctionDeclarationAfterType: false
48
+ MaxEmptyLinesToKeep: 1
49
+ KeepEmptyLinesAtTheStartOfBlocks: true
50
+ NamespaceIndentation: None
51
+ ObjCBlockIndentWidth: 2
52
+ ObjCSpaceAfterProperty: false
53
+ ObjCSpaceBeforeProtocolList: false
54
+ PenaltyBreakBeforeFirstCallParameter: 1
55
+ PenaltyBreakComment: 300
56
+ PenaltyBreakString: 1000
57
+ PenaltyBreakFirstLessLess: 120
58
+ PenaltyExcessCharacter: 1000000
59
+ PenaltyReturnTypeOnItsOwnLine: 200
60
+ PointerAlignment: Left
61
+ SpacesBeforeTrailingComments: 2
62
+ Cpp11BracedListStyle: true
63
+ Standard: Auto
64
+ IndentWidth: 4
65
+ TabWidth: 8
66
+ UseTab: Never
67
+ BreakBeforeBraces: Allman
68
+ SpacesInParentheses: false
69
+ SpacesInSquareBrackets: false
70
+ SpacesInAngles: false
71
+ SpaceInEmptyParentheses: false
72
+ SpacesInCStyleCastParentheses: false
73
+ SpaceAfterCStyleCast: false
74
+ SpacesInContainerLiterals: true
75
+ SpaceBeforeAssignmentOperators: true
76
+ CommentPragmas: '^ IWYU pragma:'
77
+ ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
78
+ SpaceBeforeParens: ControlStatements
79
+ DisableFormat: false
80
+ IncludeCategories:
81
+ - Regex: '^<.*\.h[p]*>'
82
+ Priority: 1
83
+ - Regex: '.*'
84
+ Priority: 2
85
+ - Regex: '^<.*'
86
+ Priority: 3
87
+ IncludeIsMainRegex: '([-_](test|unittest))?$'
88
+ ...
xad-2.1.0/.flake8 ADDED
@@ -0,0 +1,3 @@
1
+ [flake8]
2
+ max-line-length = 100
3
+ extend-ignore = E203
xad-2.1.0/.gitignore ADDED
@@ -0,0 +1,62 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # build products
55
+ /xad/_xad/
56
+ _xad*.so
57
+ _xad*.pyd
58
+ /build
59
+ *.egg-info
60
+ wheelhouse
61
+ /.mypy_cache/
62
+ /.venv/
xad-2.1.0/.gitmodules ADDED
@@ -0,0 +1,6 @@
1
+ [submodule "src/xad"]
2
+ path = src/xad
3
+ url = https://github.com/auto-differentiation/xad.git
4
+ [submodule "src/pybind11"]
5
+ path = src/pybind11
6
+ url = https://github.com/pybind/pybind11.git
@@ -0,0 +1,58 @@
1
+ # To use:
2
+ #
3
+ # pre-commit run -a
4
+ #
5
+ # Or:
6
+ #
7
+ # pre-commit install # (runs every time you commit in git)
8
+ #
9
+ # To update this file:
10
+ #
11
+ # pre-commit autoupdate
12
+ #
13
+ # See https://github.com/pre-commit/pre-commit
14
+
15
+ ci:
16
+ autoupdate_commit_msg: "chore: update pre-commit hooks"
17
+ autofix_commit_msg: "style: pre-commit fixes"
18
+
19
+ repos:
20
+ # Standard hooks
21
+ - repo: https://github.com/pre-commit/pre-commit-hooks
22
+ rev: v4.5.0
23
+ hooks:
24
+ - id: check-added-large-files
25
+ - id: check-case-conflict
26
+ - id: check-merge-conflict
27
+ - id: check-symlinks
28
+ - id: check-yaml
29
+ exclude: ^conda\.recipe/meta\.yaml$
30
+ - id: debug-statements
31
+ - id: end-of-file-fixer
32
+ - id: mixed-line-ending
33
+ - id: requirements-txt-fixer
34
+ - id: trailing-whitespace
35
+
36
+
37
+ # Checking static types
38
+ # - repo: https://github.com/pre-commit/mirrors-mypy
39
+ # rev: "v1.9.0"
40
+ # hooks:
41
+ # - id: mypy
42
+
43
+ # Changes tabs to spaces
44
+ - repo: https://github.com/Lucas-C/pre-commit-hooks
45
+ rev: v1.5.5
46
+ hooks:
47
+ - id: remove-tabs
48
+
49
+ # CMake formatting
50
+ - repo: https://github.com/cheshirekow/cmake-format-precommit
51
+ rev: v0.6.13
52
+ hooks:
53
+ - id: cmake-format
54
+
55
+ - repo: https://github.com/pre-commit/mirrors-clang-format
56
+ rev: v18.1.2
57
+ hooks:
58
+ - id: clang-format
xad-2.1.0/CHANGELOG.md ADDED
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ All notable changes to XAD's Python bindings will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+ The package version follows the [XAD](https://github.com/auto-differentiation/xad)
8
+ C++ core it is built on.
9
+
10
+
11
+ ## [2.1.0] - 2026-10-24
12
+
13
+ ### Added
14
+
15
+ - `float(x)` for `Real` (`__float__`).
16
+ - Wheels for Linux aarch64 and macOS arm64.
17
+ - Type stubs and `py.typed` marker in the package.
18
+
19
+ ### Changed
20
+
21
+ - Built on XAD 2.1.0 and pybind11 3.1.
22
+ - Python 3.10 to 3.14 supported; 3.8 and 3.9 dropped.
23
+ - Build switched to scikit-build-core; CI modernised (current runners, cibuildwheel 4,
24
+ lint and test workflow).
25
+
26
+ ### Fixed
27
+
28
+ - Pickling `Real` works with all protocols (0/1 crashed, 2+ lost the value).
29
+ An unpickled adjoint `Real` is passive (not on a tape).
30
+
31
+ ## [1.5.2] - 2024-04-04
32
+
33
+ Version aligned with XAD 1.5.2 (bindings moved to their own repository).
34
+
35
+ - Thread-local tape disabled in the Python builds.
36
+
37
+ ## [1.5.1.1] - 2024-03-29
38
+
39
+ Minor fixes to allow linking against QuantLib-Risks without duplicate symbols.
40
+
41
+ ## [1.5.1] - 2024-03-28
42
+
43
+ Initial release of Python bindings for XAD.
44
+
45
+
46
+ [2.1.0]: https://github.com/auto-differentiation/xad-py/compare/v1.5.2...v2.1.0
47
+ [1.5.2]: https://github.com/auto-differentiation/xad-py/compare/v1.5.1.1...v1.5.2
48
+ [1.5.1.1]: https://github.com/auto-differentiation/xad-py/compare/v1.5.1...v1.5.1.1
49
+ [1.5.1]: https://github.com/auto-differentiation/xad-py/releases/tag/v1.5.1
@@ -0,0 +1,36 @@
1
+ # ##############################################################################
2
+ #
3
+ # Python bindings for XAD - CMake file called by scikit-build-core.
4
+ #
5
+ # This file is part of XAD's Python bindings, a comprehensive library for
6
+ # automatic differentiation.
7
+ #
8
+ # Copyright (C) 2010-2026 Xcelerit Computing Ltd.
9
+ #
10
+ # This program is free software: you can redistribute it and/or modify it under
11
+ # the terms of the GNU Affero General Public License as published by the Free
12
+ # Software Foundation, either version 3 of the License, or (at your option) any
13
+ # later version.
14
+ #
15
+ # This program is distributed in the hope that it will be useful, but WITHOUT
16
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
+ # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18
+ # details.
19
+ #
20
+ # You should have received a copy of the GNU Affero General Public License along
21
+ # with this program. If not, see <http://www.gnu.org/licenses/>.
22
+ #
23
+ # ##############################################################################
24
+
25
+ cmake_minimum_required(VERSION 3.18)
26
+ cmake_policy(SET CMP0092 NEW) # don't set warning flags by default in Windows
27
+
28
+ project(
29
+ xad-py
30
+ LANGUAGES CXX
31
+ DESCRIPTION "Python bindings for the XAD automatic differentiation library"
32
+ HOMEPAGE_URL "https://auto-differentiation.github.io")
33
+
34
+ set(CMAKE_CXX_STANDARD 17)
35
+
36
+ add_subdirectory(src)
@@ -0,0 +1,144 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+
22
+ - Being respectful of differing opinions, viewpoints, and experiences
23
+
24
+ - Giving and gracefully accepting constructive feedback
25
+
26
+ - Accepting responsibility and apologizing to those affected by our mistakes,
27
+ and learning from the experience
28
+
29
+ - Focusing on what is best not just for us as individuals, but for the overall
30
+ community
31
+
32
+ Examples of unacceptable behavior include:
33
+
34
+ - The use of sexualized language or imagery, and sexual attention or advances of
35
+ any kind
36
+
37
+ - Trolling, insulting or derogatory comments, and personal or political attacks
38
+
39
+ - Public or private harassment
40
+
41
+ - Publishing others' private information, such as a physical or email address,
42
+ without their explicit permission
43
+
44
+ - Other conduct which could reasonably be considered inappropriate in a
45
+ professional setting
46
+
47
+ ## Enforcement Responsibilities
48
+
49
+ Community leaders are responsible for clarifying and enforcing our standards of
50
+ acceptable behavior and will take appropriate and fair corrective action in
51
+ response to any behavior that they deem inappropriate, threatening, offensive,
52
+ or harmful.
53
+
54
+ Community leaders have the right and responsibility to remove, edit, or reject
55
+ comments, commits, code, wiki edits, issues, and other contributions that are
56
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
57
+ decisions when appropriate.
58
+
59
+ ## Scope
60
+
61
+ This Code of Conduct applies within all community spaces, and also applies when
62
+ an individual is officially representing the community in public spaces.
63
+ Examples of representing our community include using an official e-mail address,
64
+ posting via an official social media account, or acting as an appointed
65
+ representative at an online or offline event.
66
+
67
+ ## Enforcement
68
+
69
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
70
+ reported to the community leaders responsible for enforcement at
71
+ xad@auto-differentiation.com
72
+ All complaints will be reviewed and investigated promptly and fairly.
73
+
74
+ All community leaders are obligated to respect the privacy and security of the
75
+ reporter of any incident.
76
+
77
+ ## Enforcement Guidelines
78
+
79
+ Community leaders will follow these Community Impact Guidelines in determining
80
+ the consequences for any action they deem in violation of this Code of Conduct:
81
+
82
+ ### 1. Correction
83
+
84
+ **Community Impact**: Use of inappropriate language or other behavior deemed
85
+ unprofessional or unwelcome in the community.
86
+
87
+ **Consequence**: A private, written warning from community leaders, providing
88
+ clarity around the nature of the violation and an explanation of why the
89
+ behavior was inappropriate. A public apology may be requested.
90
+
91
+ ### 2. Warning
92
+
93
+ **Community Impact**: A violation through a single incident or series of
94
+ actions.
95
+
96
+ **Consequence**: A warning with consequences for continued behavior. No
97
+ interaction with the people involved, including unsolicited interaction with
98
+ those enforcing the Code of Conduct, for a specified period of time. This
99
+ includes avoiding interactions in community spaces as well as external channels
100
+ like social media. Violating these terms may lead to a temporary or permanent
101
+ ban.
102
+
103
+ ### 3. Temporary Ban
104
+
105
+ **Community Impact**: A serious violation of community standards, including
106
+ sustained inappropriate behavior.
107
+
108
+ **Consequence**: A temporary ban from any sort of interaction or public
109
+ communication with the community for a specified period of time. No public or
110
+ private interaction with the people involved, including unsolicited interaction
111
+ with those enforcing the Code of Conduct, is allowed during this period.
112
+ Violating these terms may lead to a permanent ban.
113
+
114
+ ### 4. Permanent Ban
115
+
116
+ **Community Impact**: Demonstrating a pattern of violation of community
117
+ standards, including sustained inappropriate behavior, harassment of an
118
+ individual, or aggression toward or disparagement of classes of individuals.
119
+
120
+ **Consequence**: A permanent ban from any sort of public interaction within the
121
+ community.
122
+
123
+ ## Attribution
124
+
125
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
126
+ version 2.1, available at
127
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
128
+
129
+ Community Impact Guidelines were inspired by
130
+ [Mozilla's code of conduct enforcement ladder][mozillacoc].
131
+
132
+ For answers to common questions about this code of conduct, see the FAQ at
133
+ [https://www.contributor-covenant.org/faq][faq]. Translations are available at
134
+ [https://www.contributor-covenant.org/translations][translations].
135
+
136
+ [homepage]: https://www.contributor-covenant.org
137
+
138
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
139
+
140
+ [mozillacoc]: https://github.com/mozilla/diversity
141
+
142
+ [faq]: https://www.contributor-covenant.org/faq
143
+
144
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,149 @@
1
+ # How to contribute
2
+
3
+ We love pull requests from everyone. By participating in this project, you agree to abide
4
+ by our [code of conduct](CODE_OF_CONDUCT.md).
5
+
6
+ 1. Fork, then clone the repository:
7
+
8
+ ```bash
9
+ git clone https://github.com/yourusername/xad-py.git
10
+ ```
11
+
12
+ 2. Follow the [Build Instructions](README.md) to setup the dependencies and
13
+ build the software. Make sure all tests pass.
14
+
15
+ 3. Create a feature branch, typically based on master, for your change
16
+
17
+ ```bash
18
+ git checkout -b feature/my-change main
19
+ ```
20
+
21
+ 4. Make your changes, adding tests as you go, and commit. Again, make sure all
22
+ tests pass.
23
+
24
+ 5. Push your fork
25
+
26
+ 6. [Submit a pull request][pr]. Not that you will have to sign the [Contributor License Agreement][cla]
27
+ before the PR can be merged.
28
+
29
+ At this point, you are depending on the core team to review your request.
30
+ We may suggest changes, improvements, or alternatives.
31
+ We strive to at least comment on a pull request within 3 business days.
32
+ After feedback has been given, we expect a response within 2 weeks,
33
+ after which we may close the pull request if it isn't showing activity.
34
+
35
+ Some things that will highly increase the chance that your pull request gets
36
+ accepted:
37
+
38
+ - Discuss the change you wish to make via issue or email
39
+
40
+ - Write good tests for all added features
41
+
42
+ - Follow our [coding style](#coding-style)
43
+
44
+ - Write good commit messages (short one-liner, followed by a blank line,
45
+ followed by a more detailed explanation)
46
+
47
+ ## Source Code Organisation
48
+
49
+ - [src](src): The Pybind11-based C++ sources of the Python bindings (_xad package)
50
+ - [xad](xad): Python package wrapper around the generated Pybind11 bindings.
51
+ - [samples](samples): Example usages
52
+ - [tests](tests): Unit tests
53
+
54
+
55
+ ## Building from Source
56
+
57
+ The package is built with [scikit-build-core](https://scikit-build-core.readthedocs.io/),
58
+ which drives [CMake](https://cmake.org/) to build the [Pybind11](https://pybind11.readthedocs.io/en/stable/)
59
+ wrappers for XAD. XAD and Pybind11 are git submodules, so clone recursively
60
+ (or run `git submodule update --init --recursive`).
61
+ A C++17 compiler is required; CMake and Ninja are fetched automatically if missing.
62
+
63
+ Install the package and the test dependencies into a virtual environment
64
+ (the `--group` option needs pip 25.1 or later):
65
+
66
+ ```text
67
+ pip install . --group test
68
+ ```
69
+
70
+ The tests should be run from outside the source tree, so that the installed package
71
+ (which contains the compiled extension) is used rather than the `xad` source folder:
72
+
73
+ ```text
74
+ cd /tmp && python -m pytest /path/to/xad-py/tests
75
+ ```
76
+
77
+ The linters used in CI are in the `lint` dependency group (`dev` contains everything).
78
+ mypy reads the extension's type stubs from the installed package:
79
+
80
+ ```text
81
+ pip install . --group lint
82
+ black --check xad
83
+ flake8 xad
84
+ mypy xad
85
+ ```
86
+
87
+ A wheel and a source distribution can be built with `python -m build` (or `uv build`).
88
+ Release wheels are built with [cibuildwheel](https://cibuildwheel.pypa.io/),
89
+ configured in `[tool.cibuildwheel]` in `pyproject.toml`.
90
+
91
+ ## Coding Style
92
+
93
+ The following is for the C++ part of this code-base - the Python code follows standard
94
+ Python best practices.
95
+ For convenience, there is a `.clang-format` file in the root of the project which you can (and should) use.
96
+
97
+ - **Use Common Sense** - Deviations from these guidelines are explicitly allowed, if they make
98
+ sense in the context of their use.
99
+
100
+ - General
101
+ - Insert a copyright / license note, including short paragraph of the file's
102
+ purpose, into every source file (look at existing ones for an example)
103
+
104
+ - Use a maximum of 100 characters per source line
105
+
106
+ - Naming
107
+ - Names representing types must be mixed case, starting with upper case `CheckpointCallback`
108
+ - Variables must be mixed case, starting with lower case `currentRecording`
109
+ - Named constants must be all upper case, separated by underscores `DEFAULT_LENGTH`
110
+ - Method and function names must be mixed case, starting with lower case, and must be verbs `pushLhs`
111
+ - Namespace names must be all lower case `xad`
112
+ - Template parameters should be single character capitals, or named like types `T`, `Scalar`
113
+ - Private class members should have an underscore suffix `length_`
114
+ - All names should be written in English
115
+ - The name of the object should be avoided in the method name `Line::getLength()`, _not_ `Line::getLineLength()`
116
+
117
+ - Includes
118
+ - Use `#pragma once` instead of include guards
119
+
120
+ - Group includes by libraries, starting with local includes, continuing with third party libraries,
121
+ and finishing with C++ and C standard libraries
122
+
123
+ - Use `<>` to include globally valid files (including public includes of the current project)
124
+
125
+ - Use `""` to include files relative to the current directory
126
+
127
+ - Includes should only exist on top of the files
128
+
129
+ - Comments
130
+ - Use `//` for comments, and `/*` for disabling large sections of code for debugging
131
+
132
+ - Avoid too many comments within the body of functions - code should be
133
+ self-explanatory
134
+
135
+ - Do comment the functions / methods if their use is not obvious
136
+
137
+ - Use `TODO` inside a comment to flag tasks to attend to in near future
138
+
139
+ - Indents, Spacing, Line breaks
140
+ - Use 4 space to introduce a new scope
141
+ - Never use tabs
142
+ - Don't indent namespace scopes
143
+ - Break before the curly brace in a function definition
144
+ - Line breaks before curly braces in other contexts are optional
145
+ - Short loops or functions can be defined in one line
146
+
147
+ [pr]: https://github.com/auto-differentiation/xad-py/compare/
148
+
149
+ [cla]: https://gist.github.com/auto-differentiation-dev/4a5c0cf1fbfed7be64308d1c2f47bd25