Empirical
|
A simple class to manage a COLS x ROWS matrix of bits. More...
#include <BitMatrix.h>
Public Member Functions | |
template<size_t START_POS, size_t STEP_POS, size_t END_POS> | |
constexpr BitSet< COLS *ROWS > | Mask () const |
BitMatrix () | |
BitMatrix (const BitSet< COLS *ROWS > &in_bits) | |
BitMatrix (const BitMatrix &in_matrix) | |
~BitMatrix () | |
constexpr size_t | NumRows () const |
How many rows are in this matrix? More... | |
constexpr size_t | NumCols () const |
How many columns are in this matrix? More... | |
constexpr size_t | GetSize () const |
How many total cells are in this matrix? More... | |
bool | Any () const |
bool | None () const |
bool | All () const |
bool | Get (size_t col, size_t row) const |
bool | Get (size_t id) const |
void | Set (size_t col, size_t row, bool val=true) |
void | Set (size_t id) |
void | Unset (size_t col, size_t row) |
void | Unset (size_t id) |
void | Flip (size_t col, size_t row) |
void | Flip (size_t id) |
void | SetAll () |
void | SetCol (size_t col) |
void | SetRow (size_t row) |
void | Clear () |
void | ClearCol (size_t col) |
void | ClearRow (size_t row) |
size_t | CountOnes () const |
int | FindBit () const |
BitMatrix | LeftShift () const |
BitMatrix | RightShift () const |
BitMatrix | UpShift () const |
BitMatrix | DownShift () const |
BitMatrix | ULShift () const |
BitMatrix | DLShift () const |
BitMatrix | URShift () const |
BitMatrix | DRShift () const |
BitMatrix | GetReach () const |
BitMatrix | GetRegion (size_t start_pos) const |
BitMatrix | GetRegion (size_t col, size_t row) const |
bool | IsConnected () const |
bool | Has2x2 () const |
void | Print (std::ostream &os=std::cout) const |
BitMatrix & | operator= (const BitMatrix &in) |
BitMatrix & | operator&= (const BitMatrix &in) |
BitMatrix & | operator|= (const BitMatrix &in) |
BitMatrix & | operator^= (const BitMatrix &in) |
bool | operator== (const BitMatrix &in) const |
bool | operator!= (const BitMatrix &in) const |
BitMatrix | operator~ () const |
BitMatrix | operator& (const BitMatrix &in) const |
BitMatrix | operator| (const BitMatrix &in) const |
BitMatrix | operator^ (const BitMatrix &in) const |
const BitSet< COLS *ROWS > & | to_bitset () |
Static Public Member Functions | |
template<size_t COL_ID> | |
static const BitSet< COLS *ROWS > & | MaskCol () |
Keep only a single column of values, reducing all others to zeros. More... | |
template<size_t ROW_ID> | |
static const BitSet< COLS *ROWS > & | MaskRow () |
Keep only a single row of values, reducing all others to zeros. More... | |
static size_t | ToCol (size_t id) |
Identify which column a specific ID is part of. More... | |
static size_t | ToRow (size_t id) |
Identify which row a specific ID is part of. More... | |
static size_t | ToID (size_t col, size_t row) |
Identify the ID associated with a specified row and column. More... | |
A simple class to manage a COLS x ROWS matrix of bits.
Bits are translated to a bitset with 0 in the upper left and moving through bits from left to right and top to bottom. For example, the indecies in a 3x3 bit matrix would be organized as such:
0 1 2 3 4 5 6 7 8
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
How many total cells are in this matrix?
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Keep only a single column of values, reducing all others to zeros.
|
inlinestatic |
Keep only a single row of values, reducing all others to zeros.
|
inline |
|
inline |
How many columns are in this matrix?
|
inline |
How many rows are in this matrix?
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Identify which column a specific ID is part of.
|
inlinestatic |
Identify the ID associated with a specified row and column.
|
inlinestatic |
Identify which row a specific ID is part of.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |