CppADCodeGen  2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
declare_extra.hpp
1 #ifndef CPPAD_CG_DECLARE_EXTRA_INCLUDED
2 #define CPPAD_CG_DECLARE_EXTRA_INCLUDED
3 /* --------------------------------------------------------------------------
4  * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5  * Copyright (C) 2013 Ciengis
6  *
7  * CppADCodeGen is distributed under multiple licenses:
8  *
9  * - Eclipse Public License Version 1.0 (EPL1), and
10  * - GNU General Public License Version 3 (GPL3).
11  *
12  * EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13  * terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14  * ----------------------------------------------------------------------------
15  * Author: Joao Leal
16  */
17 
18 #include <cppad/local/define.hpp>
19 #include <cppad/local/cppad_assert.hpp>
20 #include <cppad/local/base_cond_exp.hpp>
21 
22 // forward declarations
23 namespace CppAD {
24 namespace cg {
25 
26 /***********************************************************************
27  * Combined Jacobian and Hessian evaluation
28  **********************************************************************/
29 
30 class SparseForjacHessianWorkJac;
31 class SparseForjacHessianWorkHes;
32 class SparseForjacHessianWork;
33 
34 template<class Base, class VectorBase, class VectorSet, class VectorSize>
35 size_t sparseForJacHessian(ADFun<Base>& fun,
36  const VectorBase& x,
37  const VectorBase& w,
38  VectorBase& y,
39  const VectorSet& jac_p,
40  const VectorSize& jac_row,
41  const VectorSize& jac_col,
42  VectorBase& jac,
43  const VectorSet& hes_p,
44  const VectorSize& hes_row,
45  const VectorSize& hes_col,
46  VectorBase& hes,
47  SparseForjacHessianWork& work);
48 
49 template<class Base, class VectorBase, class VectorVectorBase, class VectorSet, class VectorSize>
50 size_t sparseForJacHessian(ADFun<Base>& fun,
51  const VectorBase& x,
52  const VectorVectorBase& w,
53  VectorBase& y,
54  const VectorSet& jac_p,
55  const VectorSize& jac_row,
56  const VectorSize& jac_col,
57  VectorBase& jac,
58  const VectorSet& hes_p,
59  const VectorSize& hes_row,
60  const VectorSize& hes_col,
61  VectorVectorBase& hes,
62  SparseForjacHessianWork& work);
63 
64 /***********************************************************************
65  * Sparsity evaluation
66  **********************************************************************/
67 
68 template<class VectorBool, class Base>
69 inline VectorBool jacobianForwardSparsity(ADFun<Base>& fun);
70 
71 template<class VectorBool, class Base>
72 inline VectorBool jacobianReverseSparsity(ADFun<Base>& fun);
73 
74 template<class VectorSet, class Base>
75 inline VectorSet jacobianForwardSparsitySet(ADFun<Base>& fun);
76 
77 template<class VectorSet, class Base>
78 inline VectorSet jacobianReverseSparsitySet(ADFun<Base>& fun);
79 
80 template<class VectorBool, class Base>
81 inline VectorBool jacobianSparsity(ADFun<Base>& fun);
82 
83 template<class VectorSet, class Base>
84 inline VectorSet jacobianSparsitySet(ADFun<Base>& fun);
85 
86 inline bool estimateBestJacobianADMode(const std::vector<size_t>& jacRows,
87  const std::vector<size_t>& jacCols);
88 
89 template<class VectorBool, class Base>
90 inline VectorBool hessianSparsity(ADFun<Base>& fun,
91  bool transpose = false);
92 
93 template<class VectorSet, class Base>
94 inline VectorSet hessianSparsitySet(ADFun<Base>& fun,
95  const std::set<size_t>& w,
96  bool transpose = false);
97 
98 template<class VectorSet, class Base>
99 inline VectorSet hessianSparsitySet(ADFun<Base>& fun,
100  bool transpose = false);
101 
102 template<class VectorBool, class Base>
103 inline VectorBool hessianSparsity(ADFun<Base>& fun,
104  size_t i,
105  bool transpose = false);
106 
107 template<class VectorSet, class Base>
108 inline VectorSet hessianSparsitySet(ADFun<Base>& fun,
109  size_t i,
110  bool transpose = false);
111 
112 /***********************************************************************
113  * Sparsity conversion
114  **********************************************************************/
115 
116 template<class VectorBool, class VectorSize>
117 inline void generateSparsityIndexes(const VectorBool& sparsity,
118  size_t m,
119  size_t n,
120  VectorSize& row,
121  VectorSize& col);
122 
123 template<class VectorSet, class VectorSize>
124 inline void generateSparsityIndexes(const VectorSet& sparsity,
125  VectorSize& row,
126  VectorSize& col);
127 
128 template<class VectorSet, class VectorSize>
129 inline void generateSparsitySet(const VectorSize& row,
130  const VectorSize& col,
131  VectorSet& sparsity);
132 }
133 }
134 
135 #endif
136 
CppAD
Definition: abstract_atomic_fun.hpp:19