qpmad
Eigen-based C++ QP solver.
common.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2017 Alexander Sherikov. Licensed under the Apache License,
6  Version 2.0. (see LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 #include "config.h"
14 
15 #ifdef QPMAD_PEDANTIC_LICENSE
16 # define EIGEN_MPL2_ONLY
17 #endif
18 
19 #include <stdexcept>
20 #include <cmath>
21 #include <Eigen/Dense>
22 #include <Eigen/Sparse>
23 
24 
25 #include "exception.h"
26 
27 
28 #ifdef QPMAD_ENABLE_TRACING
29 # define QPMAD_TRACE(info) std::cout << info << std::endl;
30 #else
31 # define QPMAD_TRACE(info)
32 #endif
33 
34 
35 namespace qpmad
36 {
37  typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE MatrixIndex;
38 
39  typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> QPMatrix; /// @deprecated
40  typedef Eigen::Matrix<double, Eigen::Dynamic, 1> QPVector; /// @deprecated
41 
42 
43  template <class t_VectorType>
44  inline void dropElementWithoutResize(t_VectorType &vector, const MatrixIndex index, const MatrixIndex size)
45  {
46  if (size - index > 1)
47  {
48  vector.segment(index, size - index - 1) = vector.segment(index + 1, size - index - 1);
49  }
50  }
51 } // namespace qpmad
Throw & assert macro.
Eigen::Matrix< double, Eigen::Dynamic, 1 > QPVector
Definition: common.h:40
void dropElementWithoutResize(t_VectorType &vector, const MatrixIndex index, const MatrixIndex size)
Definition: common.h:44
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > QPMatrix
Definition: common.h:39
EIGEN_DEFAULT_DENSE_INDEX_TYPE MatrixIndex
Definition: common.h:37