libsemigroups  v3.6.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
DynamicRowView< Semiring, Scalar >
template<typename Semiring, typename Scalar>
class libsemigroups::DynamicRowView< Semiring, Scalar >

Defined in matrix-view.hpp.

This class is the type of row views into a DynamicMatrix (run-time arithmetic).

Template Parameters
Semiringthe type of a semiring object which defines the semiring arithmetic (see requirements in DynamicMatrix (run-time arithmetic).
Scalarthe type of the entries in the matrices (the type of elements in the underlying semiring).
Warning
If the underlying matrix is destroyed, then any row views for that matrix are invalidated.

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

 DynamicRowView ()=default
 Default constructor.
 DynamicRowView (DynamicRowView &&)=default
 Default move constructor.
 DynamicRowView (DynamicRowView const &)=default
 Default copy constructor.
 DynamicRowView (Row const &r)
 Construct a row view from a Row.
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+ (DynamicRowView const &that)
 Sum row views.
void operator+= (DynamicRowView const &that)
 Sums a row view with another row view in-place.
void operator+= (scalar_type a)
 Adds a scalar to every entry of a row 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.
DynamicRowViewoperator= (DynamicRowView &&)=default
 Default move assignment operator.
DynamicRowViewoperator= (DynamicRowView 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.
void plus_inplace_no_checks (DynamicRowView const &that)
 Sums a row view with another row view in-place.
Row plus_no_checks (DynamicRowView const &that)
 Sum row views.
size_t size () const noexcept
 Returns the size of the row.

Constructor & Destructor Documentation

◆ DynamicRowView() [1/4]

template<typename Semiring, typename Scalar>
DynamicRowView ( )
default

Default constructor.

◆ DynamicRowView() [2/4]

template<typename Semiring, typename Scalar>
DynamicRowView ( DynamicRowView< Semiring, Scalar > const & )
default

Default copy constructor.

◆ DynamicRowView() [3/4]

template<typename Semiring, typename Scalar>
DynamicRowView ( DynamicRowView< Semiring, Scalar > && )
default

Default move constructor.

◆ DynamicRowView() [4/4]

template<typename Semiring, typename Scalar>
DynamicRowView ( Row const & r)
inlineexplicit

This function constructs a row view from a Row.

Parameters
rthe row.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant.

Member Function Documentation

◆ begin()

template<typename Semiring, typename Scalar>
iterator begin ( )
noexcept

This function returns a (random access) iterator pointing at the first entry in the row.

Returns
A value of type iterator.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant

◆ cbegin()

template<typename Semiring, typename Scalar>
const_iterator cbegin ( ) const
noexcept

This function returns a const (random access) iterator pointing at the first entry in the row.

Returns
A value of type const_iterator.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant

◆ cend()

template<typename Semiring, typename Scalar>
iterator cend ( )

This function returns a (random access) const iterator pointing at one beyond the last entry in the row.

Returns
A value of type iterator.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant

◆ end()

template<typename Semiring, typename Scalar>
iterator end ( )

This function returns a (random access) iterator pointing at one beyond the last entry in the row.

Returns
A value of type iterator.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant

◆ operator!=()

template<typename Semiring, typename Scalar>
template<typename U>
bool operator!= ( U const & that) const

Inequality operator.

Template Parameters
Ueither Row, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic)
Parameters
thatRow, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic) object for comparison.
Returns
Returns true if the first size entries of that do not equal the entries of this, and false otherwise.
Complexity
At worst \(O(n)\) where \(n\) is the size of the row view.

◆ operator()() [1/2]

template<typename Semiring, typename Scalar>
scalar_reference operator() ( size_t i)

This function returns a reference to the specified entry of the row.

Parameters
ithe index of the entry.
Returns
A value of type scalar_reference.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant
Warning
No checks on the validity of the parameter i is performed.

◆ operator()() [2/2]

template<typename Semiring, typename Scalar>
scalar_const_reference operator() ( size_t i) const

This function returns a const reference to the specified entry of the row.

Parameters
ithe index of the entry.
Returns
A value of type scalar_const_reference.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant
Warning
No checks on the validity of the parameter i is performed.

◆ operator*()

template<typename Semiring, typename Scalar>
Row operator* ( scalar_type a) const

This function multiplies every entry of the row by a scalar.

Parameters
athe scalar.
Returns
A value of type Row containing the original row multiplied by the scalar a.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
\(O(m)\) where \(m\) is size.
Warning
This function does not detect overflows of scalar_type.

◆ operator*=()

template<typename Semiring, typename Scalar>
void operator*= ( scalar_type a)

This function multiplies every entry of the row by a scalar in-place.

Parameters
athe scalar to multiply by.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
\(O(m)\) where \(m\) is size.
Warning
This function does not detect overflows of scalar_type.

◆ operator+()

template<typename Semiring, typename Scalar>
Row operator+ ( DynamicRowView< Semiring, Scalar > const & that)

