GF2::Matrix — Size Queries
How many rows, columns, elements etc. are in the bit-matrix?
constexpr std::size_t rows() const; (1)
constexpr std::size_t cols() const; (2)
constexpr bool is_square() const; (3)
constexpr std::size_t size() const; (4)
constexpr bool empty() const; (5)
| 1 | Returns the number of rows in the bit-matrix. |
| 2 | Returns the number of columns in the bit-matrix. |
| 3 | Returns true if the bit-matrix is square i.e. if rows() == cols(). |
| 4 | Returns the number of elements in the bit-matrix. |
| 5 | Returns true if the bit-matrix has no elements (so size() == 0), returns false otherwise. |
Example
#include <GF2/GF2.h>
int main()
{
GF2::Matrix<> m(3, 4);
std::cout << "m.rows(): " << m.rows() << '\n';
std::cout << "m.cols(): " << m.cols() << '\n';
std::cout << "m.size(): " << m.size() << '\n';
std::cout << "m.is_square(): " << (m.is_square() ? "YES" : "NO") << '\n';
std::cout << "m.empty(): " << (m.empty() ? "YES" : "NO") << '\n';
}
Output
m.rows(): 3
m.cols(): 4
m.size(): 12
m.is_square(): NO
m.empty(): NO
See Also