TVM  0.9.4
tvm::internal::FirstOrderProvider Class Reference

#include <tvm/internal/FirstOrderProvider.h>

Inheritance diagram for tvm::internal::FirstOrderProvider:
Collaboration diagram for tvm::internal::FirstOrderProvider:

Classes

struct  slice_linear
 
struct  slice_matrix
 

Public Member Functions

virtual const Eigen::VectorXd & value () const
 
virtual MatrixConstRefWithProperties jacobian (const Variable &x) const
 
bool linearIn (const Variable &x) const
 
const SpaceimageSpace () const
 
int size () const
 
int rSize () const
 
int tSize () const
 
const VariableVectorvariables () const
 
- Public Member Functions inherited from tvm::graph::internal::AbstractNode
template<typename EnumT >
bool isUpdateEnabled (EnumT e) const
 
virtual bool isUpdateStaticallyEnabled (int) const
 
virtual bool isUpdateCustomEnabled (int) const
 
virtual ~AbstractNode ()=default
 
void update (int i)
 
- Public Member Functions inherited from tvm::graph::internal::Inputs
virtual ~Inputs ()=default
 
template<typename T , typename EnumI , typename... Args>
void addInput (std::shared_ptr< T > source, EnumI i, Args... args)
 
template<typename T , typename EnumI , typename... Args, typename std::enable_if< std::is_base_of< abstract::Outputs, T >::value, int >::type = 0>
void addInput (T &source, EnumI i, Args... args)
 
template<typename T >
void removeInput (T *source)
 
template<typename T , typename... Args>
void removeInput (T *source, Args... args)
 
template<typename T >
Iterator getInput (T *source)
 
template<typename T >
Iterator getInput (const std::shared_ptr< T > &source)
 
- Public Member Functions inherited from tvm::graph::abstract::Outputs
virtual ~Outputs ()=default
 
template<typename EnumT >
bool isOutputEnabled (EnumT e) const
 
bool isOutputEnabled (int i) const
 
virtual bool isOutputStaticallyEnabled (int) const
 
virtual bool isOutputCustomEnabled (int) const
 

Protected Member Functions

 FirstOrderProvider (int m)
 
 FirstOrderProvider (Space image)
 
virtual void resizeCache ()
 
void resizeValueCache ()
 
void resizeJacobianCache ()
 
void addVariable (VariablePtr v, bool linear)
 
void removeVariable (VariablePtr v)
 
void addVariable (const VariableVector &v, bool linear)
 
virtual void addVariable_ (VariablePtr)
 
virtual void removeVariable_ (VariablePtr)
 
void splitJacobian (const MatrixConstRef &J, const std::vector< VariablePtr > &vars, bool keepProperties=false)
 
void splitJacobian (const MatrixConstRef &J, const VariableVector &vars, bool keepProperties=false)
 
void resize (int m)
 
- Protected Member Functions inherited from tvm::graph::abstract::Node< FirstOrderProvider >
void registerUpdates (EnumT u, void(U::*fn)(), Args... args)
 
void registerUpdates (EnumT u, void(U::*fn)())
 
void addOutputDependency (EnumO o, EnumU u)
 
void addOutputDependency (std::initializer_list< EnumO > os, EnumU u)
 
void addInternalDependency (EnumU1 uDependent, EnumU2 u)
 
void addInputDependency (EnumU u, std::shared_ptr< S > source, EnumO i, Args... args)
 
void addInputDependency (EnumU u, S &source, EnumO i, Args... args)
 
void addDirectDependency (EnumO o, std::shared_ptr< S > source, EnumI i)
 
void addDirectDependency (EnumO o, S &source, EnumI i)
 

Protected Attributes

Eigen::VectorXd value_
 
utils::internal::MapWithVariableAsKey< MatrixWithProperties, slice_matrix, true > jacobian_
 
Space imageSpace_
 
VariableVector variables_
 
utils::internal::MapWithVariableAsKey< bool, slice_linearlinear_
 
