diff --git a/include/cotila/matrix/math.h b/include/cotila/matrix/math.h index 2322960..003f788 100644 --- a/include/cotila/matrix/math.h +++ b/include/cotila/matrix/math.h @@ -68,7 +68,7 @@ constexpr matrix, N, M> abs(const matrix &v } /** @brief computes the sum of elements of a matrix - * @param m an \f$ M \times M \f$ matrix of type T + * @param m an \f$ N \times M \f$ matrix of type T * @return a scalar \f$ \sum\limits_{i} m_i \f$ of type T * * Computes the sum of the elements of a matrix. @@ -78,7 +78,7 @@ template constexpr T sum(const matrix } /** @brief computes the minimum valued element - * @param m an \f$ M \times M \f$ matrix of type T + * @param m an \f$ N \times M \f$ matrix of type T * @return a scalar \f$ v_i \f$ of type T where \f$ v_i \leq v_j,\ \forall j \f$ * * Computes the minimum valued element of a matrix. @@ -88,7 +88,7 @@ template constexpr T min(const matrix } /** @brief computes the maximum valued element - * @param m an \f$ M \times M \f$ matrix of type T + * @param m an \f$ N \times M \f$ matrix of type T * @return a scalar \f$ v_i \f$ of type T where \f$ v_i \geq v_j,\ \forall j \f$ * * Computes the maximum valued element of a matrix. @@ -326,7 +326,7 @@ constexpr T trace(const matrix &m) { } /** @brief computes the elementwise square root - * @param m an \f$ M \times M \f$ matrix of type T + * @param m an \f$ N \times M \f$ matrix of type T * @return an \f$ M \times N \f$ matrix of type T, the element wise * square root of \f$ \textbf{m} \f$ * Computes the elementwise square root of a matrix. diff --git a/include/cotila/matrix/operators.h b/include/cotila/matrix/operators.h index 325121b..bca22ac 100644 --- a/include/cotila/matrix/operators.h +++ b/include/cotila/matrix/operators.h @@ -70,7 +70,7 @@ constexpr matrix operator+(T a, const matrix &m) { * @param b an \f$ N \times M \f$ matrix of type T * @return \f$ \textbf{a} + \textbf{b} \f$ such that \f$ \left(\textbf{a} + \textbf{b}\right)_{ij} = \textbf{a}_{ij} + \textbf{b}_{ij} \f$ * - * Computes the vector sum. + * Computes the matrix sum. */ template constexpr matrix operator+(const matrix &a, @@ -83,7 +83,7 @@ constexpr matrix operator+(const matrix &a, * @param a a scalar of type T * @return \f$ \textbf{m}a \f$ such that \f$ \left(\textbf{m} a\right)_{ij} = \textbf{m}_{ij} a \f$ * - * Computes the sum of a matrix and a scalar. + * Computes the product of a matrix and a scalar. */ template constexpr matrix operator*(const matrix &m, T a) { @@ -95,7 +95,7 @@ constexpr matrix operator*(const matrix &m, T a) { * @param m an \f$ N \times M \f$ matrix of type T * @return \f$ a\textbf{m} \f$ such that \f$ \left(a\textbf{m}\right)_{ij} = a\textbf{m}_{ij} \f$ * - * Computes the sum of a matrix and a scalar. + * Computes the product of a matrix and a scalar. */ template constexpr matrix operator*(T a, const matrix &m) { @@ -107,7 +107,7 @@ constexpr matrix operator*(T a, const matrix &m) { * @param b an \f$ N \times M \f$ matrix of type T * @return \f$ \textbf{a} \circ \textbf{b} \f$ such that \f$ \left(\textbf{a} \circ \textbf{b}\right)_{ij} = \textbf{a}_{ij} \textbf{b}_{ij} \f$ * - * Computes the Hadamard, or elementwise, product of two vectors. + * Computes the Hadamard, or elementwise, product of two matrices. */ template constexpr matrix operator*(const matrix &a, diff --git a/include/cotila/matrix/utility.h b/include/cotila/matrix/utility.h index f4abe04..96e651c 100644 --- a/include/cotila/matrix/utility.h +++ b/include/cotila/matrix/utility.h @@ -13,7 +13,7 @@ namespace cotila { /** @brief accumulates an operation across a matrix - * @param m an \f$ M \times M \f$ matrix of type T + * @param m an \f$ N \times M \f$ matrix of type T * @param init the initial value * @param f a function of type F that operates between U and matrix elements of type T * @return \f$ f\left(f\left(\ldots f\left(\textrm{init}, \textbf{v}_1\right), \ldots\right), \textbf{v}_N \right) \f$ @@ -119,10 +119,10 @@ constexpr matrix fill(T value) { } /** @brief shifts matrix elements - * @param m an \f$ M \times M \f$ matrix of type T + * @param m an \f$ N \times M \f$ matrix of type T * @param n the amount to shift each element - * @return an N-vector of type T \f$ \textbf{v} \gg n \f$ such that - * \f$ \left(\textbf{v} \gg n\right)_i = \textbf{v}_{(i + n)\ \textrm{mod}\ N} \f$ + * @return an \f$ N \times M \f$ matrix of type T such that + * \f$ \left(\textbf{m} \gg n\right)_{ij} = \textbf{v}_{kj} with k = (i + n)\ \textrm{mod}\ N \f$ * * Rotates a matrix by shifting its elements vertically. */ diff --git a/include/cotila/vector/vector.h b/include/cotila/vector/vector.h index 3c62277..4dca372 100644 --- a/include/cotila/vector/vector.h +++ b/include/cotila/vector/vector.h @@ -19,6 +19,13 @@ struct matrix; template constexpr matrix from_initializer(Container &); +/** @brief A container representing a vector + * @tparam T scalar type to contain + * @tparam N number of rows + * + * `cotila::vector` is a container representing a vector. + * It inherits all its properties from `̀€cotila::matrix`. + */ template struct vector : public matrix { constexpr vector() = default;