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
viewsto 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::vectorordetail::StaticVector1.
- Parameters:
views – a container of
Mat::RowVieworstd::vector<bool>.result – a static vector of bitsets to contain the resulting bit sets.
- Returns:
(None).
- Exceptions:
Throws if
Container::push_backthrows, or theBitSetconstructor throws.- Complexity:
\(O(mn)\) where \(m\) is the number of rows in
viewsand 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 inviewsconverted 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::vectorordetail::StaticVector1.
- Parameters:
views – a container of
Mat::RowVieworstd::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_allocis thrown by thedetail::StaticVector1<BitSet<C>, R>constructor throws.- Complexity:
\(O(mn)\) where \(m\) is the number of rows in
viewsand 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
xas 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
xto.
- 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
xand and \(n\) is the number of columns inx.
-
template<typename Mat>
auto bitset_rows(Mat const &x)¶ Computes the rows of the matrix
xas 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_allocis thrown by thedetail::StaticVector1<BitSet<C>, R>constructor throws.- Complexity:
\(O(mn)\) where \(m\) is the number of rows in
xand and \(n\) is the number of columns inx.