codac 2.0.0
Loading...
Searching...
No Matches
codac2_ibex_impl.h
1
9
10#pragma once
11#include <cassert>
12
13// Inline functions
14
15namespace codac2
16{
17 inline ibex::Interval to_ibex(const Interval& x)
18 {
19 return { x.lb(), x.ub() };
20 }
21
22 inline Interval to_codac(const ibex::Interval& x)
23 {
24 return { x.lb(), x.ub() };
25 }
26
27 #define cast_vector(OutputType,convert) \
28 \
29 OutputType x_(x.size()); \
30 for(Index i = 0 ; i < (Index)x.size() ; i++) \
31 x_[i] = convert(x[i]); \
32 return x_; \
33
34 inline ibex::Vector to_ibex(const codac2::Vector& x)
35 {
36 cast_vector(ibex::Vector,double);
37 }
38
39 inline codac2::Vector to_codac(const ibex::Vector& x)
40 {
41 cast_vector(codac2::Vector,double);
42 }
43
44 inline ibex::IntervalVector to_ibex(const codac2::IntervalVector& x)
45 {
46 cast_vector(ibex::IntervalVector,to_ibex);
47 }
48
49 inline codac2::IntervalVector to_codac(const ibex::IntervalVector& x)
50 {
51 cast_vector(codac2::IntervalVector,to_codac);
52 }
53
54 #define cast_matrix(OutputType,convert_f,output_ij,input_ij,rows_,cols_) \
55 \
56 OutputType x_(x.rows_(), x.cols_()); \
57 for(Index i = 0 ; i < (Index)x.rows_() ; i++) \
58 for(Index j = 0 ; j < (Index)x.cols_() ; j++) \
59 output_ij = convert_f(input_ij); \
60 return x_; \
61
62 inline ibex::Matrix to_ibex(const codac2::Matrix& x)
63 {
64 cast_matrix(ibex::Matrix,double,x_[i][j],x(i,j),rows,cols);
65 }
66
67 inline codac2::Matrix to_codac(const ibex::Matrix& x)
68 {
69 cast_matrix(codac2::Matrix,double,x_(i,j),x[i][j],nb_rows,nb_cols);
70 }
71
72 inline ibex::IntervalMatrix to_ibex(const codac2::IntervalMatrix& x)
73 {
74 cast_matrix(ibex::IntervalMatrix,to_ibex,x_[i][j],x(i,j),rows,cols);
75 }
76
77 inline codac2::IntervalMatrix to_codac(const ibex::IntervalMatrix& x)
78 {
79 cast_matrix(codac2::IntervalMatrix,to_codac,x_(i,j),x[i][j],nb_rows,nb_cols);
80 }
81
82}
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:49
Definition codac2_OctaSym.h:21
Eigen::Matrix< double,-1, 1 > Vector
Alias for a dynamically-sized column vector of doubles.
Definition codac2_Vector.h:24
Eigen::Matrix< Interval,-1, 1 > IntervalVector
Alias for a dynamic-size column vector of intervals.
Definition codac2_IntervalVector.h:25
Eigen::Matrix< double,-1,-1 > Matrix
Alias for a dynamic-size matrix of doubles.
Definition codac2_Matrix.h:26
Eigen::Matrix< Interval,-1,-1 > IntervalMatrix
Alias for a dynamic-size matrix of intervals.
Definition codac2_IntervalMatrix.h:25