From 5b3c367926bf0e55cb2ec5359605349909f9f7e4 Mon Sep 17 00:00:00 2001 From: "Lee.Deokjae" Date: Sat, 6 Jan 2018 14:36:19 +0900 Subject: Fix typos in the contraction example of tensor README --- unsupported/Eigen/CXX11/src/Tensor/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/README.md') diff --git a/unsupported/Eigen/CXX11/src/Tensor/README.md b/unsupported/Eigen/CXX11/src/Tensor/README.md index 30d553af7..49cc33c5d 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/README.md +++ b/unsupported/Eigen/CXX11/src/Tensor/README.md @@ -1013,23 +1013,23 @@ multidimensional case. Eigen::Tensor a(2, 3); a.setValues({{1, 2, 3}, {6, 5, 4}}); Eigen::Tensor b(3, 2); - a.setValues({{1, 2}, {4, 5}, {5, 6}}); + b.setValues({{1, 2}, {4, 5}, {5, 6}}); // Compute the traditional matrix product - Eigen::array, 1> product_dims = { Eigen::IndexPair(1, 0) }; + Eigen::array, 1> product_dims = { Eigen::IndexPair(1, 0) }; Eigen::Tensor AB = a.contract(b, product_dims); // Compute the product of the transpose of the matrices - Eigen::array, 1> transpose_product_dims = { Eigen::IndexPair(0, 1) }; + Eigen::array, 1> transposed_product_dims = { Eigen::IndexPair(0, 1) }; Eigen::Tensor AtBt = a.contract(b, transposed_product_dims); - - // Contraction to scalar value using a ouble contraction - // First coordinate of both tensors are contracted as well as both second coordinates + + // Contraction to scalar value using a double contraction. + // First coordinate of both tensors are contracted as well as both second coordinates, i.e., this computes the sum of the squares of the elements. Eigen::array, 2> double_contraction_product_dims = { Eigen::IndexPair(0, 0), Eigen::IndexPair(1, 1) }; - Eigen::Tensor AdoubleontractedA = a.contract(a, double_contraction_product_dims); - + Eigen::Tensor AdoubleContractedA = a.contract(a, double_contraction_product_dims); + // Extracting the scalar value of the tensor contraction for further usage - int value = AdoublecontractedA(0); + int value = AdoubleContractedA(0); ## Reduction Operations -- cgit v1.2.3