![]() |
libsemigroups
v3.0.0
C++ library for semigroups and monoids
|
Defined in matrix.hpp
.
This is a class for views into a row of a matrix over a semiring. An instance of this class provides access to the elements in a row of a matrix and is cheap to create and copy. Addition, scalar multiplication, and other standard vector operations are defined for row views.
This class is the type of row views into a StaticMatrix; see the documentation for StaticMatrix for further details.
PlusOp | a stateless type with a call operator of signature scalar_type operator()(scalar_type, scalar_type) implementing the addition of the semiring. |
ProdOp | a stateless type with a call operator of signature scalar_type operator()(scalar_type, scalar_type) implementing the multiplication of the semiring. |
ZeroOp | a stateless type with a call operator of signature scalar_type operator()() returning the zero of the semiring (the additive identity element). |
OneOp | a stateless type with a call operator of signature scalar_type operator()() returning the one of the semiring (the multiplicative identity element). |
C | the number of columns of the underlying matrix. |
Scalar | the type of the entries in the matrices (the type of elements in the underlying semiring). |
Public Types | |
using | const_iterator = typename RowViewCommon::const_iterator |
Alias for const iterators pointing at entries of a matrix. | |
using | iterator = typename RowViewCommon::iterator |
Alias for const iterators pointing at entries of a matrix. | |
using | matrix_type = typename RowViewCommon::matrix_type |
Alias for the type of the underlying matrix. | |
using | Row = typename matrix_type::Row |
Alias for the type of a row in the underlying matrix. | |
using | scalar_const_reference = typename RowViewCommon::scalar_const_reference |
Alias for const references to the template parameter Scalar . | |
using | scalar_reference = typename RowViewCommon::scalar_reference |
Alias for references to the template parameter Scalar . | |
using | scalar_type = Scalar |
Alias for the template parameter Scalar . | |
Public Member Functions | |
StaticRowView ()=default | |
Default constructor. | |
StaticRowView (Row const &r) | |
Construct a row view from a Row. | |
StaticRowView (StaticRowView &&)=default | |
Default move constructor. | |
StaticRowView (StaticRowView const &)=default | |
Default copy constructor. | |
iterator | begin () noexcept |
Returns a iterator pointing at the first entry. | |
const_iterator | cbegin () const noexcept |
Returns a const iterator pointing at the first entry. | |
iterator | cend () |
Returns a const iterator pointing one beyond the last entry of the row. | |
iterator | end () |
Returns a iterator pointing one beyond the last entry of the row. | |
template<typename U> | |
bool | operator!= (U const &that) const |
Inequality operator. | |
scalar_reference | operator() (size_t i) |
Returns a reference to the specified entry of the row. | |
scalar_const_reference | operator() (size_t i) const |
Returns a const reference to the specified entry of the row. | |
Row | operator* (scalar_type a) const |
Multiplies every entry of the row by a scalar. | |
void | operator*= (scalar_type a) |
Multiplies every entry of the row by a scalar in-place. | |
Row | operator+ (StaticRowView const &that) |
Sum row views. | |
void | operator+= (scalar_type a) |
Adds a scalar to every entry of a row in-place. | |
void | operator+= (StaticRowView const &that) |
Sums a row view with another row view in-place. | |
template<typename U> | |
bool | operator< (U const &that) const |
Lexicographical comparison of rows. | |
template<typename U> | |
bool | operator< (U const &that) const |
Lexicographical comparison of rows. | |
StaticRowView & | operator= (StaticRowView &&)=default |
Default move assignment operator. | |
StaticRowView & | operator= (StaticRowView const &)=default |
Default copy assignment operator. | |
template<typename U> | |
bool | operator== (U const &that) const |
Equality operator. | |
scalar_reference | operator[] (size_t i) |
Returns a reference to the specified entry of the row. | |
scalar_const_reference | operator[] (size_t i) const |
Returns a const reference to the specified entry of the row. | |
Static Public Member Functions | |
static constexpr size_t | size () const noexcept |
Returns the size of the row. | |
|
default |
Default constructor.
|
default |
Default copy constructor.
|
default |
Default move constructor.
|
explicit |
This function constructs a row view from a Row.
r | the row. |
|
noexcept |
This function returns a (random access) iterator pointing at the first entry in the row.
noexcept
and is guaranteed never to throw.
|
noexcept |
This function returns a const (random access) iterator pointing at the first entry in the row.
noexcept
and is guaranteed never to throw.iterator cend | ( | ) |
This function returns a (random access) const iterator pointing at one beyond the last entry in the row.
iterator end | ( | ) |
This function returns a (random access) iterator pointing at one beyond the last entry in the row.
bool operator!= | ( | U const & | that | ) | const |
Inequality operator.
U | either Row, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic) |
that | Row, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic) object for comparison. |
true
if the first size entries of that
do not equal the entries of this
, and false
otherwise.scalar_reference operator() | ( | size_t | i | ) |
This function returns a reference to the specified entry of the row.
i | the index of the entry. |
i
is performed. scalar_const_reference operator() | ( | size_t | i | ) | const |
This function returns a const reference to the specified entry of the row.
i | the index of the entry. |
i
is performed. Row operator* | ( | scalar_type | a | ) | const |
This function multiplies every entry of the row by a scalar.
a | the scalar. |
a
.void operator*= | ( | scalar_type | a | ) |
This function multiplies every entry of the row by a scalar in-place.
a | the scalar to multiply by. |
Row operator+ | ( | StaticRowView< PlusOp, ProdOp, ZeroOp, OneOp, C, Scalar > const & | that | ) |
This function sums a row view with another row view and returns a newly allocated Row.
that | the row view to add. |
void operator+= | ( | scalar_type | a | ) |
This function adds a scalar to every entry of the row in-place.
a | the scalar to add. |
void operator+= | ( | StaticRowView< PlusOp, ProdOp, ZeroOp, OneOp, C, Scalar > const & | that | ) |
This function redefines a RowView object to be the sum of itself and that
.
that | the row view to add. |
bool operator< | ( | U const & | that | ) | const |
Lexicographical comparison of rows.
U | either Row, StaticRowView, DynamicRowView (compile-time arithmetic), //NOLINT() or DynamicRowView (run-time arithmetic). //NOLINT() |
that | Row, StaticRowView, DynamicRowView (compile-timearithmetic)", or \ref DynamicRowViewDynamicArith "DynamicRowView (run-time arithmetic)" object for comparison. |
true
if *this
is lex less than that that
and false
otherwise.bool operator< | ( | U const & | that | ) | const |
Lexicographical comparison of rows.
U | either Row, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic) |
that | Row, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic) object for comparison. |
true
if this
is lex greater than that that
and false
otherwise.
|
default |
Default move assignment operator.
|
default |
Default copy assignment operator.
bool operator== | ( | U const & | that | ) | const |
Equality operator.
U | either Row, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic) |
that | Row, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic) object for comparison. |
true
if the first size entries of that
equal the entries of this
, and false
if not.scalar_reference operator[] | ( | size_t | i | ) |
This function returns a reference to the specified entry of the row.
i | the index of the entry. |
i
is performed. scalar_const_reference operator[] | ( | size_t | i | ) | const |
This function returns a const reference to the specified entry of the row.
i | the index of the entry. |
i
is performed.
|
staticconstexprnoexcept |
Returns the size of the underlying row which equals the template parameter C
.
noexcept
and is guaranteed never to throw.