TVM  0.9.4
RHSVectors.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <tvm/api.h>
6 
7 #include <tvm/constraint/enums.h>
8 
9 #include <Eigen/Core>
10 
11 namespace tvm
12 {
13 
14 namespace constraint
15 {
16 
17 namespace internal
18 {
19 
24 {
25 public:
30  RHSVectors(Type ct, RHS cr);
31 
33  void resize(int n);
34 
38  Eigen::VectorXd & l();
39 
43  const Eigen::VectorXd & l() const;
44 
48  Eigen::VectorXd & u();
49 
53  const Eigen::VectorXd & u() const;
54 
58  Eigen::VectorXd & e();
59 
63  const Eigen::VectorXd & e() const;
64 
71  Eigen::VectorXd & rhs(Type t);
72 
79  const Eigen::VectorXd & rhs(Type t) const;
80 
82  bool use_l() const;
83 
85  bool use_u() const;
86 
88  bool use_e() const;
89 
90 private:
91  Eigen::VectorXd l_;
92  Eigen::VectorXd u_;
93  Eigen::VectorXd e_;
94 
95  const bool use_l_;
96  const bool use_u_;
97  const bool use_e_;
98 };
99 
100 inline Eigen::VectorXd & RHSVectors::l() { return l_; }
101 
102 inline const Eigen::VectorXd & RHSVectors::l() const { return l_; }
103 
104 inline Eigen::VectorXd & RHSVectors::u() { return u_; }
105 
106 inline const Eigen::VectorXd & RHSVectors::u() const { return u_; }
107 
108 inline Eigen::VectorXd & RHSVectors::e() { return e_; }
109 
110 inline const Eigen::VectorXd & RHSVectors::e() const { return e_; }
111 
112 inline Eigen::VectorXd & RHSVectors::rhs(Type t)
113 {
114  switch(t)
115  {
116  case Type::LOWER_THAN:
117  return u_;
118  case Type::GREATER_THAN:
119  return l_;
120  case Type::EQUAL:
121  return e_;
122  case Type::DOUBLE_SIDED:
123  throw std::runtime_error("This methods is not available for DOUBLE_SIDED");
124  }
125 }
126 
127 inline const Eigen::VectorXd & RHSVectors::rhs(Type t) const
128 {
129  switch(t)
130  {
131  case Type::LOWER_THAN:
132  return u_;
133  case Type::GREATER_THAN:
134  return l_;
135  case Type::EQUAL:
136  return e_;
137  case Type::DOUBLE_SIDED:
138  throw std::runtime_error("This methods is not available for DOUBLE_SIDED");
139  }
140 }
141 
142 inline bool RHSVectors::use_l() const { return use_l_; }
143 
144 inline bool RHSVectors::use_u() const { return use_u_; }
145 
146 inline bool RHSVectors::use_e() const { return use_e_; }
147 
148 } // namespace internal
149 
150 } // namespace constraint
151 
152 } // namespace tvm
Definition: RHSVectors.h:24
bool use_e() const
Definition: RHSVectors.h:146
bool use_l() const
Definition: RHSVectors.h:142
Eigen::VectorXd & e()
Definition: RHSVectors.h:108
Eigen::VectorXd & l()
Definition: RHSVectors.h:100
bool use_u() const
Definition: RHSVectors.h:144
Eigen::VectorXd & rhs(Type t)
Definition: RHSVectors.h:112
Eigen::VectorXd & u()
Definition: RHSVectors.h:104
Type
Definition: enums.h:15
RHS
Definition: enums.h:30
Definition: Clock.h:12