Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
Optimist::Utils Namespace Reference

Helpers to move data between the input types accepted by the solvers (fixed-size, dynamic-size and sparse Eigen vectors) and the dense dynamic-size storage used internally by some algorithms.

Typedefs

template<typename Vector>
using DenseVector
template<typename Vector>
using DenseMatrix

Functions

template<typename Vector>
DenseVector< Vector > to_dense (const Vector &x)
template<typename Vector, typename Derived>
Vector from_dense (const Eigen::MatrixBase< Derived > &x)
template<typename Matrix, typename Derived>
Matrix from_dense_matrix (const Eigen::MatrixBase< Derived > &A)
template<typename Vector>
TypeTrait< Vector >::Scalar coeff (const Vector &x, const Integer i)

Typedef Documentation

◆ DenseMatrix

template<typename Vector>
using Optimist::Utils::DenseMatrix
Initial value:
Eigen::Matrix<typename TypeTrait<Vector>::Scalar,
Eigen::Dynamic,
Eigen::Dynamic>

Dense dynamic-size matrix with the same scalar type as Vector.

◆ DenseVector

template<typename Vector>
using Optimist::Utils::DenseVector
Initial value:
Eigen::Matrix<typename TypeTrait<Vector>::Scalar, Eigen::Dynamic, 1>

Dense dynamic-size column vector with the same scalar type as Vector.

Function Documentation

◆ coeff()

template<typename Vector>
TypeTrait< Vector >::Scalar Optimist::Utils::coeff ( const Vector & x,
const Integer i )

Read a coefficient of any supported vector.

Parameters
[in]xInput vector.
[in]iIndex.
Returns
The \( i \)-th coefficient.

◆ from_dense()

template<typename Vector, typename Derived>
Vector Optimist::Utils::from_dense ( const Eigen::MatrixBase< Derived > & x)

Convert a dense vector to any supported vector type.

Template Parameters
VectorOutput vector type.
Parameters
[in]xDense input vector.
Returns
The converted vector.

◆ from_dense_matrix()

template<typename Matrix, typename Derived>
Matrix Optimist::Utils::from_dense_matrix ( const Eigen::MatrixBase< Derived > & A)

Convert a dense matrix to a dense or sparse Eigen matrix type.

Template Parameters
MatrixOutput matrix type.
Parameters
[in]ADense input matrix.
Returns
The converted matrix.

◆ to_dense()

template<typename Vector>
DenseVector< Vector > Optimist::Utils::to_dense ( const Vector & x)

Convert any supported vector to a dense dynamic-size vector.

Parameters
[in]xInput vector.
Returns
The dense copy of the vector.