TensorProduct.hpp
Go to the documentation of this file.
2 // See LICENSE.txt for details.
3
4 /// \file
5 /// Defines a tensor product of one-dimensional MathFunctions
6
7 #pragma once
8
9 #include <array>
10 #include <cstddef>
11 #include <memory>
12
14
15 /// \cond
16 template <size_t Dim>
17 class MathFunction;
18 /// \endcond
19
20 namespace MathFunctions {
21
22 /// \ingroup MathFunctionsGroup
23 /// \brief a tensor product of one-dimensional MathFunctions
24 template <size_t Dim>
26  public:
27  TensorProduct(double scale,
28  std::array<std::unique_ptr<MathFunction<1>>, Dim>&& functions);
29
30  TensorProduct(const TensorProduct&) = delete;
31  TensorProduct(TensorProduct&&) = default;
32  TensorProduct& operator=(const TensorProduct&) = delete;
33  TensorProduct& operator=(TensorProduct&&) = default;
34  ~TensorProduct() = default;
35
36  /// The value of the function
37  template <typename T>
38  Scalar<T> operator()(const tnsr::I<T, Dim>& x) const noexcept;
39
40  /// The partial derivatives of the function
41  template <typename T>
42  tnsr::i<T, Dim> first_derivatives(const tnsr::I<T, Dim>& x) const noexcept;
43
44  /// The second partial derivatives of the function
45  template <typename T>
46  tnsr::ii<T, Dim> second_derivatives(const tnsr::I<T, Dim>& x) const noexcept;
47
48  private:
49  double scale_{1.0};
51 };
52 } // namespace MathFunctions
a tensor product of one-dimensional MathFunctions
Definition: TensorProduct.hpp:25
tnsr::ii< T, Dim > second_derivatives(const tnsr::I< T, Dim > &x) const noexcept
The second partial derivatives of the function.
Definition: TensorProduct.cpp:50
Definition: MathFunction.hpp:27
Definition: MathFunction.hpp:35
Holds classes implementing MathFunction (functions ).
Definition: Gaussian.cpp:11
Scalar< T > operator()(const tnsr::I< T, Dim > &x) const noexcept
The value of the function.
Definition: TensorProduct.cpp:22
Defines a list of useful type aliases for tensors.
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
tnsr::i< T, Dim > first_derivatives(const tnsr::I< T, Dim > &x) const noexcept
The partial derivatives of the function.
Definition: TensorProduct.cpp:33