Loading...
Searching...
No Matches
Function_Sm_in_Rd.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_FUNCTION_SM_IN_RD_H_
12#define FUNCTIONS_FUNCTION_SM_IN_RD_H_
13
14#include <cstdlib> // for std::size_t
15
16#include <Eigen/Dense>
17
18namespace Gudhi {
19
20namespace coxeter_triangulation {
21
31 Eigen::VectorXd operator()(const Eigen::VectorXd& p) const {
32 Eigen::VectorXd x = p;
33 for (std::size_t i = 0; i < d_; ++i) x(i) -= center_[i];
34 Eigen::VectorXd result = Eigen::VectorXd::Zero(k_);
35 for (std::size_t i = 0; i < m_ + 1; ++i) result(0) += x(i) * x(i);
36 result(0) -= r_ * r_;
37 for (std::size_t j = 1; j < k_; ++j) result(j) = x(m_ + j);
38 return result;
39 }
40
42 std::size_t amb_d() const { return d_; };
43
45 std::size_t cod_d() const { return k_; };
46
48 Eigen::VectorXd seed() const {
49 Eigen::VectorXd result = Eigen::VectorXd::Zero(d_);
50 result(0) += r_;
51 for (std::size_t i = 0; i < d_; ++i) result(i) += center_[i];
52 return result;
53 }
54
64 Function_Sm_in_Rd(double r, std::size_t m, std::size_t d, Eigen::VectorXd center)
65 : m_(m), k_(d - m), d_(d), r_(r), center_(center) {}
66
75 Function_Sm_in_Rd(double r, std::size_t m, std::size_t d)
76 : m_(m), k_(d - m), d_(d), r_(r), center_(Eigen::VectorXd::Zero(d_)) {}
77
86 Function_Sm_in_Rd(double r, std::size_t m, Eigen::VectorXd center)
87 : m_(m), k_(1), d_(m_ + 1), r_(r), center_(center) {}
88
96 Function_Sm_in_Rd(double r, std::size_t m) : m_(m), k_(1), d_(m_ + 1), r_(r), center_(Eigen::VectorXd::Zero(d_)) {}
97
98 Function_Sm_in_Rd(const Function_Sm_in_Rd& rhs) : Function_Sm_in_Rd(rhs.r_, rhs.m_, rhs.d_, rhs.center_) {}
99
100 private:
101 std::size_t m_, k_, d_;
102 double r_;
103 Eigen::VectorXd center_;
104};
105
106} // namespace coxeter_triangulation
107
108} // namespace Gudhi
109
110#endif
A class for the function that defines an m-dimensional implicit sphere embedded in the d-dimensional ...
Definition: Function_Sm_in_Rd.h:27
Function_Sm_in_Rd(double r, std::size_t m, std::size_t d)
Constructor of the function that defines an m-dimensional implicit sphere embedded in the d-dimension...
Definition: Function_Sm_in_Rd.h:75
std::size_t cod_d() const
Returns the codomain dimension. Same as the codimension of the sphere.
Definition: Function_Sm_in_Rd.h:45
Function_Sm_in_Rd(double r, std::size_t m, std::size_t d, Eigen::VectorXd center)
Constructor of the function that defines an m-dimensional implicit sphere embedded in the d-dimension...
Definition: Function_Sm_in_Rd.h:64
Function_Sm_in_Rd(double r, std::size_t m, Eigen::VectorXd center)
Constructor of the function that defines an m-dimensional implicit sphere embedded in the (m+1)-dimen...
Definition: Function_Sm_in_Rd.h:86
std::size_t amb_d() const
Returns the domain dimension. Same as the ambient dimension of the sphere.
Definition: Function_Sm_in_Rd.h:42
Eigen::VectorXd seed() const
Returns a point on the sphere.
Definition: Function_Sm_in_Rd.h:48
Function_Sm_in_Rd(double r, std::size_t m)
Constructor of the function that defines an m-dimensional implicit sphere embedded in the (m+1)-dimen...
Definition: Function_Sm_in_Rd.h:96
Eigen::VectorXd operator()(const Eigen::VectorXd &p) const
Value of the function at a specified point.
Definition: Function_Sm_in_Rd.h:31