.. Copyright (c) 2020, J. D. Mitchell

   Distributed under the terms of the GPL license version 3.

   The full license is in the file LICENSE, distributed with this software.

StaticMatrix static member functions
====================================

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

.. _staticmatrix_identity:
.. cpp:function:: static StaticMatrix identity()

   Construct the identity matrix.

   :parameters: (None)

   :returns: The identity matrix with ``R = C`` rows and columns.

   :exceptions:
     this function guarantees not to throw a :cpp:any:`LibsemigroupsException`.

   :complexity:
     :math:`O(n ^ 2)` where :math:`n` is the template parameter :code:`R` and
     :code:`C`.

   .. warning::
     This only works when the template parameters ``R`` and ``C`` are equal
     (i.e. for square matrices).

.. _staticmatrix_make:
.. cpp:function:: static StaticMatrix \
      make(std::initializer_list<std::initializer_list<scalar_type>> il)

   Validates the arguments, constructs a matrix and validates it.

   :param il: the values to be copied into the matrix.

   :returns: the constructed matrix if valid.

   :throws:
     :cpp:any:`LibsemigroupsException` if ``il`` does not represent a
     matrix of the correct dimensions.

   :throws:
     :cpp:any:`LibsemigroupsException` if the constructed matrix
     contains values that do not belong to the underlying semiring.

   :complexity:
     :math:`O(mn)` where :math:`m` is the number of rows and
     :math:`n` is the number of columns of the matrix.

.. cpp:function:: static StaticMatrix make(std::initializer_list<scalar_type> il)

   Constructs a row and validates it.

   :param il: the values to be copied into the row.

   :returns: the constructed row if valid.

   :throws:
     :cpp:any:`LibsemigroupsException` if the constructed row contains
     values that do not belong to the underlying semiring.

   :complexity:
     :math:`O(n)` where :math:`n` is the number of columns of the matrix.

   .. warning::

     This constructor only works for rows, i.e. when the template parameter
     :code:`R` is :code:`1`.
