Loading...
Searching...
No Matches
Negation.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_NEGATION_H_
12#define FUNCTIONS_NEGATION_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 Negation {
36 Eigen::VectorXd operator()(const Eigen::VectorXd& p) const {
37 Eigen::VectorXd result = -fun_(p);
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 return result;
51 }
52
58 Negation(const Function_& function) : fun_(function) {}
59
60 private:
61 Function_ fun_;
62};
63
75template <class Function_>
76Negation<Function_> negation(const Function_& function) {
77 return Negation<Function_>(function);
78}
79
80} // namespace coxeter_triangulation
81
82} // namespace Gudhi
83
84#endif
Negation< Function_ > negation(const Function_ &function)
Static constructor of the negative function.
Definition: Negation.h:76
Constructs the "minus" function. The zero-set is the same, but the values at other points are the neg...
Definition: Negation.h:31
Eigen::VectorXd operator()(const Eigen::VectorXd &p) const
Value of the function at a specified point.
Definition: Negation.h:36
Negation(const Function_ &function)
Constructor of the negative function.
Definition: Negation.h:58
std::size_t cod_d() const
Returns the codomain dimension.
Definition: Negation.h:45
std::size_t amb_d() const
Returns the domain (ambient) dimension.
Definition: Negation.h:42
Eigen::VectorXd seed() const
Returns a point on the zero-set.
Definition: Negation.h:48