matrix/utility.hpp
Go to the documentation of this file.
55 constexpr matrix<U, N, M> elementwise(F f, const matrix<T, N, M> &m, const Matrices &...matrices) {
133 return generate<M * Row, N * Col>([&m](std::size_t i, std::size_t j) { return m[i % M][j % N]; });
constexpr matrix< T, M+N, P > vertcat(const matrix< T, M, P > &a, const matrix< T, N, P > &b)
vertically concatenates two matrices
Definition: matrix/utility.hpp:202
constexpr matrix< T, M, N > swapcol(matrix< T, M, N > m, std::size_t a, std::size_t b)
swaps columns of a matrix
Definition: matrix/utility.hpp:167
constexpr decltype(auto) generate(F &&f)
generates a matrix as a function of its indices
Definition: matrix/utility.hpp:84
constexpr matrix< T, M, N+P > horzcat(const matrix< T, M, N > &a, const matrix< T, M, P > &b)
horizontally concatenates two matrices
Definition: matrix/utility.hpp:186
constexpr matrix< T, N, N > get_identity()
Definition: matrix/utility.hpp:116
constexpr matrix< T, P, Q > reshape(const matrix< T, M, N > &m)
reshapes a matrix
Definition: matrix/utility.hpp:230
constexpr matrix< U, N, M > elementwise(F f, const matrix< T, N, M > &m, const Matrices &...matrices)
applies a function elementwise between many matrices
Definition: matrix/utility.hpp:55
constexpr matrix< T, N, M > fill(T value)
generates a matrix containing a single value
Definition: matrix/utility.hpp:102
constexpr matrix< T, M, N > swaprow(matrix< T, M, N > m, std::size_t a, std::size_t b)
swaps rows of a matrix
Definition: matrix/utility.hpp:147
constexpr matrix< T, M *Row, N *Col > repmat(const matrix< T, M, N > &m)
repeats a matrix
Definition: matrix/utility.hpp:132
constexpr matrix< T, N, 1 > as_column(const vector< T, N > &v)
converts a vector into a column vector
Definition: matrix/utility.hpp:243
constexpr matrix< T, 1, N > as_row(const vector< T, N > &v)
converts a vector into a row vector
Definition: matrix/utility.hpp:254
constexpr matrix< T, P, Q > submat(const matrix< T, M, N > &m, std::size_t a, std::size_t b)
extracts the submatrix of a matrix
Definition: matrix/utility.hpp:217
constexpr matrix< T, N, M > cast(const matrix< U, N, M > &m)
casts a vector to another type
Definition: matrix/utility.hpp:72
const matrix< T, N, N > identity
the matrix identity
Definition: matrix/utility.hpp:111
Definition: pair.hpp:31