sleipnirgroup-jormungandr 0.6.7.dev127__tar.gz → 0.6.7.dev129__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.
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/PKG-INFO +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/variable_matrix.hpp +59 -55
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/autodiff/bind_variable.cpp +141 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/docstrings.hpp +39 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/src/sleipnir/__init__.py +1 -1
- sleipnirgroup_jormungandr-0.6.7.dev129/python/test/autodiff/variable_test.py +85 -0
- sleipnirgroup_jormungandr-0.6.7.dev127/python/test/autodiff/variable_test.py +0 -31
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/CMakeLists.txt +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/LICENSE.txt +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/README.md +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/SleipnirConfig.cmake.in +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/cmake/BuildTypes.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/cmake/CompilerFlags.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/cmake/Pybind11Mkdoc.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/cmake/Pybind11MkdocPostprocess.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/cmake/SubdirList.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/cmake/aarch64-linux-gnu.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/cmake/arm-none-eabi.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/expression.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/expression_functions.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/expression_graph.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/expression_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/gradient.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/hessian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/jacobian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/sleipnir_base.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/slice.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/variable.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/autodiff/variable_block.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/multistart.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/ocp/dynamics_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/ocp/timestep_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/ocp/transcription_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/ocp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/problem.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/exit_status.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/ipm.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/ipm_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/iteration_info.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/newton.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/newton_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/options.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/sqp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/sqp_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/all_finite.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/append_as_triplets.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/bounds.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/constraint_violation.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/dense_kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/feasibility_restoration.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/feasibility_restoration_cycle_detector.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/filter.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/fraction_to_the_boundary_rule.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/inertia.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/kkt_error.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/kkt_ordering.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/problem_scaling.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/regularization_limits.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/sparse_inf_norms.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/sparse_kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/optimization/solver/util/time_trace.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/assert.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/concepts.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/empty.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/force_inline.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/function_ref.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/intrusive_shared_ptr.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/pool.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/print.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/print_diagnostics.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/scope_exit.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/spy.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/symbol_exports.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/include/sleipnir/util/time_tracer.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/pyproject.toml +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/arity.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/autodiff/bind_expression_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/autodiff/bind_gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/autodiff/bind_hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/autodiff/bind_jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/autodiff/bind_variable_block.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/autodiff/bind_variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/binders.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/for_each_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/main.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/bind_equality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/bind_inequality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/bind_ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/bind_problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/ocp/bind_dynamics_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/ocp/bind_timestep_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/ocp/bind_transcription_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/solver/bind_exit_status.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/optimization/solver/bind_iteration_info.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/slice_tuple.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/text_wrap.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/cpp/try_cast.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/postprocess_stubs.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/src/sleipnir/autodiff/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/src/sleipnir/optimization/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/autodiff/gradient_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/autodiff/hessian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/autodiff/jacobian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/autodiff/variable_matrix_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/arm_on_elevator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/cart_pole_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/cart_pole_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/cart_pole_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/constraints_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/decision_variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/differential_drive_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/differential_drive_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/differential_drive_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/double_integrator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/flywheel_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/flywheel_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/flywheel_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/linear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/multistart_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/nonlinear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/problem_spy_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/quadratic_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/rk4.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/solver/exit_status_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/tolerance.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/python/test/optimization/trivial_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/autodiff/gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/autodiff/hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/autodiff/jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/autodiff/variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/optimization/ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/optimization/problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/optimization/solver/ipm.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/optimization/solver/newton.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/optimization/solver/sqp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/util/pool.cpp +0 -0
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#include <initializer_list>
|
|
10
10
|
#include <iterator>
|
|
11
11
|
#include <span>
|
|
12
|
+
#include <type_traits>
|
|
12
13
|
#include <utility>
|
|
13
14
|
#include <vector>
|
|
14
15
|
|
|
@@ -566,24 +567,6 @@ class VariableMatrix : public SleipnirBase {
|
|
|
566
567
|
return result;
|
|
567
568
|
}
|
|
568
569
|
|
|
569
|
-
/// Matrix-scalar multiplication operator.
|
|
570
|
-
///
|
|
571
|
-
/// @param lhs Operator left-hand side.
|
|
572
|
-
/// @param rhs Operator right-hand side.
|
|
573
|
-
template <EigenMatrixLike LHS>
|
|
574
|
-
friend VariableMatrix<Scalar> operator*(const LHS& lhs,
|
|
575
|
-
const Variable<Scalar>& rhs) {
|
|
576
|
-
VariableMatrix<Scalar> result(detail::empty, lhs.rows(), lhs.cols());
|
|
577
|
-
|
|
578
|
-
for (int row = 0; row < result.rows(); ++row) {
|
|
579
|
-
for (int col = 0; col < result.cols(); ++col) {
|
|
580
|
-
result[row, col] = lhs[row, col] * rhs;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
return result;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
570
|
/// Matrix-scalar multiplication operator.
|
|
588
571
|
///
|
|
589
572
|
/// @param lhs Operator left-hand side.
|
|
@@ -601,24 +584,6 @@ class VariableMatrix : public SleipnirBase {
|
|
|
601
584
|
return result;
|
|
602
585
|
}
|
|
603
586
|
|
|
604
|
-
/// Scalar-matrix multiplication operator.
|
|
605
|
-
///
|
|
606
|
-
/// @param lhs Operator left-hand side.
|
|
607
|
-
/// @param rhs Operator right-hand side.
|
|
608
|
-
template <EigenMatrixLike RHS>
|
|
609
|
-
friend VariableMatrix<Scalar> operator*(const Variable<Scalar>& lhs,
|
|
610
|
-
const RHS& rhs) {
|
|
611
|
-
VariableMatrix<Scalar> result(detail::empty, rhs.rows(), rhs.cols());
|
|
612
|
-
|
|
613
|
-
for (int row = 0; row < result.rows(); ++row) {
|
|
614
|
-
for (int col = 0; col < result.cols(); ++col) {
|
|
615
|
-
result[row, col] = rhs[row, col] * lhs;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
return result;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
587
|
/// Scalar-matrix multiplication operator.
|
|
623
588
|
///
|
|
624
589
|
/// @param lhs Operator left-hand side.
|
|
@@ -671,25 +636,6 @@ class VariableMatrix : public SleipnirBase {
|
|
|
671
636
|
return *this;
|
|
672
637
|
}
|
|
673
638
|
|
|
674
|
-
/// Binary division operator.
|
|
675
|
-
///
|
|
676
|
-
/// @param lhs Operator left-hand side.
|
|
677
|
-
/// @param rhs Operator right-hand side.
|
|
678
|
-
/// @return Result of division.
|
|
679
|
-
template <EigenMatrixLike LHS>
|
|
680
|
-
friend VariableMatrix<Scalar> operator/(const LHS& lhs,
|
|
681
|
-
const Variable<Scalar>& rhs) {
|
|
682
|
-
VariableMatrix<Scalar> result(detail::empty, lhs.rows(), lhs.cols());
|
|
683
|
-
|
|
684
|
-
for (int row = 0; row < result.rows(); ++row) {
|
|
685
|
-
for (int col = 0; col < result.cols(); ++col) {
|
|
686
|
-
result[row, col] = lhs[row, col] / rhs;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
return result;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
639
|
/// Binary division operator.
|
|
694
640
|
///
|
|
695
641
|
/// @param lhs Operator left-hand side.
|
|
@@ -1373,6 +1319,64 @@ template <typename Derived>
|
|
|
1373
1319
|
VariableMatrix(const Eigen::DiagonalBase<Derived>&)
|
|
1374
1320
|
-> VariableMatrix<typename Derived::Scalar>;
|
|
1375
1321
|
|
|
1322
|
+
/// Matrix-scalar multiplication operator.
|
|
1323
|
+
///
|
|
1324
|
+
/// @tparam Scalar Scalar type.
|
|
1325
|
+
/// @param lhs Operator left-hand side.
|
|
1326
|
+
/// @param rhs Operator right-hand side.
|
|
1327
|
+
template <typename Scalar, EigenMatrixLike LHS>
|
|
1328
|
+
requires std::same_as<typename std::decay_t<LHS>::Scalar, Scalar>
|
|
1329
|
+
VariableMatrix<Scalar> operator*(const LHS& lhs, const Variable<Scalar>& rhs) {
|
|
1330
|
+
VariableMatrix<Scalar> result(detail::empty, lhs.rows(), lhs.cols());
|
|
1331
|
+
|
|
1332
|
+
for (int row = 0; row < result.rows(); ++row) {
|
|
1333
|
+
for (int col = 0; col < result.cols(); ++col) {
|
|
1334
|
+
result[row, col] = lhs[row, col] * rhs;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
return result;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/// Scalar-matrix multiplication operator.
|
|
1342
|
+
///
|
|
1343
|
+
/// @tparam Scalar Scalar type.
|
|
1344
|
+
/// @param lhs Operator left-hand side.
|
|
1345
|
+
/// @param rhs Operator right-hand side.
|
|
1346
|
+
template <typename Scalar, EigenMatrixLike RHS>
|
|
1347
|
+
requires std::same_as<typename std::decay_t<RHS>::Scalar, Scalar>
|
|
1348
|
+
VariableMatrix<Scalar> operator*(const Variable<Scalar>& lhs, const RHS& rhs) {
|
|
1349
|
+
VariableMatrix<Scalar> result(detail::empty, rhs.rows(), rhs.cols());
|
|
1350
|
+
|
|
1351
|
+
for (int row = 0; row < result.rows(); ++row) {
|
|
1352
|
+
for (int col = 0; col < result.cols(); ++col) {
|
|
1353
|
+
result[row, col] = rhs[row, col] * lhs;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
return result;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
/// Binary division operator.
|
|
1361
|
+
///
|
|
1362
|
+
/// @tparam Scalar Scalar type.
|
|
1363
|
+
/// @param lhs Operator left-hand side.
|
|
1364
|
+
/// @param rhs Operator right-hand side.
|
|
1365
|
+
/// @return Result of division.
|
|
1366
|
+
template <typename Scalar, EigenMatrixLike LHS>
|
|
1367
|
+
requires std::same_as<typename std::decay_t<LHS>::Scalar, Scalar>
|
|
1368
|
+
VariableMatrix<Scalar> operator/(const LHS& lhs, const Variable<Scalar>& rhs) {
|
|
1369
|
+
VariableMatrix<Scalar> result(detail::empty, lhs.rows(), lhs.cols());
|
|
1370
|
+
|
|
1371
|
+
for (int row = 0; row < result.rows(); ++row) {
|
|
1372
|
+
for (int col = 0; col < result.cols(); ++col) {
|
|
1373
|
+
result[row, col] = lhs[row, col] / rhs;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
return result;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1376
1380
|
/// Applies a coefficient-wise reduce operation to two matrices.
|
|
1377
1381
|
///
|
|
1378
1382
|
/// @tparam Scalar Scalar type.
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
#include <nanobind/eigen/dense.h>
|
|
4
4
|
#include <nanobind/nanobind.h>
|
|
5
5
|
#include <nanobind/operators.h>
|
|
6
|
+
#include <nanobind/stl/string.h>
|
|
6
7
|
|
|
8
|
+
#include <algorithm>
|
|
9
|
+
#include <array>
|
|
7
10
|
#include <concepts>
|
|
11
|
+
#include <string>
|
|
8
12
|
#include <utility>
|
|
9
13
|
|
|
10
14
|
#include <sleipnir/autodiff/variable.hpp>
|
|
@@ -13,6 +17,7 @@
|
|
|
13
17
|
|
|
14
18
|
#include "docstrings.hpp"
|
|
15
19
|
#include "for_each_type.hpp"
|
|
20
|
+
#include "try_cast.hpp"
|
|
16
21
|
|
|
17
22
|
namespace nb = nanobind;
|
|
18
23
|
|
|
@@ -116,6 +121,142 @@ void bind_variable(nb::module_& autodiff, nb::class_<Variable<double>>& cls) {
|
|
|
116
121
|
}
|
|
117
122
|
});
|
|
118
123
|
|
|
124
|
+
// Scalar-matrix multiplication and division with NumPy arrays. These are also
|
|
125
|
+
// handled by __array_ufunc__ below, but type checkers only see these
|
|
126
|
+
// overloads.
|
|
127
|
+
cls.def(
|
|
128
|
+
"__mul__",
|
|
129
|
+
[](const Variable<double>& lhs, nb::DRef<Eigen::MatrixXd> rhs) {
|
|
130
|
+
return lhs * rhs;
|
|
131
|
+
},
|
|
132
|
+
nb::is_operator(), "rhs"_a);
|
|
133
|
+
cls.def(
|
|
134
|
+
"__imul__",
|
|
135
|
+
[](const Variable<double>& lhs, nb::DRef<Eigen::MatrixXd> rhs) {
|
|
136
|
+
return lhs * rhs;
|
|
137
|
+
},
|
|
138
|
+
nb::is_operator(), "rhs"_a);
|
|
139
|
+
cls.def(
|
|
140
|
+
"__rmul__",
|
|
141
|
+
[](const Variable<double>& rhs, nb::DRef<Eigen::MatrixXd> lhs) {
|
|
142
|
+
return lhs * rhs;
|
|
143
|
+
},
|
|
144
|
+
nb::is_operator(), "lhs"_a);
|
|
145
|
+
cls.def(
|
|
146
|
+
"__rtruediv__",
|
|
147
|
+
[](const Variable<double>& rhs, nb::DRef<Eigen::MatrixXd> lhs) {
|
|
148
|
+
return lhs / rhs;
|
|
149
|
+
},
|
|
150
|
+
nb::is_operator(), "lhs"_a);
|
|
151
|
+
|
|
152
|
+
// Map NumPy ufunc reprs to the equivalent function names in Python's
|
|
153
|
+
// operator module
|
|
154
|
+
static constexpr std::array scalar_operators{
|
|
155
|
+
std::pair{"<ufunc 'add'>", "add"},
|
|
156
|
+
std::pair{"<ufunc 'subtract'>", "sub"},
|
|
157
|
+
std::pair{"<ufunc 'multiply'>", "mul"},
|
|
158
|
+
std::pair{"<ufunc 'divide'>", "truediv"},
|
|
159
|
+
std::pair{"<ufunc 'equal'>", "eq"},
|
|
160
|
+
std::pair{"<ufunc 'less'>", "lt"},
|
|
161
|
+
std::pair{"<ufunc 'less_equal'>", "le"},
|
|
162
|
+
std::pair{"<ufunc 'greater'>", "gt"},
|
|
163
|
+
std::pair{"<ufunc 'greater_equal'>", "ge"}};
|
|
164
|
+
|
|
165
|
+
// https://numpy.org/doc/stable/user/basics.dispatch.html
|
|
166
|
+
cls.def(
|
|
167
|
+
"__array_ufunc__",
|
|
168
|
+
[](Variable<double>& self, nb::object ufunc, nb::str method,
|
|
169
|
+
nb::args inputs, const nb::kwargs&) -> nb::object {
|
|
170
|
+
std::string method_name = nb::cast<std::string>(method);
|
|
171
|
+
std::string ufunc_name =
|
|
172
|
+
nb::cast<std::string>(ufunc.attr("__repr__")());
|
|
173
|
+
|
|
174
|
+
// VariableMatrix only represents 2D arrays
|
|
175
|
+
auto is_2d_array = [](const nb::handle& obj) {
|
|
176
|
+
return nb::isinstance<nb::ndarray<>>(obj) &&
|
|
177
|
+
nb::cast<nb::ndarray<>>(obj).ndim() == 2;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
if (method_name == "__call__" && inputs.size() == 2) {
|
|
181
|
+
if (auto op = std::ranges::find(
|
|
182
|
+
scalar_operators, ufunc_name,
|
|
183
|
+
[](const auto& pair) { return pair.first; });
|
|
184
|
+
op != scalar_operators.end()) {
|
|
185
|
+
auto np = nb::module_::import_("numpy");
|
|
186
|
+
|
|
187
|
+
auto is_0d = [&](const nb::handle& obj) {
|
|
188
|
+
// np.ndim() returns 0 for any non-array object
|
|
189
|
+
return !nb::isinstance<Variable<double>>(obj) &&
|
|
190
|
+
nb::cast<int>(np.attr("ndim")(obj)) == 0;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// Convert NumPy scalars and 0D arrays to the equivalent Python
|
|
194
|
+
// scalar (e.g., np.float64 to float) and return other objects
|
|
195
|
+
// unchanged
|
|
196
|
+
auto numpy_to_python_scalar =
|
|
197
|
+
[&](const nb::handle& obj) -> nb::object {
|
|
198
|
+
nb::object numpy_types =
|
|
199
|
+
nb::make_tuple(np.attr("generic"), np.attr("ndarray"));
|
|
200
|
+
if (PyObject_IsInstance(obj.ptr(), numpy_types.ptr()) == 1) {
|
|
201
|
+
return obj.attr("item")();
|
|
202
|
+
} else {
|
|
203
|
+
return nb::borrow(obj);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// If an operand is 0D, apply the Python operator to its Python
|
|
208
|
+
// scalar and the other operand, which dispatches to Variable's
|
|
209
|
+
// scalar overloads
|
|
210
|
+
if (is_0d(inputs[0])) {
|
|
211
|
+
return nb::module_::import_("operator")
|
|
212
|
+
.attr(op->second)(numpy_to_python_scalar(inputs[0]),
|
|
213
|
+
inputs[1]);
|
|
214
|
+
} else if (is_0d(inputs[1])) {
|
|
215
|
+
return nb::module_::import_("operator")
|
|
216
|
+
.attr(op->second)(inputs[0],
|
|
217
|
+
numpy_to_python_scalar(inputs[1]));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (ufunc_name == "<ufunc 'multiply'>") {
|
|
222
|
+
if (is_2d_array(inputs[0])) {
|
|
223
|
+
if (auto result = apply_eigen_op(
|
|
224
|
+
[&](auto& lhs) {
|
|
225
|
+
return lhs.template cast<double>() * self;
|
|
226
|
+
},
|
|
227
|
+
inputs[0])) {
|
|
228
|
+
return result.value();
|
|
229
|
+
}
|
|
230
|
+
} else if (is_2d_array(inputs[1])) {
|
|
231
|
+
if (auto result = apply_eigen_op(
|
|
232
|
+
[&](auto& rhs) {
|
|
233
|
+
return self * rhs.template cast<double>();
|
|
234
|
+
},
|
|
235
|
+
inputs[1])) {
|
|
236
|
+
return result.value();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
} else if (ufunc_name == "<ufunc 'divide'>") {
|
|
240
|
+
if (is_2d_array(inputs[0])) {
|
|
241
|
+
if (auto result = apply_eigen_op(
|
|
242
|
+
[&](auto& lhs) {
|
|
243
|
+
return lhs.template cast<double>() / self;
|
|
244
|
+
},
|
|
245
|
+
inputs[0])) {
|
|
246
|
+
return result.value();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return nb::not_implemented();
|
|
253
|
+
},
|
|
254
|
+
// nanobind can't annotate nb::args or nb::kwargs, so the stub needs an
|
|
255
|
+
// explicit signature
|
|
256
|
+
nb::sig("def __array_ufunc__(self, ufunc: object, method: str, "
|
|
257
|
+
"*inputs: object, **kwargs: object) -> object"),
|
|
258
|
+
"ufunc"_a, "method"_a, "inputs"_a, "kwargs"_a);
|
|
259
|
+
|
|
119
260
|
cls.def(
|
|
120
261
|
"__pow__",
|
|
121
262
|
[](const Variable<double>& self, int power) { return pow(self, power); },
|
|
@@ -2959,6 +2959,21 @@ Template Args:
|
|
|
2959
2959
|
|
|
2960
2960
|
)doc";
|
|
2961
2961
|
|
|
2962
|
+
constexpr char mkd_doc_slp_operator_div[] =
|
|
2963
|
+
R"doc(Binary division operator.
|
|
2964
|
+
|
|
2965
|
+
Args:
|
|
2966
|
+
lhs: Operator left-hand side.
|
|
2967
|
+
rhs: Operator right-hand side.
|
|
2968
|
+
|
|
2969
|
+
Template Args:
|
|
2970
|
+
Scalar: Scalar type.
|
|
2971
|
+
|
|
2972
|
+
Returns:
|
|
2973
|
+
Result of division.
|
|
2974
|
+
|
|
2975
|
+
)doc";
|
|
2976
|
+
|
|
2962
2977
|
constexpr char mkd_doc_slp_operator_eq[] =
|
|
2963
2978
|
R"doc(Equality operator that returns an equality constraint for two
|
|
2964
2979
|
Variables.
|
|
@@ -3049,6 +3064,30 @@ Args:
|
|
|
3049
3064
|
|
|
3050
3065
|
)doc";
|
|
3051
3066
|
|
|
3067
|
+
constexpr char mkd_doc_slp_operator_mul[] =
|
|
3068
|
+
R"doc(Matrix-scalar multiplication operator.
|
|
3069
|
+
|
|
3070
|
+
Args:
|
|
3071
|
+
lhs: Operator left-hand side.
|
|
3072
|
+
rhs: Operator right-hand side.
|
|
3073
|
+
|
|
3074
|
+
Template Args:
|
|
3075
|
+
Scalar: Scalar type.
|
|
3076
|
+
|
|
3077
|
+
)doc";
|
|
3078
|
+
|
|
3079
|
+
constexpr char mkd_doc_slp_operator_mul_2[] =
|
|
3080
|
+
R"doc(Scalar-matrix multiplication operator.
|
|
3081
|
+
|
|
3082
|
+
Args:
|
|
3083
|
+
lhs: Operator left-hand side.
|
|
3084
|
+
rhs: Operator right-hand side.
|
|
3085
|
+
|
|
3086
|
+
Template Args:
|
|
3087
|
+
Scalar: Scalar type.
|
|
3088
|
+
|
|
3089
|
+
)doc";
|
|
3090
|
+
|
|
3052
3091
|
constexpr char mkd_doc_slp_pow[] =
|
|
3053
3092
|
R"doc(pow() for Variables.
|
|
3054
3093
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pytest
|
|
3
|
+
from sleipnir.autodiff import ExpressionType, Variable, VariableMatrix
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_default_constructor() -> None:
|
|
7
|
+
a = Variable()
|
|
8
|
+
assert a.value() == 0.0
|
|
9
|
+
assert a.type() == ExpressionType.LINEAR
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_constant_constructor() -> None:
|
|
13
|
+
# float
|
|
14
|
+
a = Variable(1.0)
|
|
15
|
+
assert a.value() == 1.0
|
|
16
|
+
assert a.type() == ExpressionType.CONSTANT
|
|
17
|
+
|
|
18
|
+
# int
|
|
19
|
+
b = Variable(2)
|
|
20
|
+
assert b.value() == 2
|
|
21
|
+
assert b.type() == ExpressionType.CONSTANT
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_set_value() -> None:
|
|
25
|
+
a = Variable()
|
|
26
|
+
|
|
27
|
+
# float
|
|
28
|
+
a.set_value(1.0)
|
|
29
|
+
assert a.value() == 1.0
|
|
30
|
+
|
|
31
|
+
# int
|
|
32
|
+
a.set_value(2)
|
|
33
|
+
assert a.value() == 2
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_numpy_array_operators() -> None:
|
|
37
|
+
x = Variable(2.0)
|
|
38
|
+
A = np.array([[1.0, 2.0], [3.0, 4.0]])
|
|
39
|
+
|
|
40
|
+
# float arrays
|
|
41
|
+
for result, expected in [
|
|
42
|
+
(x * A, [[2.0, 4.0], [6.0, 8.0]]),
|
|
43
|
+
(A * x, [[2.0, 4.0], [6.0, 8.0]]),
|
|
44
|
+
(A / x, [[0.5, 1.0], [1.5, 2.0]]),
|
|
45
|
+
]:
|
|
46
|
+
assert isinstance(result, VariableMatrix)
|
|
47
|
+
assert np.array_equal(result.value(), expected)
|
|
48
|
+
|
|
49
|
+
# int arrays
|
|
50
|
+
B = np.array([[1, 2], [3, 4]])
|
|
51
|
+
for result, expected in [
|
|
52
|
+
(x * B, [[2.0, 4.0], [6.0, 8.0]]),
|
|
53
|
+
(B * x, [[2.0, 4.0], [6.0, 8.0]]),
|
|
54
|
+
(B / x, [[0.5, 1.0], [1.5, 2.0]]),
|
|
55
|
+
]:
|
|
56
|
+
assert isinstance(result, VariableMatrix)
|
|
57
|
+
assert np.array_equal(result.value(), expected)
|
|
58
|
+
|
|
59
|
+
# NumPy scalars
|
|
60
|
+
a = np.float64(3.0)
|
|
61
|
+
for result, expected in [
|
|
62
|
+
(a + x, 5.0),
|
|
63
|
+
(x + a, 5.0),
|
|
64
|
+
(a - x, 1.0),
|
|
65
|
+
(x - a, -1.0),
|
|
66
|
+
(a * x, 6.0),
|
|
67
|
+
(x * a, 6.0),
|
|
68
|
+
(a / x, 1.5),
|
|
69
|
+
(x / a, 2.0 / 3.0),
|
|
70
|
+
]:
|
|
71
|
+
assert isinstance(result, Variable)
|
|
72
|
+
assert result.value() == pytest.approx(expected)
|
|
73
|
+
# mypy rejects this because NumPy's stubs don't let np.integer defer to
|
|
74
|
+
# Variable.__rmul__, but at runtime NumPy calls Variable.__array_ufunc__
|
|
75
|
+
assert isinstance(np.int64(3) * x, Variable) # type: ignore[operator]
|
|
76
|
+
assert isinstance(a <= x, type(Variable() <= 0.0))
|
|
77
|
+
assert isinstance(x <= a, type(Variable() <= 0.0))
|
|
78
|
+
|
|
79
|
+
# Other operations with NumPy arrays raise TypeError
|
|
80
|
+
with pytest.raises(TypeError):
|
|
81
|
+
_ = A + x
|
|
82
|
+
with pytest.raises(TypeError):
|
|
83
|
+
_ = A <= x
|
|
84
|
+
with pytest.raises(TypeError):
|
|
85
|
+
_ = np.array([1.0, 2.0]) * x
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
from sleipnir.autodiff import ExpressionType, Variable
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_default_constructor() -> None:
|
|
5
|
-
a = Variable()
|
|
6
|
-
assert a.value() == 0.0
|
|
7
|
-
assert a.type() == ExpressionType.LINEAR
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def test_constant_constructor() -> None:
|
|
11
|
-
# float
|
|
12
|
-
a = Variable(1.0)
|
|
13
|
-
assert a.value() == 1.0
|
|
14
|
-
assert a.type() == ExpressionType.CONSTANT
|
|
15
|
-
|
|
16
|
-
# int
|
|
17
|
-
b = Variable(2)
|
|
18
|
-
assert b.value() == 2
|
|
19
|
-
assert b.type() == ExpressionType.CONSTANT
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def test_set_value() -> None:
|
|
23
|
-
a = Variable()
|
|
24
|
-
|
|
25
|
-
# float
|
|
26
|
-
a.set_value(1.0)
|
|
27
|
-
assert a.value() == 1.0
|
|
28
|
-
|
|
29
|
-
# int
|
|
30
|
-
a.set_value(2)
|
|
31
|
-
assert a.value() == 2
|
{sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/CMakeLists.txt
RENAMED
|
File without changes
|
{sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/LICENSE.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sleipnirgroup_jormungandr-0.6.7.dev127 → sleipnirgroup_jormungandr-0.6.7.dev129}/src/util/pool.cpp
RENAMED
|
File without changes
|