- Protected Attributes inherited from tvm::graph::internal::AbstractNode
std::map< int, std::function< void(AbstractNode &)> > updates_
 
std::map< int, std::vector< int > > outputDependencies_
 
std::map< int, std::vector< int > > internalDependencies_
 
std::map< int, input_dependency_tinputDependencies_
 
std::map< int, std::pair< Outputs *, int > > directDependencies_
 
- Protected Attributes inherited from tvm::graph::abstract::Outputs
bool is_node_ = false
 

Additional Inherited Members

- Public Types inherited from tvm::graph::internal::AbstractNode
enum class  Update_
 
using UpdateParent = AbstractNode
 
using UpdateBase = AbstractNode
 
- Public Types inherited from tvm::graph::internal::Inputs
using inputs_t = std::unordered_map< abstract::Outputs *, std::set< int > >
 
using store_t = std::unordered_set< std::shared_ptr< abstract::Outputs > >
 
- Public Types inherited from tvm::graph::abstract::Outputs
enum class  Output_
 
using OutputParent = Outputs
 
using OutputBase = Outputs
 
- Static Public Member Functions inherited from tvm::graph::internal::AbstractNode
static constexpr const char * UpdateName (Update_)
 
template<typename EnumT >
static constexpr bool UpdateStaticallyEnabled (EnumT)
 
- Static Public Member Functions inherited from tvm::graph::abstract::Outputs
static constexpr const char * OutputName (Output_)
 
template<typename EnumT >
static constexpr bool OutputStaticallyEnabled (EnumT)
 
- Static Public Attributes inherited from tvm::graph::internal::AbstractNode
static constexpr unsigned int UpdateSize = 0
 
static constexpr auto UpdateBaseName = "AbstractNode"
 
- Static Public Attributes inherited from tvm::graph::abstract::Outputs
static constexpr unsigned int OutputSize = 0
 
static constexpr auto OutputBaseName = "Outputs"
 
- Protected Types inherited from tvm::graph::internal::AbstractNode
using input_dependency_t = std::map< Outputs *, std::set< int > >
 

Detailed Description

Describes an entity that can provide a value and its jacobian

dot_inline_dotgraph_7.png

Constructor & Destructor Documentation

◆ FirstOrderProvider() [1/2]

tvm::internal::FirstOrderProvider::FirstOrderProvider ( int  m)
protected

Constructor for a function/constraint with value in \( \mathbb{R}^m \).

Parameters
mthe size of the function/constraint image space, i.e. the row size of the jacobians (or equivalently in this case the size of the output value).

◆ FirstOrderProvider() [2/2]

tvm::internal::FirstOrderProvider::FirstOrderProvider ( Space  image)
protected

Constructor for a function/constraint with value in a specified space.

Parameters
imageDescription of the image space

Member Function Documentation

◆ addVariable() [1/2]

void tvm::internal::FirstOrderProvider::addVariable ( const VariableVector v,
bool  linear 
)
protected

Add a variable vector.

Convenience function similar to adding each elements of the vector individually with the same linear parameter

See also
addVariable(VariablePtr, bool)

◆ addVariable() [2/2]

void tvm::internal::FirstOrderProvider::addVariable ( VariablePtr  v,
bool  linear 
)
protected

Add a variable. Cache is automatically updated.

Parameters
vThe variable to add
linearSpecify that the entity is depending linearly on the variable or not.

◆ addVariable_()

virtual void tvm::internal::FirstOrderProvider::addVariable_ ( VariablePtr  )
protectedvirtual

To be overridden by derived classes that need to react to the addition of a variable. Called at the end of addVariable();

Reimplemented in tvm::function::abstract::Function.

◆ imageSpace()

const Space & tvm::internal::FirstOrderProvider::imageSpace ( ) const
inline

◆ jacobian()

MatrixConstRefWithProperties tvm::internal::FirstOrderProvider::jacobian ( const Variable x) const
inlinevirtual

