bitset_rows¶
This page contains details of the function templates for finding the rows of a
boolean matrix as bitsets that belong to the namespace matrix_helper
.
The main function is:
which converts the rows stored in the first argument to bitsets and appends them to the second argument.
There are several helper functions which allow the main function to be called without specifying the second argument or where a matrix is given instead of a container of rowviews.
The main function¶
-
template<typename Mat, size_t R, size_t C, typename Container>
void bitset_rows(Container &&views, detail::StaticVector1<BitSet<C>, R> &result)¶ Converts the rows represented by the items in
views
to bit sets.- Template Parameters
Mat – the type of matrix. This must be a type so that
IsBMat<Mat>
istrue
.R – an upper bound for the number of rows in
views
. This value must be at mostBitSet<1>::max_size
.C – an upper bound for the number of columns in each row represented in
views
. This value must be at mostBitSet<1>::max_size
.Container – the type of the container
views
, should bestd::vector
ordetail::StaticVector1
.
- Parameters
views – a container of
Mat::RowView
orstd::vector<bool>
.result – a static vector of bitsets to contain the resulting bit sets.
- Returns
(None).
- Exceptions
Throws if
Container::push_back
throws, or theBitSet
constructor throws.- Complexity
\(O(mn)\) where \(m\) is the number of rows in
views
and and \(n\) is the number of columns in any vector inviews
.
Helpers¶
-
template<typename Mat, size_t R, size_t C, typename Container>
auto bitset_rows(Container &&views)¶ Returns a
detail::StaticVector1<BitSet<C>, R>
containing the rows inviews
converted toBitSet<C>
s.- Template Parameters
Mat – the type of matrix. This must be a type so that
IsBMat<Mat>
istrue
.R – an upper bound for the number of rows in
views
. This value must be at mostBitSet<1>::max_size
.C – an upper bound for the number of columns in each row represented in
views
. This value must be at mostBitSet<1>::max_size
.Container – the type of the container
views
, should bestd::vector
ordetail::StaticVector1
.
- Parameters
views – a container of
Mat::RowView
orstd::vector<bool>
.- Returns
A value of type
detail::StaticVector1<BitSet<C>, R>
.- Exceptions
Throws if
void bitset_rows(Container&&, detail::StaticVector1<BitSet<C>, R>&)
throws, orstd::bad_alloc
is thrown by thedetail::StaticVector1<BitSet<C>, R>
constructor throws.- Complexity
\(O(mn)\) where \(m\) is the number of rows in
views
and and \(n\) is the number of columns in any vector inviews
.
-
template<typename Mat, size_t R, size_t C>
void bitset_rows(Mat const &x, detail::StaticVector1<BitSet<C>, R> &result)¶ Computes the rows of the matrix
x
as bitsets and appends them toresult
.- Template Parameters
Mat – the type of matrix. This must be a type so that
IsBMat<Mat>
istrue
.R – an upper bound for the number of rows in
views
. This value must be at mostBitSet<1>::max_size
.C – an upper bound for the number of columns in each row represented in
views
. This value must be at mostBitSet<1>::max_size
.
- Parameters
x – the boolean matrix.
result – the container to append the rows of
x
to.
- Returns
(None).
- Exceptions
Throws if
void bitset_rows(Container&&, detail::StaticVector1<BitSet<C>, R>&)
throws.- Complexity
\(O(mn)\) where \(m\) is the number of rows in
x
and and \(n\) is the number of columns inx
.
-
template<typename Mat>
auto bitset_rows(Mat const &x)¶ Computes the rows of the matrix
x
as bitsets.- Template Parameters
Mat – the type of matrix. This must be a type so that
IsBMat<Mat>
istrue
.- Parameters
x – the boolean matrix.
- Returns
A value of type
detail::StaticVector1<BitSet<C>, R>
.- Exceptions
Throws if
void bitset_rows(Container&&, detail::StaticVector1<BitSet<C>, R>&)
throws, orstd::bad_alloc
is thrown by thedetail::StaticVector1<BitSet<C>, R>
constructor throws.- Complexity
\(O(mn)\) where \(m\) is the number of rows in
x
and and \(n\) is the number of columns inx
.