TVM  0.9.4
tvm::hint::abstract::SubstitutionCalculatorImpl Class Referenceabstract

#include <tvm/hint/abstract/SubstitutionCalculatorImpl.h>

Inheritance diagram for tvm::hint::abstract::SubstitutionCalculatorImpl:
Collaboration diagram for tvm::hint::abstract::SubstitutionCalculatorImpl:

Public Member Functions

virtual ~SubstitutionCalculatorImpl ()=default
 
void update ()
 
void premultiplyByASharpAndSTranspose (MatrixRef outA, MatrixRef outS, const MatrixConstRef &in, bool minus) const
 
void postMultiplyByN (MatrixRef out, const MatrixConstRef &in, bool add=false) const
 
void postMultiplyByN (MatrixRef out, const MatrixConstRef &in, Range r, bool add=false) const
 
const Eigen::MatrixXd & N () const
 
Eigen::DenseIndex m () const
 
Eigen::DenseIndex n () const
 
Eigen::DenseIndex r () const
 

Protected Member Functions

 SubstitutionCalculatorImpl (const std::vector< LinearConstraintPtr > &cstr, const std::vector< VariablePtr > &x, int rank)
 
void constant (bool c)
 
bool constant () const
 
MatrixConstRef A () const
 
bool isSimple () const
 
virtual void update_ ()=0
 
virtual void premultiplyByASharpAndSTranspose_ (MatrixRef outA, MatrixRef outS, const MatrixConstRef &in, bool minus) const =0
 
virtual void postMultiplyByN_ (MatrixRef out, const MatrixConstRef &in, bool add) const
 
virtual void postMultiplyByN_ (MatrixRef out, const MatrixConstRef &in, Range r, bool add) const
 
void fillA ()
 

Protected Attributes

Eigen::MatrixXd N_
 
std::vector< LinearConstraintPtrconstraints_
 
VariableVector variables_
 

Friends

class SubstitutionCalculator
 

Detailed Description

Given a set of variables aggregated as x, and a set of constraints that, once aggregated, writes A x + ..., this base class proposes a set of operations related to A that are useful for performing substitutions. The operations revolve around 3 matrices:

  • A^#, a generalize inverse of A (i.e. a matrix such that A A^# A = A)
  • N, a basis of the nullspace of A. It does not need to be orthonormal.
  • S, a basis of the nullspace of A^T. It does not need to be orthonormal.

The choice of A^#, N and S is implemented by derivation of this base class. A generic implementation is given by GenericCalculator::Impl

Constructor & Destructor Documentation

◆ ~SubstitutionCalculatorImpl()

virtual tvm::hint::abstract::SubstitutionCalculatorImpl::~SubstitutionCalculatorImpl ( )
virtualdefault

◆ SubstitutionCalculatorImpl()

tvm::hint::abstract::SubstitutionCalculatorImpl::SubstitutionCalculatorImpl ( const std::vector< LinearConstraintPtr > &  cstr,
const std::vector< VariablePtr > &  x,
int  rank 
)
protected

Constructor

Parameters
cstrthe list of constraints
xthe list of variables
rankthe rank of A

Member Function Documentation

◆ A()

MatrixConstRef tvm::hint::abstract::SubstitutionCalculatorImpl::A ( ) const
protected

Return the matrix A

◆ constant() [1/2]

bool tvm::hint::abstract::SubstitutionCalculatorImpl::constant ( ) const
protected

Return whether A is constant

◆ constant() [2/2]

void tvm::hint::abstract::SubstitutionCalculatorImpl::constant ( bool  c)
protected

Specify whether A is constant (in which case only the first update will actually perform computations.

◆ fillA()

void tvm::hint::abstract::SubstitutionCalculatorImpl::fillA ( )
protected

Copy in A_ the values of the relevant jacobian matrices.

◆ isSimple()

bool tvm::hint::abstract::SubstitutionCalculatorImpl::isSimple ( ) const
inlineprotected

Return true if there is only one variable and one constraint

◆ m()

Eigen::DenseIndex tvm::hint::abstract::SubstitutionCalculatorImpl::m ( ) const
inline

Number of lines of A (i.e. sum of the constraints' sizes.

◆ N()

const Eigen::MatrixXd& tvm::hint::abstract::SubstitutionCalculatorImpl::N ( ) const

Return N as a dense matrix.

◆ n()

Eigen::DenseIndex tvm::hint::abstract::SubstitutionCalculatorImpl::n ( ) const
inline

Size of x (i.e. sum of the size of the variables to be substituted.

◆ postMultiplyByN() [1/2]

void tvm::hint::abstract::SubstitutionCalculatorImpl::postMultiplyByN ( MatrixRef  out,
const MatrixConstRef in,
bool  add = false 
) const

Compute out = in * N. If add is true, perform out += in * N instead.

◆ postMultiplyByN() [2/2]

void tvm::hint::abstract::SubstitutionCalculatorImpl::postMultiplyByN ( MatrixRef  out,
const MatrixConstRef in,
Range  r,
bool  add = false 
) const

Compute out = in * N(r,:). If add is true, perform out += in * N(r,:) instead.

◆ postMultiplyByN_() [1/2]

virtual void tvm::hint::abstract::SubstitutionCalculatorImpl::postMultiplyByN_ ( MatrixRef  out,
const MatrixConstRef in,
bool  add 
) const
protectedvirtual

◆ postMultiplyByN_() [2/2]

virtual void tvm::hint::abstract::SubstitutionCalculatorImpl::postMultiplyByN_ ( MatrixRef  out,
const MatrixConstRef in,
Range  r,
bool  add 
) const
protectedvirtual

Computations for postMultiplyByN(). By default it uses N()

◆ premultiplyByASharpAndSTranspose()

void tvm::hint::abstract::SubstitutionCalculatorImpl::premultiplyByASharpAndSTranspose ( MatrixRef  outA,
MatrixRef  outS,
const MatrixConstRef in,
bool  minus 
) const

If \minus = \false, perform outA = A^# * in and outS = S^T * in otherwise perform outA = - A^# * in and outS = S^T * in

◆ premultiplyByASharpAndSTranspose_()

virtual void tvm::hint::abstract::SubstitutionCalculatorImpl::premultiplyByASharpAndSTranspose_ ( MatrixRef  outA,
MatrixRef  outS,
const MatrixConstRef in,
bool  minus 
) const
protectedpure virtual

◆ r()

Eigen::DenseIndex tvm::hint::abstract::SubstitutionCalculatorImpl::r ( ) const
inline

Rank of A

◆ update()

void tvm::hint::abstract::SubstitutionCalculatorImpl::update ( )

Update the internal computations based on the current value of A, i.e the current values of the constraints' jacobian matrices.

◆ update_()

virtual void tvm::hint::abstract::SubstitutionCalculatorImpl::update_ ( )
protectedpure virtual

Handle for the derived class to perform the computations in update()

Implemented in tvm::hint::internal::GenericCalculator::Impl, and tvm::hint::internal::DiagonalCalculator::Impl.

Friends And Related Function Documentation

◆ SubstitutionCalculator

friend class SubstitutionCalculator
friend

Member Data Documentation

◆ constraints_

std::vector<LinearConstraintPtr> tvm::hint::abstract::SubstitutionCalculatorImpl::constraints_
protected

The list of constraints.

◆ N_

Eigen::MatrixXd tvm::hint::abstract::SubstitutionCalculatorImpl::N_
protected

The matrix N

◆ variables_

VariableVector tvm::hint::abstract::SubstitutionCalculatorImpl::variables_
protected

The list of variables.


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