14 #ifndef OR_TOOLS_LP_DATA_SCATTERED_VECTOR_H_ 15 #define OR_TOOLS_LP_DATA_SCATTERED_VECTOR_H_ 32 template <
typename IndexType>
54 template <
typename Index,
88 return Iterator(this->non_zeros.data(), this->values.
data(), EntryIndex(0));
90 Iterator
end()
const {
91 return Iterator(this->non_zeros.data(), this->values.
data(),
120 double ratio_for_using_dense_representation)
const {
122 return static_cast<double>(
non_zeros.size()) >
123 ratio_for_using_dense_representation *
201 return reinterpret_cast<const ScatteredRow&>(c);
204 return reinterpret_cast<const ScatteredColumn&>(r);
210 #endif // OR_TOOLS_LP_DATA_SCATTERED_VECTOR_H_
void Add(Index index, Fractional value)
void SortNonZerosIfNeeded()
size_t NumNonZerosEstimate() const
ScatteredRowEntry(const ColIndex *indices, const Fractional *coefficients, EntryIndex i)
bool ShouldUseDenseIteration(double ratio_for_using_dense_representation) const
Fractional operator[](Index index) const
void assign(IntType size, const T &v)
ScatteredVectorEntry(const Index *indices, const Fractional *coefficients, EntryIndex i)
Fractional & operator[](Index index)
void ClearNonZerosIfTooDense()
static constexpr const double kDefaultRatioForUsingDenseIteration
StrictITIVector< Index, Fractional > values
bool IsAllZero(const Container &input)
const Fractional * coefficient_
void resize(IntType size)
#define DCHECK(condition)
bool IsAllFalse(const BoolVector &v)
const ScatteredRow & TransposedView(const ScatteredColumn &c)
Fractional coefficient() const
Collection of objects used to extend the Constraint Solver library.
absl::Span< const double > coefficients
bool non_zeros_are_sorted
void RepopulateSparseMask()
void ClearNonZerosIfTooDense(double ratio_for_using_dense_representation)
std::vector< Index > non_zeros
StrictITIVector< Index, bool > is_non_zero
bool ShouldUseDenseIteration() const
ScatteredColumnEntry(const RowIndex *indices, const Fractional *coefficients, EntryIndex i)