Sleipnir C++ API
Loading...
Searching...
No Matches
Hessian.hpp
Go to the documentation of this file.
1// Copyright (c) Sleipnir contributors
2
3#pragma once
4
5#include <Eigen/Core>
6#include <Eigen/SparseCore>
7
14
15namespace sleipnir {
16
25 public:
33 Hessian(Variable variable, const VariableMatrix& wrt) noexcept
34 : m_jacobian{
35 [&] {
36 m_profiler.StartSetup();
38 wrt);
39 }(),
40 wrt} {
41 m_profiler.StopSetup();
42 }
43
50 VariableMatrix Get() const { return m_jacobian.Get(); }
51
55 const Eigen::SparseMatrix<double>& Value() {
56 m_profiler.StartSolve();
57 const auto& H = m_jacobian.Value();
58 m_profiler.StopSolve();
59 return H;
60 }
61
65 Profiler& GetProfiler() { return m_profiler; }
66
67 private:
68 Profiler m_profiler;
69 Jacobian m_jacobian;
70};
71
72} // namespace sleipnir
#define SLEIPNIR_DLLEXPORT
Definition SymbolExports.hpp:34
Definition Hessian.hpp:24
Profiler & GetProfiler()
Definition Hessian.hpp:65
Hessian(Variable variable, const VariableMatrix &wrt) noexcept
Definition Hessian.hpp:33
VariableMatrix Get() const
Definition Hessian.hpp:50
const Eigen::SparseMatrix< double > & Value()
Definition Hessian.hpp:55
Definition Jacobian.hpp:25
Definition Profiler.hpp:13
Definition VariableMatrix.hpp:28
Definition Variable.hpp:33
Definition ExpressionGraph.hpp:19
VariableMatrix GenerateGradientTree(const VariableMatrix &wrt) const
Definition ExpressionGraph.hpp:121
Definition Expression.hpp:18