Skip to content

Latest commit

 

History

History
70 lines (43 loc) · 1.92 KB

operator_plus_equals.rst

File metadata and controls

70 lines (43 loc) · 1.92 KB

operator+=

.. cpp:namespace:: libsemigroups::StaticMatrix<PlusOp, ProdOp, ZeroOp, OneOp, R, C, Scalar>

.. cpp:function:: void operator+=(StaticMatrix const& that)

   Redefines ``this`` to be the sum of ``*this`` and ``that``.

   :param that: the matrix to add to ``this``.

   :returns: (None)

   :throws:
      if the implementation of the semiring plus throws.

   :complexity:
      :math:`O(mn)` where :math:`m` is :cpp:any:`StaticMatrix::number_of_rows`
      and :math:`m` is :cpp:any:`StaticMatrix::number_of_cols`

   .. warning::
      The matrices must be of the same dimensions, although this is not
      verified by the implementation.

.. cpp:function:: void operator+=(RowView const& that)

   Redefines ``this`` to be the sum of ``*this`` and ``that``.

   :param that: the matrix to add to ``this``.

   :returns: (None)

   :throws:
      if the implementation of the semiring plus throws.

   :complexity:
      :math:`O(mn)` where :math:`m` is :cpp:any:`StaticMatrix::number_of_rows`
      and :math:`m` is :cpp:any:`StaticMatrix::number_of_cols`

   .. warning::
      This function only works if ``this`` has a single row, i.e. the template
      parameter ``R`` is ``1``.

.. cpp:function:: void operator+=(scalar const a)

   Adds a scalar to every entry of the matrix in-place.

   :param a: the scalar to add to ``this``.

   :returns: (None)

   :throws:
      if the implementation of the semiring plus throws.

   :complexity:
      :math:`O(mn)` where :math:`m` is :cpp:any:`StaticMatrix::number_of_rows`
      and :math:`m` is :cpp:any:`StaticMatrix::number_of_cols`

   .. warning::
      This function only works if ``this`` has a single row, i.e. the template
      parameter ``R`` is ``1``.