Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::packed_matrix_detail Namespace Reference

Classes

struct  Columns_At
 The row and the matrix of the columns of an array, by their indexes. More...
 
struct  Columns_At< Columns, std::index_sequence< J... >, true >
 The row and the matrix of the columns Columns[J].... More...
 
struct  Layout
 Where every column of a row lives. More...
 

Concepts

concept  Column_Integer
 An integer type that make() and fast_make() take: at most 64 bits.
 
concept  Column_Array
 An array of columns that Packed_Row_Of and Packed_Matrix_Of take.
 

Typedefs

template<unsigned Bits>
using Word_Of = std::conditional_t< Bits==8, std::uint8_t, std::conditional_t< Bits==16, std::uint16_t, std::conditional_t< Bits==32, std::uint32_t, std::uint64_t > > >
 Unsigned type of the given number of bits.
 

Functions

template<size_t N>
constexpr Layout< N > make_layout (const std::array< Bit_Column, N > &cols) noexcept
 Place the columns of a row.
 
template<size_t N>
constexpr bool all_true (const std::array< bool, N > &flags) noexcept
 Test whether every flag of an array is set.
 
template<Column_Integer V>
constexpr bool fits_in_int64 (const V v) noexcept
 Test whether an integer is a value of std::int64_t.
 
void throw_bad_column (const size_t j, const size_t num_cols)
 Report a column index that is out of range.
 
void throw_bad_row (const size_t i, const size_t num_rows)
 Report a row index that is out of range.
 
void throw_bad_value (const size_t j, const std::int64_t v, const std::int64_t lo, const std::int64_t hi)
 Report a value that is outside the range of its column.
 
void throw_bad_value (const size_t j, const std::uint64_t v, const std::int64_t lo, const std::int64_t hi)
 Report an unsigned value above the highest std::int64_t.
 

Variables

constexpr size_t max_columns = 65535
 Most columns of a row: Layout keeps the index of the word of a column in 16 bits.
 
template<class... Vs>
constexpr bool all_column_integers
 Test whether make() and fast_make() take every type of a pack.
 
template<class T >
constexpr bool is_column_array = false
 Test whether a type is an array of columns that a row can take.
 

Typedef Documentation

◆ Word_Of

template<unsigned Bits>
using Aleph::packed_matrix_detail::Word_Of = typedef std::conditional_t<Bits == 8, std::uint8_t, std::conditional_t<Bits == 16, std::uint16_t, std::conditional_t<Bits == 32, std::uint32_t, std::uint64_t> >>

Unsigned type of the given number of bits.

Template Parameters
Bits8, 16, 32 or 64.

Definition at line 228 of file tpl_packed_matrix.H.

Function Documentation

◆ all_true()

template<size_t N>
constexpr bool Aleph::packed_matrix_detail::all_true ( const std::array< bool, N > &  flags)
constexprnoexcept

Test whether every flag of an array is set.

It walks the columns of a row without a fold expression: Clang refuses a fold of more than 256 operands, and with it a row of more columns.

Template Parameters
NNumber of flags.
Parameters
[in]flagsThe flags.
Returns
True if no flag is false; true for an empty array.

Definition at line 249 of file tpl_packed_matrix.H.

◆ fits_in_int64()

template<Column_Integer V>
constexpr bool Aleph::packed_matrix_detail::fits_in_int64 ( const V  v)
constexprnoexcept

Test whether an integer is a value of std::int64_t.

Template Parameters
VIts type.
Parameters
[in]vThe integer.
Returns
False only for an unsigned integer above the highest std::int64_t.

Definition at line 276 of file tpl_packed_matrix.H.

References Aleph::and, and V.

Referenced by Aleph::Packed_Row< Cols >::check_argument(), and Aleph::Packed_Row< Cols >::fast_make().

◆ make_layout()

template<size_t N>
constexpr Layout< N > Aleph::packed_matrix_detail::make_layout ( const std::array< Bit_Column, N > &  cols)
constexprnoexcept

