Tensor
A C++ expression template library for computations on N dimensional tensors
tensor_operations.hpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------------------------------------
2 /// @file Header file for tensor operations for tensor library.
3 // ----------------------------------------------------------------------------------------------------------
4 
5 /*
6  * ----------------------------------------------------------------------------------------------------------
7  * Tensor is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published
9  * by the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * Tensor is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with tensor; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  * ----------------------------------------------------------------------------------------------------------
21  */
22 
23 #ifndef FTL_TENSOR_OPERATIONS_HPP
24 #define FTL_TENSOR_OPERATIONS_HPP
25 
26 #include "tensor_addition.hpp"
27 #include "tensor_subtraction.hpp"
28 
29 // Unnamed namespace so that operations are available everywhere
30 namespace {
31 
32 // ----------------------------------------------------------------------------------------------------------
33 /// @brief Adds two tensor expressions
34 /// @param[in] x The first expression to add
35 /// @param[in] y The second expression to add
36 /// @return The result of the addition of the two tensor_expressions.
37 /// @tparam E1 The type of the first expression for the addition
38 /// @tparam E2 The type of the second expression for the addition
39 /// @tparam T1 The traits of the first tensors -- for addition the traits for the returned tensor are
40 /// the same as the first tensor for additio
41 /// @tparam T2 The traits of the second expression
42 // ----------------------------------------------------------------------------------------------------------
43 template <typename E1, typename E2, typename T1, typename T2>
46 {
48 }
49 
50 // ----------------------------------------------------------------------------------------------------------
51 /// @brief Subtracts two tensor expressions
52 /// @param[in] x The first expression to subtract from
53 /// @param[in] y The second expression to subtract with
54 /// @return The result of the subtraction of the two tensor_expressions.
55 /// @tparam E1 The type of the first expression for the subtraction
56 /// @tparam E2 The type of the second expression for the subtraction
57 /// @tparam T1 The traits of the first tensors -- for subtraction the traits for the returned tensor are
58 /// the same as the first tensor for additio
59 /// @tparam T2 The traits of the second expression
60 // ----------------------------------------------------------------------------------------------------------
61 template <typename E1, typename E2, typename T1, typename T2>
64 {
66 }
67 
68 } // End unnamed namespace
69 #endif // FTL_TENSOR_OPERATIONS_HPP
Expression class for calculating the subtraction of two tensors.
Definition: tensor_subtraction.hpp:39
Expression class for calculating the addition of two tensors.
Definition: tensor_addition.hpp:39
const ftl::TensorSubtraction< E1, E2, T1, T2 > operator-(ftl::TensorExpression< E1, T1 > const &x, ftl::TensorExpression< E2, T2 > const &y)
Subtracts two tensor expressions.
Definition: tensor_operations.hpp:62
Defines a general tensor expression so that opertions on tensor expressions can be defined the syntax...
Definition: tensor_expression_interface.hpp:49
const ftl::TensorAddition< E1, E2, T1, T2 > operator+(ftl::TensorExpression< E1, T1 > const &x, ftl::TensorExpression< E2, T2 > const &y)
Adds two tensor expressions.
Definition: tensor_operations.hpp:44