qpmad
Eigen-based C++ QP solver.
Loading...
Searching...
No Matches
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 <stdexcept>
14#include <cmath>
15#include <Eigen/Dense>
16#include <Eigen/Sparse>
17
18#include "config.h"
19
20#include "cpput_config.h"
21#include "cpput_exception.h"
22
23
24#ifdef QPMAD_ENABLE_TRACING
25# define QPMAD_TRACE(info) std::cout << info << std::endl;
26#else
27# define QPMAD_TRACE(info)
28#endif
29
30
31namespace qpmad
32{
33 typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE MatrixIndex;
34
35 typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> QPMatrix; /// @deprecated
36 typedef Eigen::Matrix<double, Eigen::Dynamic, 1> QPVector; /// @deprecated
37
38
39 template <class t_VectorType>
40 inline void dropElementWithoutResize(t_VectorType &vector, const MatrixIndex index, const MatrixIndex size)
41 {
42 if (size - index > 1)
43 {
44 vector.segment(index, size - index - 1) = vector.segment(index + 1, size - index - 1);
45 }
46 }
47} // namespace qpmad
Throw & assert macro.
Eigen::Matrix< double, Eigen::Dynamic, 1 > QPVector
Definition: common.h:36
void dropElementWithoutResize(t_VectorType &vector, const MatrixIndex index, const MatrixIndex size)
Definition: common.h:40
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > QPMatrix
Definition: common.h:35
EIGEN_DEFAULT_DENSE_INDEX_TYPE MatrixIndex
Definition: common.h:33