basis.hpp
Go to the documentation of this file.
1 /*********************************************************************
2  * BSD 3-Clause License
3  *
4  * Copyright (c) 2020 Northwestern University
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * * Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *********************************************************************/
38 #ifndef BASIS_HPP
39 #define BASIS_HPP
40 
41 #include <armadillo>
42 
44 {
45 using arma::imat;
46 using arma::mat;
47 using arma::vec;
48 
51 class Basis
52 {
53 private:
54  template <class ModelT>
55  friend class ErgodicControl;
56 
57 public:
64  Basis(double lx, double ly, unsigned int num_basis);
65 
72  vec fourierBasis(const vec& x) const;
73 
80  mat gradFourierBasis(const vec& x) const;
81 
88  vec trajCoeff(const mat& xt) const;
89 
99  vec spatialCoeff(const vec& phi_vals, const mat& phi_grid) const;
100 
101 private:
102  double lx_, ly_; // length of domain
103  unsigned int total_basis_; // number of basis functions
104  vec lamdak_; // frequency coefficients weights
105  imat k_; // basis number
106 };
107 } // namespace ergodic_exploration
108 #endif
ergodic_exploration::Basis::gradFourierBasis
mat gradFourierBasis(const vec &x) const
Compose gradient cosine basis functions.
Definition: basis.cpp:91
ergodic_exploration::Basis::trajCoeff
vec trajCoeff(const mat &xt) const
Compose trajectory fourier coefficients.
Definition: basis.cpp:109
ergodic_exploration
Definition: basis.hpp:43
ergodic_exploration::Basis
Fourier cosine basis.
Definition: basis.hpp:51
ergodic_exploration::Basis::Basis
Basis(double lx, double ly, unsigned int num_basis)
Constructor.
Definition: basis.cpp:48
ergodic_exploration::Basis::fourierBasis
vec fourierBasis(const vec &x) const
Compose cosine basis functions given positon.
Definition: basis.cpp:79
ergodic_exploration::Basis::lx_
double lx_
Definition: basis.hpp:102
ergodic_exploration::Basis::k_
imat k_
Definition: basis.hpp:105
ergodic_exploration::Basis::lamdak_
vec lamdak_
Definition: basis.hpp:104
ergodic_exploration::Basis::spatialCoeff
vec spatialCoeff(const vec &phi_vals, const mat &phi_grid) const
Compose spatial fourier coefficients.
Definition: basis.cpp:122
ergodic_exploration::ErgodicControl
Receding horizon ergodic trajectory optimization.
Definition: ergodic_control.hpp:73
ergodic_exploration::Basis::total_basis_
unsigned int total_basis_
Definition: basis.hpp:103
ergodic_exploration::Basis::ly_
double ly_
Definition: basis.hpp:102


ergodic_exploration
Author(s): bostoncleek
autogenerated on Wed Mar 2 2022 00:17:13