jrl::qp::internal::Workspace< Scalar > Class Template Reference

#include <jrl-qp/internal/Workspace.h>

Public Member Functions

 Workspace ()
 
 Workspace (int size)
 
 Workspace (int rows, int cols)
 
void resize (int size, bool fit=false)
 
int size () const
 
void resize (int rows, int cols, bool fit=false)
 
void changeLd (int rows, int cols, int oldLd, int newLd)
 
auto asVector (int size, NotConst={})
 
auto asVector (int size) const
 
auto asMatrix (int rows, int cols, int ld, NotConst={})
 
auto asMatrix (int rows, int cols, int ld) const
 
void setZero ()
 

Detailed Description

template<typename Scalar = double>
class jrl::qp::internal::Workspace< Scalar >

Class providing a memory buffer and the ablity to see it as a matrix or vector.

Constructor & Destructor Documentation

◆ Workspace() [1/3]

template<typename Scalar = double>
jrl::qp::internal::Workspace< Scalar >::Workspace ( )
inline

Default constructor, providing a buffer of size 0.

◆ Workspace() [2/3]

template<typename Scalar = double>
jrl::qp::internal::Workspace< Scalar >::Workspace ( int  size)
inline

Constructing a workspace with a buffer of a specific size.

Parameters
size.Size of the buffer

◆ Workspace() [3/3]

template<typename Scalar = double>
jrl::qp::internal::Workspace< Scalar >::Workspace ( int  rows,
int  cols 
)
inline

Constructing a workspace able to contain a row by col matrix.

Member Function Documentation

◆ asMatrix() [1/2]

template<typename Scalar = double>
auto jrl::qp::internal::Workspace< Scalar >::asMatrix ( int  rows,
int  cols,
int  ld 
) const
inline

Return the buffer as a Eigen::Matrix-like object of the required sizes. Const version. See non-const version for more details

◆ asMatrix() [2/2]

template<typename Scalar = double>
auto jrl::qp::internal::Workspace< Scalar >::asMatrix ( int  rows,
int  cols,
int  ld,
NotConst  = {} 
)
inline

Return the buffer as a Eigen::Matrix-like object of the required sizes. Non const version.

Parameters
rowsNumber of rows.
colsNumber of cols.
ldLeading dimension of the matrix.
Note
The leading dimension parameter can be important when the matrix size is meant to change, so that each columns start with the same elements.

◆ asVector() [1/2]

template<typename Scalar = double>
auto jrl::qp::internal::Workspace< Scalar >::asVector ( int  size) const
inline

Return the buffer as a Eigen::Vector-like object of the required size. Const version.

◆ asVector() [2/2]

template<typename Scalar = double>
auto jrl::qp::internal::Workspace< Scalar >::asVector ( int  size,
NotConst  = {} 
)
inline

Return the buffer as a Eigen::Vector-like object of the required size. Non const version.

◆ changeLd()

template<typename Scalar = double>
void jrl::qp::internal::Workspace< Scalar >::changeLd ( int  rows,
int  cols,
int  oldLd,
int  newLd 
)
inline

Change the leading dimension used to organize data in memory.

this->asMatrix(rows, cols, oldLd) before call to this function and this->asMatrix(rows, cols, newLd) after will give the same matrix.

◆ resize() [1/2]

template<typename Scalar = double>
void jrl::qp::internal::Workspace< Scalar >::resize ( int  rows,
int  cols,
bool  fit = false 
)
inline

Shortcut for resize(rows*cols, fit).

◆ resize() [2/2]

template<typename Scalar = double>
void jrl::qp::internal::Workspace< Scalar >::resize ( int  size,
bool  fit = false 
)
inline

Resize to the given size.

Parameters
sizeThe new size.
fitIf true, force memory reallocation even if when the previous buffer was large enough. If false, only reallocate if needed.

◆ setZero()

template<typename Scalar = double>
void jrl::qp::internal::Workspace< Scalar >::setZero ( )
inline

Set all elements to the buffer to zero.

◆ size()

template<typename Scalar = double>
int jrl::qp::internal::Workspace< Scalar >::size ( ) const
inline

Get the size of the buffer.


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