Controlpp
Loading...
Searching...
No Matches
math.hpp File Reference
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <cstdint>

Go to the source code of this file.

Namespaces

namespace  controlpp
 The main namespace for the Control++ library.
 

Functions

template<class T >
constexpr T controlpp::product_over (T from, T to)
 Calculates the product of all numbers in the closed open range [from, to)
 
template<class T >
constexpr T controlpp::pow (const T &base, const int &exp)
 Power function for integral exponents.
 
template<class T , int N>
Eigen::Vector< T, N > controlpp::unwrap (const Eigen::Vector< T, N > &y, const T &modulo)
 Unwinds modulo jumps.
 
template<class T , int N>
Eigen::Vector< T, N > controlpp::unwrap_rad (const Eigen::Vector< T, N > &phases)
 Unwinds phase jumps of \(2 \pi\) in radiants.
 
template<class T , int N>
Eigen::Vector< T, N > controlpp::unwrap_deg (const Eigen::Vector< T, N > &phases)
 Unwinds phase jumps of \(2 \pi\) in degrees.
 
template<class T = double>
constexpr T controlpp::pade_param_reccursice (T P_k, std::int32_t m, std::int32_t n, std::int32_t k)
 Calculates the next pade parameter recursively.
 
template<class T = double>
constexpr void controlpp::pade_params (T *params, std::size_t size, std::uint32_t m, std::uint32_t n)
 Calculates all pade parameters up to the given size.
 
template<class T = double>
constexpr T controlpp::pade_num_param (std::int32_t m, std::int32_t n, std::int32_t k)
 Calculates the numerator parameters of the pade approximation.
 
template<class T = double>
constexpr T controlpp::pade_den_param (unsigned long m, unsigned long n, unsigned long k)
 Calculates the numerator parameters of the pade approximation.
 
template<class T , int Rows, int Cols, int Options, int MaxRows, int MaxCols>
Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > controlpp::identity_like (const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > &unused)
 
template<class T , int LSize, int RSize>
Eigen::Matrix< T, LSize+RSize, LSize+RSize > controlpp::join_to_diagonal (const Eigen::Vector< T, LSize > &l, const Eigen::Vector< T, RSize > &r)
 
template<class T , int LSize, int RSize>
requires (LSize != Eigen::Dynamic && RSize != Eigen::Dynamic)
Eigen::Vector< T, LSize+RSize > controlpp::join_to_vector (const Eigen::Vector< T, LSize > &l, const Eigen::Vector< T, RSize > &r)
 
template<class T , int LSize, int RSize>
requires (!(LSize != Eigen::Dynamic && RSize != Eigen::Dynamic))
Eigen::Vector< T, Eigen::Dynamic > controlpp::join_to_vector (const Eigen::Vector< T, LSize > &l, const Eigen::Vector< T, RSize > &r)
 
template<class T , int Rows, int Cols, int Options, int MaxRows, int MaxCols>
Eigen::Matrix< T, Rows-1, Cols-1 > controlpp::minor (const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > &A, size_t ex_row, size_t ex_col)
 returns the minor matrix excluding the provided column and row
 
template<class T , int Rows, int Cols, int Options, int MaxRows, int MaxCols>
Eigen::Matrix< T, Rows, Cols > controlpp::adj (const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > &A)
 
template<class T , int N>
Eigen::Matrix< T, N-1, N-1 > controlpp::companion (const Eigen::Vector< T, N > &v)
 Creates a companion matrix from a vector.
 
template<class T , int N>
requires (N % 2 == 0)
Eigen::Matrix< T, N/2, N/2 > controlpp::hamilton_solver (const Eigen::Matrix< T, N, N > H)
 Solves the hamilton matrix.
 
template<class T , int N>
Eigen::Matrix< T, N/2, N/2 > controlpp::symplectic_solver (const Eigen::Matrix< T, N, N > S)
 Solves the hamilton matrix.
 
template<class T , int NStates, int AOpt, int AMaxR, int AMaxC, int QOpt, int QMaxR, int QMaxC>
Eigen::Matrix< T, NStates, NStates > controlpp::lyapunov_solver (const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > &A, const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > &Q)
 Solves the continuous time Lyapunov equation.
 
template<class ValueType , int NStates, int NInputs, int NOutputs>
std::tuple< Eigen::Matrix< ValueType, NStates, NStates >, Eigen::Matrix< ValueType, NStates, NStates > > controlpp::energy_scaling_matrix (const Eigen::Matrix< ValueType, NStates, NStates > A, const Eigen::Matrix< ValueType, NStates, NInputs > B, const Eigen::Matrix< ValueType, NOutputs, NStates > C)
 Calculates the energy (Gramian) scaling via Lyapunov equations.
 
template<class T , int NStates, int NInputs, int AOpt, int AMaxR, int AMaxC, int BOpt, int BMaxR, int BMaxC, int ROpt, int RMaxR, int RMaxC, int QOpt, int QMaxR, int QMaxC>
Eigen::Matrix< T, NStates, NStates > controlpp::care_solver (const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > &A, const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > &B, const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > &Q, const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > &R)
 Solves the continuous time riccati equation (CARE)
 
template<class T , int NStates, int NInputs, int AOpt, int AMaxR, int AMaxC, int BOpt, int BMaxR, int BMaxC, int ROpt, int RMaxR, int RMaxC, int QOpt, int QMaxR, int QMaxC>
Eigen::Matrix< T, NStates, NStates > controlpp::dare_solver (const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > &A, const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > &B, const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > &Q, const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > &R)
 Solves the discrete time riccati equation (DARE)
 
template<class T , int NStates, int NInputs, int AOpt, int AMaxR, int AMaxC, int BOpt, int BMaxR, int BMaxC, int ROpt, int RMaxR, int RMaxC, int QOpt, int QMaxR, int QMaxC, int NOpt, int NMaxR, int NMaxC>
Eigen::Matrix< T, NStates, NStates > controlpp::care_solver (const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > &A, const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > &B, const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > &Q, const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > &R, const Eigen::Matrix< T, NStates, NInputs, NOpt, NMaxR, NMaxC > &N)
 Solves the continuous time riccati equation (CARE) with cross coupling.