19#ifndef LIBSEMIGROUPS_MATRIX_VIEW_HPP_
20#define LIBSEMIGROUPS_MATRIX_VIEW_HPP_
24#include "detail/matrix-common.hpp"
27#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
28 template <
typename PlusOp,
37 template <
typename... Args>
81 template <
typename PlusOp,
88 :
public detail::RowViewCommon<
89 StaticMatrix<PlusOp, ProdOp, ZeroOp, OneOp, 1, C, Scalar>,
90 StaticRowView<PlusOp, ProdOp, ZeroOp, OneOp, C, Scalar>>,
92 MatrixStaticArithmetic<PlusOp, ProdOp, ZeroOp, OneOp, Scalar> {
94 using RowViewCommon = detail::RowViewCommon<
100 using StaticMatrix_ = ::libsemigroups::
101 StaticMatrix<PlusOp, ProdOp, ZeroOp, OneOp, R, C, Scalar>;
126 using Row =
typename matrix_type::Row;
143#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
144 using RowViewCommon::RowViewCommon;
149 typename RowViewCommon::iterator it,
151 : RowViewCommon(it) {}
153 using RowViewCommon::size;
180 static constexpr size_t size() const noexcept;
304 template <typename U>
305 bool operator==(U const& that) const;
327 template <typename U>
328 bool operator!=(U const& that) const;
353 template <typename U>
354 bool operator<(U const& that) const;
377 template <typename U>
378 bool operator<(U const& that) const;
505 static constexpr size_t length_impl() noexcept {
514#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
517 template <
typename... Args>
518 class DynamicRowView;
558 template <
typename PlusOp,
564 :
public detail::RowViewCommon<
565 DynamicMatrix<PlusOp, ProdOp, ZeroOp, OneOp, Scalar>,
566 DynamicRowView<PlusOp, ProdOp, ZeroOp, OneOp, Scalar>>,
568 MatrixStaticArithmetic<PlusOp, ProdOp, ZeroOp, OneOp, Scalar> {
570 using DynamicMatrix_ = DynamicMatrix<PlusOp, ProdOp, ZeroOp, OneOp, Scalar>;
571 using RowViewCommon = detail::RowViewCommon<
574 friend RowViewCommon;
599 using Row =
typename matrix_type::Row;
618 : RowViewCommon(r), _length(r.number_of_cols()) {}
620#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
621 using RowViewCommon::RowViewCommon;
624 DynamicRowView(DynamicMatrix_
const*, iterator
const& it,
size_t N)
625 : RowViewCommon(it), _length(N) {}
627 using RowViewCommon::size;
657 template <typename U>
658 bool operator==(U const& that) const;
661 template <typename U>
662 bool operator!=(U const& that) const;
665 template <typename U>
666 bool operator<(U const& that) const;
669 template <typename U>
670 bool operator<(U const& that) const;
695 size_t length_impl() const noexcept {
725 template <
typename Semiring,
typename Scalar>
727 :
public detail::RowViewCommon<DynamicMatrix<Semiring, Scalar>,
728 DynamicRowView<Semiring, Scalar>> {
730 using DynamicMatrix_ = DynamicMatrix<Semiring, Scalar>;
731 friend DynamicMatrix_;
733 = detail::RowViewCommon<DynamicMatrix_,
735 friend RowViewCommon;
742 using iterator =
typename RowViewCommon::iterator;
757 using matrix_type =
typename RowViewCommon::matrix_type;
760 using Row =
typename matrix_type::Row;
780#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
781 using RowViewCommon::RowViewCommon;
784 DynamicRowView(DynamicMatrix_
const* mat, iterator
const& it,
size_t)
785 : RowViewCommon(it), _matrix(mat) {}
787 using RowViewCommon::size;
790 size_t size() const noexcept;
817 template <typename U>
818 bool operator==(U const& that) const;
821 template <typename U>
822 bool operator!=(U const& that) const;
825 template <typename U>
826 bool operator<(U const& that) const;
829 template <typename U>
830 bool operator<(U const& that) const;
855 size_t length_impl() const noexcept {
856 return _matrix->number_of_cols();
859 scalar_type plus_no_checks_impl(scalar_type x,
860 scalar_type y)
const noexcept {
861 return _matrix->plus_no_checks_impl(x, y);
864 scalar_type product_no_checks_impl(scalar_type x,
865 scalar_type y)
const noexcept {
866 return _matrix->product_no_checks_impl(x, y);
869 DynamicMatrix_
const* _matrix;
DynamicRowView & operator=(DynamicRowView &&)=default
Default move assignment operator.
size_t size() const noexcept
Returns the size of the row.
DynamicRowView & operator=(DynamicRowView const &)=default
Default copy assignment operator.
DynamicRowView(DynamicRowView const &)=default
Default copy constructor.
DynamicRowView(DynamicRowView &&)=default
Default move constructor.
DynamicRowView(Row const &r)
Construct a row view from a Row.
Definition matrix-view.hpp:617
typename RowViewCommon::iterator iterator
Alias for const iterators pointing at entries of a matrix.
Definition matrix-view.hpp:581
typename RowViewCommon::scalar_const_reference scalar_const_reference
Alias for const references to the template parameter Scalar.
Definition matrix-view.hpp:592
typename RowViewCommon::scalar_reference scalar_reference
Alias for references to the template parameter Scalar.
Definition matrix-view.hpp:587
iterator begin() noexcept
Returns a iterator pointing at the first entry.
iterator cend()
Returns a const iterator pointing one beyond the last entry of the row.
typename matrix_type::Row Row
Alias for the type of a row in the underlying matrix.
Definition matrix-view.hpp:599
typename RowViewCommon::const_iterator const_iterator
Alias for const iterators pointing at entries of a matrix.
Definition matrix-view.hpp:578
const_iterator cbegin() const noexcept
Returns a const iterator pointing at the first entry.
void plus_inplace_no_checks(DynamicRowView const &that)
Sums a row view with another row view in-place.
iterator end()
Returns a iterator pointing one beyond the last entry of the row.
Scalar scalar_type
Alias for the template parameter Scalar.
Definition matrix-view.hpp:584
Row plus_no_checks(DynamicRowView const &that)
Sum row views.
typename RowViewCommon::matrix_type matrix_type
Alias for the type of the underlying matrix.
Definition matrix-view.hpp:596
DynamicRowView()=default
Default constructor.
size_t size() const noexcept
Returns the size of the row.
DynamicRowView & operator=(DynamicRowView const &)=default
Default copy assignment operator.
typename RowViewCommon::iterator iterator
Alias for const iterators pointing at entries of a matrix.
Definition matrix-view.hpp:741
typename RowViewCommon::scalar_const_reference scalar_const_reference
Alias for const references to the template parameter Scalar.
Definition matrix-view.hpp:752
typename RowViewCommon::scalar_reference scalar_reference
Alias for references to the template parameter Scalar.
Definition matrix-view.hpp:747
iterator begin() noexcept
Returns a iterator pointing at the first entry.
iterator cend()
Returns a const iterator pointing one beyond the last entry of the row.
typename matrix_type::Row Row
Alias for the type of a row in the underlying matrix.
Definition matrix-view.hpp:759
typename RowViewCommon::const_iterator const_iterator
Alias for const iterators pointing at entries of a matrix.
Definition matrix-view.hpp:738
const_iterator cbegin() const noexcept
Returns a const iterator pointing at the first entry.
void plus_inplace_no_checks(DynamicRowView const &that)
Sums a row view with another row view in-place.
iterator end()
Returns a iterator pointing one beyond the last entry of the row.
Scalar scalar_type
Alias for the template parameter Scalar.
Definition matrix-view.hpp:744
Row plus_no_checks(DynamicRowView const &that)
Sum row views.
typename RowViewCommon::matrix_type matrix_type
Alias for the type of the underlying matrix.
Definition matrix-view.hpp:756
DynamicRowView()=default
Default constructor.
Static matrix class.
Definition matrix-class.hpp:174
void plus_inplace_no_checks(StaticRowView const &that)
Sums a row view with another row view in-place.
typename RowViewCommon::iterator iterator
Alias for const iterators pointing at entries of a matrix.
Definition matrix-view.hpp:108
typename RowViewCommon::scalar_const_reference scalar_const_reference
Alias for const references to the template parameter Scalar.
Definition matrix-view.hpp:119
StaticRowView & operator=(StaticRowView &&)=default
Default move assignment operator.
typename RowViewCommon::scalar_reference scalar_reference
Alias for references to the template parameter Scalar.
Definition matrix-view.hpp:114
iterator begin() noexcept
Returns a iterator pointing at the first entry.
iterator cend()
Returns a const iterator pointing one beyond the last entry of the row.
StaticRowView()=default
Default constructor.
typename matrix_type::Row Row
Alias for the type of a row in the underlying matrix.
Definition matrix-view.hpp:126
typename RowViewCommon::const_iterator const_iterator
Alias for const iterators pointing at entries of a matrix.
Definition matrix-view.hpp:105
const_iterator cbegin() const noexcept
Returns a const iterator pointing at the first entry.
Row plus_no_checks(StaticRowView const &that) const
Sum row views.
iterator end()
Returns a iterator pointing one beyond the last entry of the row.
Scalar scalar_type
Alias for the template parameter Scalar.
Definition matrix-view.hpp:111
StaticRowView(StaticRowView &&)=default
Default move constructor.
typename RowViewCommon::matrix_type matrix_type
Alias for the type of the underlying matrix.
Definition matrix-view.hpp:123
StaticRowView(StaticRowView const &)=default
Default copy constructor.
static constexpr size_t size() const noexcept
Returns the size of the row.
StaticRowView & operator=(StaticRowView const &)=default
Default copy assignment operator.
StaticRowView(Row const &r)
Construct a row view from a Row.
Namespace for everything in the libsemigroups library.
Definition action.hpp:44