Return the jacobian matrix of this entity corresponding to the variable x

Reimplemented in tvm::constraint::internal::LinearizedTaskConstraint.

◆ linearIn()

bool tvm::internal::FirstOrderProvider::linearIn ( const Variable x) const
inline

Linearity w.r.t x

◆ removeVariable()

void tvm::internal::FirstOrderProvider::removeVariable ( VariablePtr  v)
protected

Remove variable v. Cache is automatically updated.

◆ removeVariable_()

virtual void tvm::internal::FirstOrderProvider::removeVariable_ ( VariablePtr  )
protectedvirtual

To be overridden by derived classes that need to react to the removal of a variable. Called at the end of removeVariable();

Reimplemented in tvm::function::abstract::Function.

◆ resize()

void tvm::internal::FirstOrderProvider::resize ( int  m)
protected

Resize the function

◆ resizeCache()

virtual void tvm::internal::FirstOrderProvider::resizeCache ( )
protectedvirtual

Resize all cache members corresponding to active outputs.

This can be overridden in case you do not need all of the default mechanism (typically if you will not use part of the cache). If you override to perform additional operations, do not forget to call this base version in the derived classes.

Reimplemented in tvm::function::abstract::LinearFunction, tvm::function::abstract::Function, and tvm::constraint::abstract::Constraint.

◆ resizeJacobianCache()

void tvm::internal::FirstOrderProvider::resizeJacobianCache ( )
protected

Sub-methods of resizeCache resizing the jacobian cache matrices (if used). To be used by derived classes that need this level of granularity.

◆ resizeValueCache()

void tvm::internal::FirstOrderProvider::resizeValueCache ( )
protected

Sub-methods of resizeCache resizing the value cache vector (if used). To be used by derived classes that need this level of granularity.

◆ rSize()

int tvm::internal::FirstOrderProvider::rSize ( ) const
inline

Size of the output value (representation size of the image space).

◆ size()

int tvm::internal::FirstOrderProvider::size ( ) const
inline

Return the image space size.

◆ splitJacobian() [1/2]

void tvm::internal::FirstOrderProvider::splitJacobian ( const MatrixConstRef J,
const std::vector< VariablePtr > &  vars,
bool  keepProperties = false 
)
protected

Split a jacobian matrix J into its components Ji corresponding to the provided variables.

Parameters
JThe matrix to be split
varsThe vector of variables giving the layout of J. It is the user's responsibility to ensure these variables are part of variables_ and that J has the correct size.
keepPropertiesIf true, the properties associated with matrices Ji are kept, if not they are reset to default.

◆ splitJacobian() [2/2]

void tvm::internal::FirstOrderProvider::splitJacobian ( const MatrixConstRef J,
const VariableVector vars,
bool  keepProperties = false 
)
inlineprotected

Overload for VariableVector operations

◆ tSize()

int tvm::internal::FirstOrderProvider::tSize ( ) const
inline

Size of the tangent space to the image space (or equivalently row size of the jacobian matrices).

◆ value()

const Eigen::VectorXd & tvm::internal::FirstOrderProvider::value ( ) const
inlinevirtual

Return the value of this entity

Reimplemented in tvm::robot::JointsSelector.

◆ variables()

const VariableVector & tvm::internal::FirstOrderProvider::variables ( ) const
inline

Return the variables

Member Data Documentation

◆ imageSpace_

Space tvm::internal::FirstOrderProvider::imageSpace_
protected

◆ jacobian_

utils::internal::MapWithVariableAsKey<MatrixWithProperties, slice_matrix, true> tvm::internal::FirstOrderProvider::jacobian_
protected

◆ linear_

utils::internal::MapWithVariableAsKey<bool, slice_linear> tvm::internal::FirstOrderProvider::linear_
protected

◆ value_

Eigen::VectorXd tvm::internal::FirstOrderProvider::value_
protected

◆ variables_

VariableVector tvm::internal::FirstOrderProvider::variables_
protected

The documentation for this class was generated from the following file: