forked from DatenVorsprung/LRTNG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ibex_to_eigen_api.h
68 lines (59 loc) · 1.52 KB
/
ibex_to_eigen_api.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* ibex_to_eigen.h
*
** Lagrangian Reachtubes: The next Generation
*
* Authors: Sophie Gruenbacher and Md Ariful Islam
* Contact: [email protected]
*/
#ifndef IBEX_TO_EIGEN_H
#define IBEX_TO_EIGEN_H
/* Eigen Library*/
#include <Eigen/Cholesky>
#include <Eigen/Core>
#include <unsupported/Eigen/MatrixFunctions>
#include <Eigen/Eigenvalues>
#include <Eigen/Dense>
/* ibex Library*/
#include "ibex.h"
/*Define namespace*/
using namespace Eigen;
using namespace ibex;
////////////// BEGIN: API between IBEX and EIGEN ////////////////////////////////
/* IBEX to Eigen */
MatrixXd ibex_to_eigen(ibex::Matrix ibex_mat, int dim) {
MatrixXd eig_mat(dim, dim);
for(int i=0; i<dim; i++){
for(int j=0; j<dim; j++){
eig_mat(i,j) = ibex_mat[i][j];
}
}
return eig_mat;
}
VectorXd ibex_to_eigen(ibex::Vector ibex_vec, int dim){
VectorXd eig_vec(dim);
for(int i=0; i<dim; i++){
eig_vec(i) = ibex_vec[i];
}
return eig_vec;
}
/* Eigen to IBEX */
// MatrixXd -> Matrix
ibex::Matrix eigen_to_ibex(MatrixXd eig_mat, int dim) {
ibex::Matrix ibex_mat(dim, dim);
for(int i=0; i<dim; i++){
for(int j=0; j<dim; j++){
ibex_mat[i][j] = eig_mat(i,j);
}
}
return ibex_mat;
}
// VectorXd -> IntervalVector
ibex::IntervalVector eigen_to_ibex(VectorXd eig_vec, int dim){
ibex::IntervalVector ibex_vec(dim);
for(int i=0; i<dim; i++){
ibex_vec[i] = eig_vec(i);
}
return ibex_vec;
}
#endif /* IBEX_TO_EIGEN_H */