Drake
Drake C++ Documentation
decompose.h File Reference
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include "drake/common/eigen_types.h"
#include "drake/common/symbolic/expression.h"
#include "drake/common/symbolic/polynomial.h"
Include dependency graph for decompose.h:

Namespaces

 drake
 
 drake::symbolic
 

Functions

bool IsAffine (const Eigen::Ref< const MatrixX< Expression >> &m, const Variables &vars)
 Checks if every element in m is affine in vars. More...
 
bool IsAffine (const Eigen::Ref< const MatrixX< Expression >> &m)
 Checks if every element in m is affine. More...
 
void DecomposeLinearExpressions (const Eigen::Ref< const VectorX< Expression >> &expressions, const Eigen::Ref< const VectorX< Variable >> &vars, EigenPtr< Eigen::MatrixXd > M)
 Decomposes expressions into M * vars. More...
 
void DecomposeAffineExpressions (const Eigen::Ref< const VectorX< Expression >> &expressions, const Eigen::Ref< const VectorX< Variable >> &vars, EigenPtr< Eigen::MatrixXd > M, EigenPtr< Eigen::VectorXd > v)
 Decomposes expressions into M * vars + v. More...
 
void ExtractAndAppendVariablesFromExpression (const symbolic::Expression &e, VectorX< Variable > *vars, std::unordered_map< symbolic::Variable::Id, int > *map_var_to_index)
 Given an expression e, extract all variables inside e, append these variables to vars if they are not included in vars yet. More...
 
std::pair< VectorX< Variable >, std::unordered_map< symbolic::Variable::Id, int > > ExtractVariablesFromExpression (const symbolic::Expression &e)
 Given an expression e, extracts all variables inside e. More...
 
std::pair< VectorX< Variable >, std::unordered_map< Variable::Id, int > > ExtractVariablesFromExpression (const Eigen::Ref< const VectorX< Expression >> &expressions)
 Overloads ExtractVariablesFromExpression but with a vector of expressions. More...
 
void DecomposeQuadraticPolynomial (const symbolic::Polynomial &poly, const std::unordered_map< symbolic::Variable::Id, int > &map_var_to_index, Eigen::MatrixXd *Q, Eigen::VectorXd *b, double *c)
 Given a quadratic polynomial poly, decomposes it into the form 0.5 * x' Q * x + b' * x + c. More...
 
void DecomposeAffineExpressions (const Eigen::Ref< const VectorX< symbolic::Expression >> &v, Eigen::MatrixXd *A, Eigen::VectorXd *b, VectorX< Variable > *vars)
 Given a vector of affine expressions v, decompose it to \( v = A vars + b \). More...
 
int DecomposeAffineExpression (const symbolic::Expression &e, const std::unordered_map< symbolic::Variable::Id, int > &map_var_to_index, EigenPtr< Eigen::RowVectorXd > coeffs, double *constant_term)
 Decomposes an affine combination e = c0 + c1 * v1 + ... More...
 
std::tuple< MatrixX< Expression >, VectorX< Expression >, VectorX< Expression > > DecomposeLumpedParameters (const Eigen::Ref< const VectorX< Expression >> &f, const Eigen::Ref< const VectorX< Variable >> &parameters)
 Given a vector of Expressions f and a list of parameters we define all additional variables in f to be a vector of "non-parameter variables", n. More...
 
std::tuple< bool, Eigen::MatrixXd, Eigen::VectorXd, VectorX< Variable > > DecomposeL2NormExpression (const symbolic::Expression &e, double psd_tol=1e-8, double coefficient_tol=1e-8)
 Decomposes an L2 norm e = |Ax+b|₂ into A, b, and the variable vector x (or returns false if the decomposition is not possible). More...