From fcf407184eed831cd271e013705f933fe5f123e4 Mon Sep 17 00:00:00 2001 From: Yihua Liu Date: Sat, 6 Jan 2024 00:35:09 +0800 Subject: [PATCH] doc: fix tensor_index.adoc Correct the example code Correct the template parameters Correct function prototype of operator() of tensor_core Correct links to HTML to AsciiDoc --- doc/ublas/tensor.adoc | 6 ++--- doc/ublas/tensor/tensor_expression.adoc | 2 +- doc/ublas/tensor/tensor_index.adoc | 23 ++++++++----------- include/boost/numeric/ublas/tensor/index.hpp | 2 +- .../ublas/tensor/tensor/tensor_dynamic.hpp | 2 +- .../ublas/tensor/tensor/tensor_static.hpp | 2 +- .../tensor/tensor/tensor_static_rank.hpp | 2 +- 7 files changed, 18 insertions(+), 21 deletions(-) diff --git a/doc/ublas/tensor.adoc b/doc/ublas/tensor.adoc index 43d0656bf..0657d5332 100644 --- a/doc/ublas/tensor.adoc +++ b/doc/ublas/tensor.adoc @@ -292,10 +292,10 @@ elements. If `sizeof...(is)==0`, `tensor::operator[i]` is called. |=== |Member function |Description -|`template tensor_index operator()(indices::Index p, index_types ... ps)` -|Returns a link:tensor/tensor_index.html[tensor index] instance with +|`template decltype(auto) operator()(index::index_type p, index_types ... ps) const` +|Returns a link:tensor/tensor_index.adoc[tensor index] instance with index objects `(p,ps...)` for a tensor contraction where -`sizeof...(ps)+1` must be equal to `tensor::order()`. +`sizeof...(ps) + 1` must be equal to `tensor::order()`. |=== ===== vi. [#tensor_16]#Iterators# diff --git a/doc/ublas/tensor/tensor_expression.adoc b/doc/ublas/tensor/tensor_expression.adoc index 7971dcc24..1402e50b9 100644 --- a/doc/ublas/tensor/tensor_expression.adoc +++ b/doc/ublas/tensor/tensor_expression.adoc @@ -6,7 +6,7 @@ ==== Description -The templated class `tensor_expression` is required to be a public +The templated class `tensor_expression` is required to be a public base of all classes. There is no Tensor Expression concept defined. ==== Definition diff --git a/doc/ublas/tensor/tensor_index.adoc b/doc/ublas/tensor/tensor_index.adoc index b8e9198af..d6177e0f5 100644 --- a/doc/ublas/tensor/tensor_index.adoc +++ b/doc/ublas/tensor/tensor_index.adoc @@ -2,32 +2,32 @@ [[toc]] -=== [#tensor index]#tensor_index# +=== [#tensor index]#Tensor Index# ==== Description -The template class `tensor_index` decorates the -link:../tensor.html#tensor[tensor] template class with indices for +The template class `index_type` decorates the +link:../tensor.adoc[tensor] template class with indices for tensor contraction. ==== Example [source, cpp] .... -#include +#include int main () { using namespace boost::numeric::ublas; - shape s{4,3,2}; - for (auto i = 0u; i < s.size(); ++i) { - std::cout << s.at(i) << std::endl; - } + using namespace boost::numeric::ublas::index; + tensor A = tensor{4, 3, 2}; + tensor B = A(_i, _j, _) * A(_, _j, _k); + std::cout << B << '\n'; } .... ==== Definition -Defined in the header tensor/tensor_einstein.hpp. +Defined in the header tensor/index.hpp. ==== Public base classes @@ -38,10 +38,7 @@ None. [cols=",,",] |=== |Parameter |Description | -|`value_t` |The type of object stored in the tensor. | -|`format_t` |Storage organization of the tensor. | -|`storage_t` |The type of the storage array of the tensor. | -|`N` |Number of indices provided. | +|`I` |Integer for einstein summation notation. | |=== ''''' diff --git a/include/boost/numeric/ublas/tensor/index.hpp b/include/boost/numeric/ublas/tensor/index.hpp index f13872ceb..221c6f8ea 100644 --- a/include/boost/numeric/ublas/tensor/index.hpp +++ b/include/boost/numeric/ublas/tensor/index.hpp @@ -21,7 +21,7 @@ namespace boost::numeric::ublas::index { /** @brief Proxy template class for the einstein summation notation * - * @note index::index_type for 0<=K<=16 is used in tensor::operator() + * @note index::index_type for 0<=K<=26 is used in tensor::operator() * * @tparam I wrapped integer */ diff --git a/include/boost/numeric/ublas/tensor/tensor/tensor_dynamic.hpp b/include/boost/numeric/ublas/tensor/tensor/tensor_dynamic.hpp index ec27296a6..2a9813e33 100644 --- a/include/boost/numeric/ublas/tensor/tensor/tensor_dynamic.hpp +++ b/include/boost/numeric/ublas/tensor/tensor/tensor_dynamic.hpp @@ -398,7 +398,7 @@ template /** @brief Generates a tensor_core index for tensor_core contraction * * - * @code auto Ai = A(_i,_j,k); @endcode + * @code auto Ai = A(_i,_j,_k); @endcode * * @param i placeholder * @param is zero-based indices where 0 <= is[r] < this->size(r) where 0 < r < this->rank() diff --git a/include/boost/numeric/ublas/tensor/tensor/tensor_static.hpp b/include/boost/numeric/ublas/tensor/tensor/tensor_static.hpp index 644ed9c51..d381ca1f8 100644 --- a/include/boost/numeric/ublas/tensor/tensor/tensor_static.hpp +++ b/include/boost/numeric/ublas/tensor/tensor/tensor_static.hpp @@ -367,7 +367,7 @@ class tensor_core> /** @brief Generates a tensor_core index for tensor_core contraction * * - * @code auto Ai = A(_i,_j,k); @endcode + * @code auto Ai = A(_i,_j,_k); @endcode * * @param i placeholder * @param is zero-based indices where 0 <= is[r] < this->size(r) where 0 < r < this->rank() diff --git a/include/boost/numeric/ublas/tensor/tensor/tensor_static_rank.hpp b/include/boost/numeric/ublas/tensor/tensor/tensor_static_rank.hpp index fbb5074db..183c636a3 100644 --- a/include/boost/numeric/ublas/tensor/tensor/tensor_static_rank.hpp +++ b/include/boost/numeric/ublas/tensor/tensor/tensor_static_rank.hpp @@ -382,7 +382,7 @@ template /** @brief Generates a tensor_core index for tensor_core contraction * * - * @code auto Ai = A(_i,_j,k); @endcode + * @code auto Ai = A(_i,_j,_k); @endcode * * @param i placeholder * @param is zero-based indices where 0 <= is[r] < this->size(r) where 0 < r < this->rank()