Skip to content

Commit

Permalink
Remove typos and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasChollet committed Oct 11, 2021
1 parent 97e1a20 commit 9a5b962
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
8 changes: 4 additions & 4 deletions include/cotila/matrix/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ constexpr matrix<detail::remove_complex_t<T>, N, M> abs(const matrix<T, N, M> &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.
Expand All @@ -78,7 +78,7 @@ template <typename T, std::size_t N, std::size_t M> 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.
Expand All @@ -88,7 +88,7 @@ template <typename T, std::size_t N, std::size_t M> 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.
Expand Down Expand Up @@ -326,7 +326,7 @@ constexpr T trace(const matrix<T, M, M> &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.
Expand Down
8 changes: 4 additions & 4 deletions include/cotila/matrix/operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ constexpr matrix<T, N, M> operator+(T a, const matrix<T, N, M> &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 <typename T, std::size_t N, std::size_t M>
constexpr matrix<T, N, M> operator+(const matrix<T, N, M> &a,
Expand All @@ -83,7 +83,7 @@ constexpr matrix<T, N, M> operator+(const matrix<T, N, M> &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 <typename T, std::size_t N, std::size_t M>
constexpr matrix<T, N, M> operator*(const matrix<T, N, M> &m, T a) {
Expand All @@ -95,7 +95,7 @@ constexpr matrix<T, N, M> operator*(const matrix<T, N, M> &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 <typename T, std::size_t N, std::size_t M>
constexpr matrix<T, N, M> operator*(T a, const matrix<T, N, M> &m) {
Expand All @@ -107,7 +107,7 @@ constexpr matrix<T, N, M> operator*(T a, const matrix<T, N, M> &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 <typename T, std::size_t N, std::size_t M>
constexpr matrix<T, N, M> operator*(const matrix<T, N, M> &a,
Expand Down
8 changes: 4 additions & 4 deletions include/cotila/matrix/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -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$
Expand Down Expand Up @@ -119,10 +119,10 @@ constexpr matrix<T, N, M> 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.
*/
Expand Down
7 changes: 7 additions & 0 deletions include/cotila/vector/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ struct matrix;
template <typename T, std::size_t N, typename Container>
constexpr matrix<T, N, 1> 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 <typename T, std::size_t N>
struct vector : public matrix<T, N, 1> {
constexpr vector() = default;
Expand Down

0 comments on commit 9a5b962

Please sign in to comment.