PPL
1.2
|
A row in a matrix of bits. More...
#include <Bit_Row_defs.hh>
Public Member Functions | |
Bit_Row () | |
Default constructor. More... | |
Bit_Row (const Bit_Row &y) | |
Copy constructor. More... | |
Bit_Row (const Bit_Row &y, const Bit_Row &z) | |
Set-union constructor. More... | |
~Bit_Row () | |
Destructor. More... | |
Bit_Row & | operator= (const Bit_Row &y) |
Assignment operator. More... | |
void | m_swap (Bit_Row &y) |
Swaps *this with y . More... | |
bool | operator[] (unsigned long k) const |
Returns the truth value corresponding to the bit in position k . More... | |
void | set (unsigned long k) |
Sets the bit in position k . More... | |
void | set_until (unsigned long k) |
Sets bits up to position k (excluded). More... | |
void | clear (unsigned long k) |
Clears the bit in position k . More... | |
void | clear_from (unsigned long k) |
Clears bits from position k (included) onward. More... | |
void | clear () |
Clears all the bits of the row. More... | |
void | union_assign (const Bit_Row &x, const Bit_Row &y) |
Assigns to *this the set-theoretic union of x and y . More... | |
void | intersection_assign (const Bit_Row &x, const Bit_Row &y) |
Assigns to *this the set-theoretic intersection of x and y . More... | |
void | difference_assign (const Bit_Row &x, const Bit_Row &y) |
Assigns to *this the set-theoretic difference of x and y . More... | |
unsigned long | first () const |
Returns the index of the first set bit or ULONG_MAX if no bit is set. More... | |
unsigned long | next (unsigned long position) const |
Returns the index of the first set bit after position or ULONG_MAX if no bit after position is set. More... | |
unsigned long | last () const |
Returns the index of the last set bit or ULONG_MAX if no bit is set. More... | |
unsigned long | prev (unsigned long position) const |
Returns the index of the first set bit before position or ULONG_MAX if no bits before position is set. More... | |
unsigned long | count_ones () const |
Returns the number of set bits in the row. More... | |
bool | empty () const |
Returns true if no bit is set in the row. More... | |
memory_size_type | total_memory_in_bytes () const |
Returns the total size in bytes of the memory occupied by *this . More... | |
memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this . More... | |
bool | OK () const |
Checks if all the invariants are satisfied. More... | |
Private Member Functions | |
void | union_helper (const Bit_Row &y, const Bit_Row &z) |
Assigns to *this the union of y and z . More... | |
Private Attributes | |
mpz_t | vec |
Bit-vector representing the row. More... | |
Friends | |
int | compare (const Bit_Row &x, const Bit_Row &y) |
bool | operator== (const Bit_Row &x, const Bit_Row &y) |
bool | operator!= (const Bit_Row &x, const Bit_Row &y) |
bool | subset_or_equal (const Bit_Row &x, const Bit_Row &y) |
bool | subset_or_equal (const Bit_Row &x, const Bit_Row &y, bool &strict_subset) |
bool | strict_subset (const Bit_Row &x, const Bit_Row &y) |
Related Functions | |
(Note that these are not member functions.) | |
int | compare (const Bit_Row &x, const Bit_Row &y) |
bool | subset_or_equal (const Bit_Row &x, const Bit_Row &y) |
bool | subset_or_equal (const Bit_Row &x, const Bit_Row &y, bool &strict_subset) |
bool | strict_subset (const Bit_Row &x, const Bit_Row &y) |
bool | operator== (const Bit_Row &x, const Bit_Row &y) |
bool | operator!= (const Bit_Row &x, const Bit_Row &y) |
void | swap (Bit_Row &x, Bit_Row &y) |
Swaps x with y . More... | |
void | iter_swap (std::vector< Bit_Row >::iterator x, std::vector< Bit_Row >::iterator y) |
Swaps objects referred by x and y . More... | |
bool | operator== (const Bit_Row &x, const Bit_Row &y) |
Returns true if and only if x and y are equal. More... | |
bool | operator!= (const Bit_Row &x, const Bit_Row &y) |
Returns true if and only if x and y are not equal. More... | |
int | compare (const Bit_Row &x, const Bit_Row &y) |
The basic comparison function. More... | |
bool | subset_or_equal (const Bit_Row &x, const Bit_Row &y) |
Set-theoretic inclusion test. More... | |
bool | subset_or_equal (const Bit_Row &x, const Bit_Row &y, bool &strict_subset) |
Set-theoretic inclusion test: sets strict_subset to a Boolean indicating whether the inclusion is strict or not. More... | |
bool | strict_subset (const Bit_Row &x, const Bit_Row &y) |
Set-theoretic strict inclusion test. More... | |
void | swap (Bit_Row &x, Bit_Row &y) |
void | iter_swap (std::vector< Bit_Row >::iterator x, std::vector< Bit_Row >::iterator y) |
A row in a matrix of bits.
Definition at line 108 of file Bit_Row_defs.hh.
|
inline |
Default constructor.
Definition at line 43 of file Bit_Row_inlines.hh.
References vec.
|
inline |
Copy constructor.
Definition at line 48 of file Bit_Row_inlines.hh.
References vec.
Set-union constructor.
Constructs an object containing the set-union of y
and z
.
Definition at line 53 of file Bit_Row_inlines.hh.
References PPL_BITS_PER_GMP_LIMB, union_helper(), and vec.
|
inline |
Destructor.
Definition at line 73 of file Bit_Row_inlines.hh.
References vec.
|
inline |
Clears the bit in position k
.
Definition at line 89 of file Bit_Row_inlines.hh.
References vec.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::select_H79_constraints(), and Parma_Polyhedra_Library::BD_Shape< T >::shortest_path_reduction_assign().
|
inline |
Clears all the bits of the row.
Definition at line 116 of file Bit_Row_inlines.hh.
References vec.
|
inline |
Clears bits from position k
(included) onward.
Definition at line 94 of file Bit_Row_inlines.hh.
References vec.
|
inline |
Returns the number of set bits in the row.
Definition at line 99 of file Bit_Row_inlines.hh.
References vec.
Referenced by Parma_Polyhedra_Library::Polyhedron::conversion().
|
inline |
Assigns to *this
the set-theoretic difference of x
and y
.
Definition at line 156 of file Bit_Row_inlines.hh.
References PPL_DIRTY_TEMP, and vec.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().
|
inline |
Returns true
if no bit is set in the row.
Definition at line 106 of file Bit_Row_inlines.hh.
References vec.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), and Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign().
|
inline |
Returns the size in bytes of the memory managed by *this
.
Definition at line 121 of file Bit_Row_inlines.hh.
References vec.
Referenced by total_memory_in_bytes().
unsigned long Parma_Polyhedra_Library::Bit_Row::first | ( | ) | const |
Returns the index of the first set bit or ULONG_MAX if no bit is set.
Definition at line 32 of file Bit_Row.cc.
References Parma_Polyhedra_Library::Implementation::first_one(), PPL_BITS_PER_GMP_LIMB, and vec.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().
|
inline |
Assigns to *this
the set-theoretic intersection of x
and y
.
Definition at line 151 of file Bit_Row_inlines.hh.
References vec.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().
unsigned long Parma_Polyhedra_Library::Bit_Row::last | ( | ) | const |
Returns the index of the last set bit or ULONG_MAX if no bit is set.
Definition at line 92 of file Bit_Row.cc.
References Parma_Polyhedra_Library::Implementation::last_one(), and PPL_BITS_PER_GMP_LIMB.
Referenced by Parma_Polyhedra_Library::Bit_Matrix::OK().
|
inline |
Swaps *this
with y
.
Definition at line 111 of file Bit_Row_inlines.hh.
References vec.
Referenced by swap().
unsigned long Parma_Polyhedra_Library::Bit_Row::next | ( | unsigned long | position | ) | const |
Returns the index of the first set bit after position
or ULONG_MAX if no bit after position
is set.
Definition at line 47 of file Bit_Row.cc.
References Parma_Polyhedra_Library::Implementation::first_one(), and PPL_BITS_PER_GMP_LIMB.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().
bool Parma_Polyhedra_Library::Bit_Row::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 331 of file Bit_Row.cc.
Referenced by Parma_Polyhedra_Library::Bit_Matrix::OK().
Assignment operator.
Definition at line 78 of file Bit_Row_inlines.hh.
References vec.
bool Parma_Polyhedra_Library::Bit_Row::operator[] | ( | unsigned long | k | ) | const |
Returns the truth value corresponding to the bit in position k
.
Definition at line 152 of file Bit_Row.cc.
unsigned long Parma_Polyhedra_Library::Bit_Row::prev | ( | unsigned long | position | ) | const |
Returns the index of the first set bit before position
or ULONG_MAX if no bits before position
is set.
Definition at line 107 of file Bit_Row.cc.
References Parma_Polyhedra_Library::Implementation::last_one(), and PPL_BITS_PER_GMP_LIMB.
|
inline |
Sets the bit in position k
.
Definition at line 84 of file Bit_Row_inlines.hh.
References vec.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_C_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::conversion(), Parma_Polyhedra_Library::Polyhedron::select_H79_constraints(), Parma_Polyhedra_Library::BD_Shape< T >::shortest_path_reduction_assign(), Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign(), Parma_Polyhedra_Library::Polyhedron::strongly_minimize_constraints(), and Parma_Polyhedra_Library::Polyhedron::strongly_minimize_generators().
void Parma_Polyhedra_Library::Bit_Row::set_until | ( | unsigned long | k | ) |
Sets bits up to position k
(excluded).
Definition at line 166 of file Bit_Row.cc.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_C_poly_hull_assign_if_exact(), and Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().
|
inline |
Returns the total size in bytes of the memory occupied by *this
.
Definition at line 126 of file Bit_Row_inlines.hh.
References external_memory_in_bytes().
Assigns to *this
the set-theoretic union of x
and y
.
Definition at line 131 of file Bit_Row_inlines.hh.
References PPL_BITS_PER_GMP_LIMB, union_helper(), and vec.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_C_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), and Parma_Polyhedra_Library::Polyhedron::strongly_minimize_constraints().
|
private |
Assigns to *this
the union of y
and z
.
The size of y
must be be less than or equal to the size of z
. Upon entry, vec
must have allocated enough space to contain the result.
Definition at line 340 of file Bit_Row.cc.
References vec.
Referenced by Bit_Row(), and union_assign().
The basic comparison function.
Compares x
with y
starting from the least significant bits. The ordering is total and has the following property: if x
and y
are two rows seen as sets of naturals, if x
is a strict subset of y
, then x
comes before y
.
Returns
x
comes before y
in the ordering;x
and y
are equal;x
comes after y
in the ordering. Swaps objects referred by x
and y
.
Returns true
if and only if x
and y
are not equal.
Returns true
if and only if x
and y
are equal.
Set-theoretic strict inclusion test.
Set-theoretic inclusion test: sets strict_subset
to a Boolean indicating whether the inclusion is strict or not.
Definition at line 225 of file Bit_Row.cc.
References vec.
Definition at line 223 of file Bit_Row_inlines.hh.
References m_swap().
|
private |
Bit-vector representing the row.
Definition at line 202 of file Bit_Row_defs.hh.
Referenced by Bit_Row(), clear(), clear_from(), compare(), count_ones(), difference_assign(), empty(), external_memory_in_bytes(), first(), intersection_assign(), m_swap(), operator!=(), operator=(), operator==(), set(), strict_subset(), subset_or_equal(), union_assign(), union_helper(), and ~Bit_Row().