# row_basis¶

This page contains details of the function templates for finding the row basis of certain types of matrix in the namespace matrix_helper.

template<typename Mat, typename Container, typename = std::enable_if_t<IsMatrix<Mat>>>
void row_basis(Mat const &x, Container &result)

Appends a basis (consisting of row views) for the row space of the matrix x to the container result.

Template Parameters
• Mat – a type such that the value of IsMatrix is true.

• Container – a container type (such as std::vector, for example).

Parameters
• x – the matrix.

• result – the container to append the basis to the row space to.

Returns

(None)

Exceptions

This function guarantees not to throw a LibsemigroupsException.

Complexity

$$O(r ^ 2 c)$$ where $$r$$ is the number of rows in x and $$c$$ is the number of columns in x.

template<typename Mat, typename = std::enable_if_t<IsDynamicMatrix<Mat>>>
std::vector<typename Mat::RowView> row_basis(Mat const &x)

Returns a vector (consisting of row views) that is a basis for the row space of the non-static matrix x.

Template Parameters

Mat – a type such that the value of IsDynamicMatrix is true.

Parameters

x – the matrix.

Returns

A std::vector of Mat::RowView.

Exceptions

This function guarantees not to throw a LibsemigroupsException.

Complexity

$$O(r ^ 2 c)$$ where $$r$$ is the number of rows in x and $$c$$ is the number of columns in x.

template<typename Mat, typename = std::enable_if_t<IsStaticMatrix<Mat>>>
detail::StaticVector1<typename Mat::RowView, Mat::nr_rows> row_basis(Mat const &x)

Returns a static vector (consisting of row views) that is a basis for the row space of the static matrix x.

Template Parameters

Mat – a type such that the value of IsStaticMatrix is true.

Parameters

x – the matrix.

Returns

A static vector of Mat::RowView.

Exceptions

This function guarantees not to throw a LibsemigroupsException.

Complexity

$$O(r ^ 2 c)$$ where $$r$$ is the number of rows in x and $$c$$ is the number of columns in x.

template<typename Mat, typename Container>
void row_basis(Container &views, Container &result)

Appends a basis for the space spanned by the row views or bit sets in views to the container result.

Template Parameters
• Mat – a type such that the value of IsMaxPlusTruncMat<Mat> or IsBMat<Mat> is true.

• Container – a container type (such as std::vector, for example). The Container::value_type must be Mat::RowView, or if Mat is BMat<N> for some N, then Container::value_type can additionally be BitSet<M> or std::bitset<M> where M is greater than or equal to N.

Parameters
• views – container of spanning row views or bit sets

• result – container for the resulting row basis

Returns

(None)

Exceptions

This function guarantees not to throw a LibsemigroupsException.

Complexity

$$O(r ^ 2 c)$$ where $$r$$ is the size of views and $$c$$ is the size of each row view or bit set in views.