This function sums a row view with another row view and returns a newly allocated Row.

Parameters
thatthe row view to add.
Returns
A Row containing the sum.
Exceptions
LibsemigroupsExceptionif the RowView pointed at by this and that do not have the same size.
Complexity
\(O(m)\) where \(m\) is size.
Warning
This function does not detect overflows of scalar_type.

◆ operator+=() [1/2]

template<typename Semiring, typename Scalar>
void operator+= ( DynamicRowView< Semiring, Scalar > const & that)

This function redefines a RowView object to be the sum of itself and that.

Parameters
thatthe row view to add.
Exceptions
LibsemigroupsExceptionif the RowView pointed at by this and that do not have the same size.
Complexity
\(O(m)\) where \(m\) is size.
Warning
This function does not detect overflows of scalar_type.

◆ operator+=() [2/2]

template<typename Semiring, typename Scalar>
void operator+= ( scalar_type a)

This function adds a scalar to every entry of the row in-place.

Parameters
athe scalar to add.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
\(O(m)\) where \(m\) is size.
Warning
This function does not detect overflows of scalar_type.

◆ operator<() [1/2]

template<typename Semiring, typename Scalar>
template<typename U>
bool operator< ( U const & that) const

Lexicographical comparison of rows.

Template Parameters
Ueither Row, StaticRowView,

DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic).

Parameters
thatRow, StaticRowView, DynamicRowView (compile-timearithmetic), or DynamicRowView(run-time arithmetic) object for comparison.
Returns
Returns true if *this is lex less than that that and false otherwise.
Complexity
At worst \(O(n)\) where \(n\) is the size of the row view.

◆ operator<() [2/2]

template<typename Semiring, typename Scalar>
template<typename U>
bool operator< ( U const & that) const

Lexicographical comparison of rows.

Template Parameters
Ueither Row, StaticRowView,

DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic).

Parameters
thatRow, StaticRowView, DynamicRowView (compile-timearithmetic), or DynamicRowView(run-time arithmetic) object for comparison.
Returns
Returns true if *this is lex less than that that and false otherwise.
Complexity
At worst \(O(n)\) where \(n\) is the size of the row view.

◆ operator=() [1/2]

template<typename Semiring, typename Scalar>
DynamicRowView & operator= ( DynamicRowView< Semiring, Scalar > && )
default

Default move assignment operator.

◆ operator=() [2/2]

template<typename Semiring, typename Scalar>
DynamicRowView & operator= ( DynamicRowView< Semiring, Scalar > const & )
default

Default copy assignment operator.

◆ operator==()

template<typename Semiring, typename Scalar>
template<typename U>
bool operator== ( U const & that) const

Equality operator.

Template Parameters
Ueither Row, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic)
Parameters
thatRow, StaticRowView, DynamicRowView (compile-time arithmetic), or DynamicRowView (run-time arithmetic) object for comparison.
Returns
Returns true if the first size entries of that equal the entries of this, and false if not.
Complexity
At worst \(O(n)\) where \(n\) is the size of the row view.

◆ operator[]() [1/2]

template<typename Semiring, typename Scalar>
scalar_reference operator[] ( size_t i)

This function returns a reference to the specified entry of the row.

Parameters
ithe index of the entry.
Returns
A value of type scalar_reference.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant
Warning
No checks on the validity of the parameter i is performed.

◆ operator[]() [2/2]

template<typename Semiring, typename Scalar>
scalar_const_reference operator[] ( size_t i) const

This function returns a const reference to the specified entry of the row.

Parameters
ithe index of the entry.
Returns
A value of type scalar_const_reference.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant
Warning
No checks on the validity of the parameter i is performed.

◆ plus_inplace_no_checks()

template<typename Semiring, typename Scalar>
void plus_inplace_no_checks ( DynamicRowView< Semiring, Scalar > const & that)

This function redefines a RowView object to be the sum of itself and that.

Parameters
thatthe row view to add.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
\(O(m)\) where \(m\) is size.
Warning
The two row views must be of the same size, although this is not verified by the implementation.
This function does not detect overflows of scalar_type.

◆ plus_no_checks()

template<typename Semiring, typename Scalar>
Row plus_no_checks ( DynamicRowView< Semiring, Scalar > const & that)

This function sums a row view with another row view and returns a newly allocated Row.

Parameters
thatthe row view to add.
Returns
A Row containing the sum.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
\(O(m)\) where \(m\) is size.
Warning
The two row views must be of the same size, although this is not verified.
This function does not detect overflows of scalar_type.

◆ size()

template<typename Semiring, typename Scalar>
size_t size ( ) const
noexcept

Returns the size of the underlying row which equals the template parameter C.

Returns
The size of the row.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant

The documentation for this class was generated from the following file:
  • /home/joseph/Dev/Comp_Maths/sandbox/libsemigroups/include/libsemigroups/matrix-view.hpp