Loading...
Searching...
No Matches
Translate.h
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
* Author(s): Siargey Kachanovich
*
* Copyright (C) 2019 Inria
*
* Modification(s):
* - YYYY/MM Author: Description of the modification
*/
#ifndef FUNCTIONS_TRANSLATE_H_
#define FUNCTIONS_TRANSLATE_H_
#include <cstdlib> // for std::size_t
#include <Eigen/Dense>
namespace Gudhi {
namespace coxeter_triangulation {
template <class Function_>
struct Translate {
Eigen::VectorXd operator()(const Eigen::VectorXd& p) const {
Eigen::VectorXd result = fun_(p - off_);
return result;
}
std::size_t amb_d() const { return fun_.amb_d(); }
std::size_t cod_d() const { return fun_.cod_d(); }
Eigen::VectorXd seed() const {
Eigen::VectorXd result = fun_.seed();
result += off_;
return result;
}
Translate(const Function_& function, const Eigen::VectorXd& off) : fun_(function), off_(off) {}
private:
Function_ fun_;
Eigen::VectorXd off_;
};
template <class Function_>
Translate<Function_> translate(const Function_& function, Eigen::VectorXd off) {
return Translate<Function_>(function, off);
}
} // namespace coxeter_triangulation
} // namespace Gudhi
#endif
Gudhi::coxeter_triangulation::translate
Translate< Function_ > translate(const Function_ &function, Eigen::VectorXd off)
Static constructor of a translated function.
Definition Translate.h:81
Gudhi
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14
Gudhi::coxeter_triangulation::Translate
Translates the zero-set of the function by a vector. The underlying function corresponds to f(x-off),...
Definition Translate.h:31
Gudhi::coxeter_triangulation::Translate::amb_d
std::size_t amb_d() const
Returns the domain (ambient) dimension.
Definition Translate.h:42
Gudhi::coxeter_triangulation::Translate::Translate
Translate(const Function_ &function, const Eigen::VectorXd &off)
Constructor of the translated function.
Definition Translate.h:61
Gudhi::coxeter_triangulation::Translate::seed
Eigen::VectorXd seed() const
Returns a point on the zero-set.
Definition Translate.h:48
Gudhi::coxeter_triangulation::Translate::cod_d
std::size_t cod_d() const
Returns the codomain dimension.
Definition Translate.h:45
Gudhi::coxeter_triangulation::Translate::operator()
Eigen::VectorXd operator()(const Eigen::VectorXd &p) const
Value of the function at a specified point.
Definition Translate.h:36