SparseRow class
#include <gtopt/sparse_row.hpp>
Represents a constraint row in a linear program with sparse coefficients.
This class provides a sparse representation of a linear constraint row, storing only non-zero coefficients. It supports various constraint types through fluent interface methods and can convert to dense or flat representations.
Public types
Public static variables
Public functions
- auto bound(double lb, double ub) -> constexpr SparseRow& noexcept
- auto equal(double rhs = 0) -> constexpr SparseRow& noexcept
- auto get_coeff(ColIndex key) const -> double noexcept
- auto greater_equal(double lb) -> constexpr SparseRow& noexcept
- auto less_equal(double ub) -> constexpr SparseRow& noexcept
- auto operator[](this Self&& self, ColIndex key) -> constexpr decltype(auto)
-
auto reserve(size_
type n) -> void - auto set_coeff(ColIndex c, double e) -> constexpr SparseRow&
-
auto size() const -> constexpr size_
type noexcept -
template<typename Int Int = size_auto to_flat(double eps = 0.0) const -> std::pair< KVec, VVec > -> constexpr auto
t, typename Dbl Dbl = double, typename KVec KVec = std::vector<Int>, typename VVec VVec = std::vector<Dbl>>
Public variables
Function documentation
constexpr SparseRow& gtopt:: SparseRow:: greater_equal(double lb) noexcept
| Parameters | |
|---|---|
| lb | Lower bound value |
| Returns | Reference to this row for method chaining |
Sets a lower bound (>= constraint)
constexpr SparseRow& gtopt:: SparseRow:: less_equal(double ub) noexcept
| Parameters | |
|---|---|
| ub | Upper bound value |
| Returns | Reference to this row for method chaining |
Sets an upper bound (<= constraint)
template<typename Int Int = size_ t, typename Dbl Dbl = double, typename KVec KVec = std::vector<Int>, typename VVec VVec = std::vector<Dbl>>
constexpr auto gtopt:: SparseRow:: to_flat(double eps = 0.0) const -> std::pair< KVec, VVec >
| Parameters | |
|---|---|
| eps | Epsilon for zero comparison (values < eps are treated as 0) |
| Returns | Pair of vectors containing indices and values |
Converts to flat representation for solver interfaces