From 7db73dca54afe567525006fb3016f6e7e417ba96 Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Tue, 15 Feb 2022 18:59:42 +0530 Subject: [PATCH 1/2] Documentation for special functions of tensors added --- doc/ublas/tensor/special_functions.adoc | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 doc/ublas/tensor/special_functions.adoc diff --git a/doc/ublas/tensor/special_functions.adoc b/doc/ublas/tensor/special_functions.adoc new file mode 100644 index 000000000..b32864108 --- /dev/null +++ b/doc/ublas/tensor/special_functions.adoc @@ -0,0 +1,31 @@ +== Special Functions + + +=== [#Special Functions]#Special Functions used in tensor with their description# + +==== Description + +* The following free tensor functions are implemented in link:https://github.com/boostorg/ublas/blob/master/include/boost/numeric/ublas/tensor/functions.hpp[functions.hpp] +* Internally they call generic functions, defined in link:https://github.com/boostorg/ublas/blob/master/include/boost/numeric/ublas/tensor/multiplication.hpp[multiplication.hpp] +and link:https://github.com/boostorg/ublas/blob/master/include/boost/numeric/ublas/tensor/algorithms.hpp[algorithms.hpp],that are implemented in terms of pointers, strides and offsets. +* Note that the functions are evaluated immediately and no expression object is +generated and that you can combine entrywise and compare operations as well as computed assignments with these free functions. + +==== Special functions and their examples + +[cols=",,",] +|=== +| Operations | Operators | Example +| Tensor Transposition | `trans()` |`auto Z = trans(X,{4,3,2})` +|k-mode Tensor-Times-Vector | `prod()` |`auto Z = prod(X,v,2);` +|k-mode Tensor-Times-Matrix | `prod()` |`auto Z = prod(X,A,2);` +|Tensor-Times-Tensor | `prod()` |`auto Z = prod(X,Y,{1,3});`, `auto Z =prod(X,Y,\{1,3},\{4,2});` +| Inner Product | `inner_prod()` |`auto a = inner_prod(X,Y);` +| Outer Product | `outer_prod()` |`auto Z = outer_prod(X,Y);` +| Frobenius Norm | `norm()` |`auto a = norm(X);` +|Extract Real Values | `real()` |`auto Y = real(X);`| +| Extract Imaginary Values | `imag()` |`auto Y = imag(X);` +| Compute Complex Conjugate | `conj()` |`auto Y = conj(X);` +|=== +Examples for the usage of special functions are given in the example file +link:https://github.com/boostorg/ublas/blob/master/examples/tensor/prod_expressions.cpp[prod_expressions.cpp] From 5b9216d9b4839a79c89eb7d2f04bf1b12c17b7e4 Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Tue, 15 Feb 2022 19:25:41 +0530 Subject: [PATCH 2/2] Documentation for special functions of tensors added --- doc/ublas/tensor/special_functions.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ublas/tensor/special_functions.adoc b/doc/ublas/tensor/special_functions.adoc index b32864108..59948a3d3 100644 --- a/doc/ublas/tensor/special_functions.adoc +++ b/doc/ublas/tensor/special_functions.adoc @@ -23,7 +23,7 @@ generated and that you can combine entrywise and compare operations as well as c | Inner Product | `inner_prod()` |`auto a = inner_prod(X,Y);` | Outer Product | `outer_prod()` |`auto Z = outer_prod(X,Y);` | Frobenius Norm | `norm()` |`auto a = norm(X);` -|Extract Real Values | `real()` |`auto Y = real(X);`| +|Extract Real Values | `real()` |`auto Y = real(X);` | Extract Imaginary Values | `imag()` |`auto Y = imag(X);` | Compute Complex Conjugate | `conj()` |`auto Y = conj(X);` |===