Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
row.h
Go to the documentation of this file.
1
30#pragma once
31
34
35#pragma GCC visibility push(default)
36namespace abacus {
37
38
40
52class Row : public SparVec {
53public:
54
56
65 int nnz,
66 const Array<int> &s,
67 const Array<double> &c,
68 const CSense &sense,
69 double r)
70 : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
71
73
82 int nnz,
83 const Array<int> &s,
84 const Array<double> &c,
85 const CSense::SENSE sense,
86 double r)
87 : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
88
90
99 int nnz,
100 int *s,
101 double *c,
103 double r)
104 : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
105
107
111 Row(AbacusGlobal *glob, int size) : SparVec(glob, size) { }
112
114 ~Row() { }
115
117
130 friend std::ostream &operator<<(std::ostream& out, const Row &rhs);
131
133 double rhs() const { return rhs_; }
134
136
139 void rhs(double r) { rhs_ = r; }
140
142 CSense *sense() { return &sense_; }
143
145 const CSense *sense() const { return &sense_; }
146
148
151 void sense(CSense &s) { sense_ = s; }
152
154
158
160
166 void copy(const Row &row);
167
169
173 void delInd(ArrayBuffer<int> &buf, double rhsDelta) {
174 leftShift(buf);
175 rhs_ -= rhsDelta;
176 }
177
178protected:
179
181 double rhs_;
182};
183
184
185}
186#pragma GCC visibility pop
Global data and functions.
Definition global.h:58
Sense of constraints.
Definition csense.h:49
SENSE sense() const
Returns the sense of the constraint.
Definition csense.h:98
Representation of constraints in the row format.
Definition row.h:52
double rhs() const
Returns the right hand side stored in the row format.
Definition row.h:133
CSense * sense()
Returns a pointer to the sense of the row.
Definition row.h:142
void sense(CSense &s)
Sets the sense of the row to s.
Definition row.h:151
const CSense * sense() const
Returns a const pointer to the sense of the row.
Definition row.h:145
~Row()
The destructor.
Definition row.h:114
Row(AbacusGlobal *glob, int size)
Creates a row without initialization of the nonzeros of the row.
Definition row.h:111
Row(AbacusGlobal *glob, int nnz, const Array< int > &s, const Array< double > &c, const CSense &sense, double r)
Creates a row and initializes it.
Definition row.h:64
void rhs(double r)
Sets the right hand side of the row to r.
Definition row.h:139
Row(AbacusGlobal *glob, int nnz, const Array< int > &s, const Array< double > &c, const CSense::SENSE sense, double r)
Creates a row and initializes it.
Definition row.h:81
void delInd(ArrayBuffer< int > &buf, double rhsDelta)
Removes the indices listed in buf from the support of the row and subtracts rhsDelta from its right h...
Definition row.h:173
void sense(CSense::SENSE s)
Sets the sense of the row to s.
Definition row.h:157
Row(AbacusGlobal *glob, int nnz, int *s, double *c, CSense::SENSE sense, double r)
Creates a row and initializes it using C-style arrays.
Definition row.h:98
CSense sense_
The sense of the row.
Definition row.h:180
double rhs_
The right hand side of the row.
Definition row.h:181
void copy(const Row &row)
Copies row.
friend std::ostream & operator<<(std::ostream &out, const Row &rhs)
The output operator.
Sparse vectors.
Definition sparvec.h:48
int size() const
Returns the maximal length of the sparse vector.
Definition sparvec.h:225
void leftShift(ArrayBuffer< int > &del)
Deletes the elements listed in a buffer from the sparse vector.
int nnz() const
Returns the number of nonzero elements.
Definition sparvec.h:233
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition ArrayBuffer.h:64
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
csense.
sparse vector.