Place the columns of a row.

Columns go from the most significant bit of the first word down, in their order, so that comparing the words of two rows compares their tuples of values. A column that does not fit in what is left of a word starts the next one.

Template Parameters
NNumber of columns.
Parameters
[in]colsRanges of the columns, each with lo <= hi.
Returns
The layout.

Definition at line 189 of file tpl_packed_matrix.H.

References cols, l, and N.

◆ throw_bad_column()

void Aleph::packed_matrix_detail::throw_bad_column ( const size_t  j,
const size_t  num_cols 
)
inline

Report a column index that is out of range.

Parameters
[in]jThe index.
[in]num_colsNumber of columns.
Exceptions
std::out_of_rangealways.

Definition at line 292 of file tpl_packed_matrix.H.

References ah_out_of_range_error.

Referenced by Aleph::Packed_Row< Cols >::check_column().

◆ throw_bad_row()

void Aleph::packed_matrix_detail::throw_bad_row ( const size_t  i,
const size_t  num_rows 
)
inline

Report a row index that is out of range.

Parameters
[in]iThe index.
[in]num_rowsNumber of rows.
Exceptions
std::out_of_rangealways.

Definition at line 304 of file tpl_packed_matrix.H.

References ah_out_of_range_error.

Referenced by Aleph::Packed_Matrix< Cols >::check_row().

◆ throw_bad_value() [1/2]

void Aleph::packed_matrix_detail::throw_bad_value ( const size_t  j,
const std::int64_t  v,
const std::int64_t  lo,
const std::int64_t  hi 
)
inline

Report a value that is outside the range of its column.

Parameters
[in]jThe column.
[in]vThe value.
[in]loLowest value of the column.
[in]hiHighest value of the column.
Exceptions
std::domain_erroralways.

Definition at line 317 of file tpl_packed_matrix.H.

References ah_domain_error.

Referenced by Aleph::Packed_Row< Cols >::check_argument(), and Aleph::Packed_Row< Cols >::check_value().

◆ throw_bad_value() [2/2]

void Aleph::packed_matrix_detail::throw_bad_value ( const size_t  j,
const std::uint64_t  v,
const std::int64_t  lo,
const std::int64_t  hi 
)
inline

Report an unsigned value above the highest std::int64_t.

Parameters
[in]jThe column.
[in]vThe value.
[in]loLowest value of the column.
[in]hiHighest value of the column.
Exceptions
std::domain_erroralways.

Definition at line 333 of file tpl_packed_matrix.H.

References ah_domain_error.

Variable Documentation

◆ all_column_integers

template<class... Vs>
constexpr bool Aleph::packed_matrix_detail::all_column_integers
inlineconstexpr
Initial value:
=
all_true(std::array<bool, sizeof...(Vs)>{Column_Integer<Vs>...})
An integer type that make() and fast_make() take: at most 64 bits.
constexpr bool all_true(const std::array< bool, N > &flags) noexcept
Test whether every flag of an array is set.

Test whether make() and fast_make() take every type of a pack.

The same as a fold of Column_Integer over the pack, which Clang refuses beyond 256 types; a pack of constrained parameters, as in Column_Integer... Vs, is checked by such a fold.

Template Parameters
VsThe types.

Definition at line 266 of file tpl_packed_matrix.H.

◆ is_column_array

template<class T >
constexpr bool Aleph::packed_matrix_detail::is_column_array< std::array< Bit_Column, N > > = false
inlineconstexpr

Test whether a type is an array of columns that a row can take.

A std::array of Bit_Column is one if it has from 1 to max_columns entries.

Template Parameters
TThe type.
NNumber of entries.

Definition at line 1199 of file tpl_packed_matrix.H.

◆ max_columns

constexpr size_t Aleph::packed_matrix_detail::max_columns = 65535
inlineconstexpr

Most columns of a row: Layout keeps the index of the word of a column in 16 bits.

Definition at line 158 of file tpl_packed_matrix.H.