variadic_evaluate.h
Go to the documentation of this file.
1 // Ceres Solver - A fast non-linear least squares minimizer
2 // Copyright 2013 Google Inc. All rights reserved.
3 // http://code.google.com/p/ceres-solver/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 // * Neither the name of Google Inc. nor the names of its contributors may be
14 // used to endorse or promote products derived from this software without
15 // specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 // Author: sameeragarwal@google.com (Sameer Agarwal)
30 // mierle@gmail.com (Keir Mierle)
31 
32 #ifndef CERES_PUBLIC_INTERNAL_VARIADIC_EVALUATE_H_
33 #define CERES_PUBLIC_INTERNAL_VARIADIC_EVALUATE_H_
34 
35 #include <stddef.h>
36 
40 
41 namespace ceres {
42 namespace internal {
43 
44 // This block of quasi-repeated code calls the user-supplied functor, which may
45 // take a variable number of arguments. This is accomplished by specializing the
46 // struct based on the size of the trailing parameters; parameters with 0 size
47 // are assumed missing.
48 template<typename Functor, typename T, int N0, int N1, int N2, int N3, int N4,
49  int N5, int N6, int N7, int N8, int N9>
51  static bool Call(const Functor& functor, T const *const *input, T* output) {
52  return functor(input[0],
53  input[1],
54  input[2],
55  input[3],
56  input[4],
57  input[5],
58  input[6],
59  input[7],
60  input[8],
61  input[9],
62  output);
63  }
64 };
65 
66 template<typename Functor, typename T, int N0, int N1, int N2, int N3, int N4,
67  int N5, int N6, int N7, int N8>
68 struct VariadicEvaluate<Functor, T, N0, N1, N2, N3, N4, N5, N6, N7, N8, 0> {
69  static bool Call(const Functor& functor, T const *const *input, T* output) {
70  return functor(input[0],
71  input[1],
72  input[2],
73  input[3],
74  input[4],
75  input[5],
76  input[6],
77  input[7],
78  input[8],
79  output);
80  }
81 };
82 
83 template<typename Functor, typename T, int N0, int N1, int N2, int N3, int N4,
84  int N5, int N6, int N7>
85 struct VariadicEvaluate<Functor, T, N0, N1, N2, N3, N4, N5, N6, N7, 0, 0> {
86  static bool Call(const Functor& functor, T const *const *input, T* output) {
87  return functor(input[0],
88  input[1],
89  input[2],
90  input[3],
91  input[4],
92  input[5],
93  input[6],
94  input[7],
95  output);
96  }
97 };
98 
99 template<typename Functor, typename T, int N0, int N1, int N2, int N3, int N4,
100  int N5, int N6>
101 struct VariadicEvaluate<Functor, T, N0, N1, N2, N3, N4, N5, N6, 0, 0, 0> {
102  static bool Call(const Functor& functor, T const *const *input, T* output) {
103  return functor(input[0],
104  input[1],
105  input[2],
106  input[3],
107  input[4],
108  input[5],
109  input[6],
110  output);
111  }
112 };
113 
114 template<typename Functor, typename T, int N0, int N1, int N2, int N3, int N4,
115  int N5>
116 struct VariadicEvaluate<Functor, T, N0, N1, N2, N3, N4, N5, 0, 0, 0, 0> {
117  static bool Call(const Functor& functor, T const *const *input, T* output) {
118  return functor(input[0],
119  input[1],
120  input[2],
121  input[3],
122  input[4],
123  input[5],
124  output);
125  }
126 };
127 
128 template<typename Functor, typename T, int N0, int N1, int N2, int N3, int N4>
129 struct VariadicEvaluate<Functor, T, N0, N1, N2, N3, N4, 0, 0, 0, 0, 0> {
130  static bool Call(const Functor& functor, T const *const *input, T* output) {
131  return functor(input[0],
132  input[1],
133  input[2],
134  input[3],
135  input[4],
136  output);
137  }
138 };
139 
140 template<typename Functor, typename T, int N0, int N1, int N2, int N3>
141 struct VariadicEvaluate<Functor, T, N0, N1, N2, N3, 0, 0, 0, 0, 0, 0> {
142  static bool Call(const Functor& functor, T const *const *input, T* output) {
143  return functor(input[0],
144  input[1],
145  input[2],
146  input[3],
147  output);
148  }
149 };
150 
151 template<typename Functor, typename T, int N0, int N1, int N2>
152 struct VariadicEvaluate<Functor, T, N0, N1, N2, 0, 0, 0, 0, 0, 0, 0> {
153  static bool Call(const Functor& functor, T const *const *input, T* output) {
154  return functor(input[0],
155  input[1],
156  input[2],
157  output);
158  }
159 };
160 
161 template<typename Functor, typename T, int N0, int N1>
162 struct VariadicEvaluate<Functor, T, N0, N1, 0, 0, 0, 0, 0, 0, 0, 0> {
163  static bool Call(const Functor& functor, T const *const *input, T* output) {
164  return functor(input[0],
165  input[1],
166  output);
167  }
168 };
169 
170 template<typename Functor, typename T, int N0>
171 struct VariadicEvaluate<Functor, T, N0, 0, 0, 0, 0, 0, 0, 0, 0, 0> {
172  static bool Call(const Functor& functor, T const *const *input, T* output) {
173  return functor(input[0],
174  output);
175  }
176 };
177 
178 } // namespace internal
179 } // namespace ceres
180 
181 #endif // CERES_PUBLIC_INTERNAL_VARIADIC_EVALUATE_H_
jet.h
ceres::internal::VariadicEvaluate< Functor, T, N0, 0, 0, 0, 0, 0, 0, 0, 0, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:172
ceres::internal::VariadicEvaluate::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:51
eigen.h
T
Eigen::Triplet< double > T
Definition: Tutorial_sparse_example.cpp:6
fixed_array.h
Functor
Definition: NonLinearOptimization.cpp:117
ceres::internal::VariadicEvaluate< Functor, T, N0, N1, N2, N3, N4, N5, N6, N7, N8, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:69
ceres::internal::VariadicEvaluate< Functor, T, N0, N1, N2, N3, N4, N5, N6, 0, 0, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:102
Eigen::Triplet< double >
ceres
Definition: autodiff.h:152
ceres::internal::VariadicEvaluate< Functor, T, N0, N1, 0, 0, 0, 0, 0, 0, 0, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:163
ceres::internal::VariadicEvaluate< Functor, T, N0, N1, N2, N3, 0, 0, 0, 0, 0, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:142
ceres::internal::VariadicEvaluate
Definition: variadic_evaluate.h:50
ceres::internal::VariadicEvaluate< Functor, T, N0, N1, N2, N3, N4, N5, N6, N7, 0, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:86
internal
Definition: BandTriangularSolver.h:13
ceres::internal::VariadicEvaluate< Functor, T, N0, N1, N2, N3, N4, 0, 0, 0, 0, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:130
ceres::internal::VariadicEvaluate< Functor, T, N0, N1, N2, N3, N4, N5, 0, 0, 0, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:117
ceres::internal::VariadicEvaluate< Functor, T, N0, N1, N2, 0, 0, 0, 0, 0, 0, 0 >::Call
static bool Call(const Functor &functor, T const *const *input, T *output)
Definition: variadic_evaluate.h:153


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:18:23