File correlation_spectrahedron.hpp

template<typename NT, typename MT, typename VT>
struct Precompute

Public Functions

inline void resetFlags()

Sets all flags to false.

inline void set_mat_size(int const &n)

Public Members

bool computed_A = false

These flags indicate whether the corresponding matrices are computed.

bool computed_B = false
MT A

The matrices the method positiveIntersection receives from its previous call if the flag first_positive_intersection is true. Matrix A is also used in coordinateIntersection

MT B
VT eigenvector

In method positive_intersect, the distance we are computing corresponds to the minimum positive eigenvalue of a quadratic eigenvalue problem. This will hold the eigenvector for that eigenvalue

template<typename Point>
class CorrelationSpectrahedron : public Spectrahedron<Point>
#include <correlation_spectrahedron.hpp>

This class handles the spectrahedra of correlation matrices The PointType here is stored as vector. For the matrix PointType class, refer to CorrelationSpectrahedron_MT

Template Parameters:

Point – Point Type

Public Types

typedef Point PointType

The numeric/matrix/vector types we use.

typedef Point::FT NT
typedef Eigen::Matrix<NT, Eigen::Dynamic, Eigen::Dynamic> MT
typedef Eigen::Matrix<NT, Eigen::Dynamic, 1> VT
typedef Precompute<NT, MT, VT> PrecomputationOfValues

Public Functions

inline CorrelationSpectrahedron(unsigned int n)

Constructor of correlation matrix spectrahedra.

inline unsigned int matrixSize() const
Returns:

The size of the matrix

inline std::pair<PointType, NT> getInnerBall() const
inline void buildMatrix(VT const &pvector, unsigned int const n, MT &mat) const

Build a correlation matrix from a vector of entries

Parameters:
  • vector[in] of coefficients

  • the[in] matrix to be assigned

template<typename update_parameters>
inline void compute_reflection(PointType &v, PointType const &r, update_parameters&) const

Computes the reflected direction at a point on the boundary of the spectrahedron.

Parameters:
  • r[in] A point on the boundary of the spectrahedron

  • v[in] The direction of the trajectory as it hits the boundary

  • reflectedDirection[out] The reflected direction

inline void createMatricesForPositiveLinearIntersection(VT const &p, VT const &v)

Construct the generalized eigenvalue problem [Bt - A ] for positive_intersect.

Parameters:
  • p[in] Input vector

  • v[in] Input vector

  • _precomputedValues[inout] Holds matrices B = I - A(v), A = A(p)

inline NT positiveLinearIntersection(VT const &p, VT const &v)
inline std::pair<NT, int> line_positive_intersect(PointType const &r, PointType const &v)
inline std::pair<NT, int> line_positive_intersect(PointType const &r, PointType const &v, VT&, VT&, NT const&)
inline std::pair<NT, int> line_positive_intersect(PointType const &r, PointType const &v, VT&, VT&)
template<typename update_parameters>
inline std::pair<NT, int> line_positive_intersect(PointType const &r, PointType const &v, VT&, VT&, NT const&, update_parameters&)
template<typename update_parameters>
inline std::pair<NT, int> line_positive_intersect(PointType const &r, PointType const &v, VT&, VT&, NT const&, MT const&, update_parameters&)
template<typename update_parameters>
inline std::pair<NT, int> line_first_positive_intersect(PointType const &r, PointType const &v, VT&, VT&, update_parameters&)
inline std::pair<NT, NT> line_intersect(PointType const &r, PointType const &v)
inline std::pair<NT, NT> line_intersect(PointType const &r, PointType const &v, VT&, VT&)
inline std::pair<NT, NT> line_intersect(PointType const &r, PointType const &v, VT&, VT&, NT&)
inline void unit_normal(VT p, VT const &e, VT &ret) const

Compute the gradient of the determinant of the LMI at p

Parameters:
  • p[in] Input parameter

  • Input[in] vector: the eigenvector A(p)*e = 0

  • ret[out] The unit normal vector at p

inline int is_in(PointType const &p, NT tol = NT(0)) const

Test if a point p is in the spectrahedron

Parameters:

p – is the current point

Returns:

true if position is outside the spectrahedron

inline bool isExterior(VT const &pos) const
inline bool isExterior(MT const &mat) const
inline MT get_mat() const
inline bool is_normalized()
inline void normalize()

Public Members

unsigned int n

The size of the matrix.

PrecomputationOfValues _precomputedValues