Loading...
Searching...
No Matches
Translate.h
1/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2 * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3 * Author(s): Siargey Kachanovich
4 *
5 * Copyright (C) 2019 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
11#ifndef FUNCTIONS_TRANSLATE_H_
12#define FUNCTIONS_TRANSLATE_H_
13
14#include <cstdlib> // for std::size_t
15
16#include <Eigen/Dense>
17
18namespace Gudhi {
19
20namespace coxeter_triangulation {
21
30template <class Function_>
31struct Translate {
36 Eigen::VectorXd operator()(const Eigen::VectorXd& p) const {
37 Eigen::VectorXd result = fun_(p - off_);
38 return result;
39 }
40
42 std::size_t amb_d() const { return fun_.amb_d(); }
43
45 std::size_t cod_d() const { return fun_.cod_d(); }
46
48 Eigen::VectorXd seed() const {
49 Eigen::VectorXd result = fun_.seed();
50 result += off_;
51 return result;
52 }
53
61 Translate(const Function_& function, const Eigen::VectorXd& off) : fun_(function), off_(off) {}
62
63 private:
64 Function_ fun_;
65 Eigen::VectorXd off_;
66};
67
80template <class Function_>
81Translate<Function_> translate(const Function_& function, Eigen::VectorXd off) {
82 return Translate<Function_>(function, off);
83}
84
85} // namespace coxeter_triangulation
86
87} // namespace Gudhi
88
89#endif
Translate< Function_ > translate(const Function_ &function, Eigen::VectorXd off)
Static constructor of a translated function.
Definition: Translate.h:81
Translates the zero-set of the function by a vector. The underlying function corresponds to f(x-off),...
Definition: Translate.h:31
std::size_t amb_d() const
Returns the domain (ambient) dimension.
Definition: Translate.h:42
Translate(const Function_ &function, const Eigen::VectorXd &off)
Constructor of the translated function.
Definition: Translate.h:61
Eigen::VectorXd seed() const
Returns a point on the zero-set.
Definition: Translate.h:48
std::size_t cod_d() const
Returns the codomain dimension.
Definition: Translate.h:45
Eigen::VectorXd operator()(const Eigen::VectorXd &p) const
Value of the function at a specified point.
Definition: Translate.h:36