Class Spectrahedron

template<typename Point>
class Spectrahedron

This class manipulates a spectrahedron, described by a Linear Matrix Inequality i.e. LMI

Template Parameters:

Point – Point Type

Subclassed by CorrelationSpectrahedron< Point >

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 std::pair<NT, NT> pairNT

The type of a pair of NT.

typedef PrecomputationOfValues<NT, MT, VT> _PrecomputationOfValues

Public Functions

inline Spectrahedron()
inline Spectrahedron(const LMI<NT, MT, VT> &lmi)

Creates a spectrahedron

Parameters:

lmi[in] The linear matrix inequality that describes the spectrahedron

inline void set_interior_point(PointType const &r)
inline std::pair<PointType, NT> ComputeInnerBall()
inline std::pair<Point, NT> InnerBall() const
inline void createMatricesForPositiveQuadIntersection(const VT &a, const VT &b, const VT &c)

Construct the quadratic eigenvalue problem [At^2 + Bt + C ] for positive_intersect. A = lmi(c) - A0, B = lmi(b) - A0 and C = lmi(c).

Parameters:
  • a[in] Input vector

  • b[in] Input vector

  • c[in] Input vector

  • precomputedValues[inout] Holds matrices A, C

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

Construct the generalized eigenvalue problem [Bt + C ] for positive_intersect.

Parameters:
  • p[in] Input vector

  • v[in] Input vector

  • precomputedValues[inout] Holds matrices A, C

inline void createMatricesForPositiveIntersection(const VT &p, const VT &v)
inline NT positiveQuadIntersection(VT const &a, VT const &b, VT const &c)

Computes the distance d we must travel on the parametrized polynomial curve [at^2 + bt + c ], assuming we start at t=0, and we start increasing t. We construct the quadratic eigenvalue problem [At^2 + Bt + C ], where A = lmi(c) - A0, B = lmi(b) - A0 and C = lmi(c). Then we do a linearization and transform it to the generalized problem X+lY, which we pass to an external library.

Parameters:
  • a[in] Input vector, the coefficient of t [t^2]

  • b[in] Input vector, the coefficient of t

  • c[in] Input Vector, the constant term

Returns:

The distance d

inline NT positiveLinearIntersection(VT const &p, VT const &v)
inline pairNT coordinateIntersection(VT const &a, int const coordinate)

Computes the distance d one must travel on the line a + tb, assuming we start at t=0 and that b has zero everywhere and 1 in its i-th coordinate. We must solve the generalized eigenvalue problem A+tB, where A = lmi(a) and B=(lmi) - A0 = A_i If the flag precomputedValues,computed_A is true, the matrix A is not computed.

Parameters:
  • a[in] Input vector

  • coordinate[in] Indicator of the i-th coordinate, 1 <= coordinate <= dimension

Returns:

The pair (positive t, negative t) for which we reach the boundary

inline std::pair<NT, NT> line_intersect_coord(Point &r, unsigned int const &rand_coord, VT&)
inline std::pair<NT, NT> line_intersect_coord(PointType &r, PointType&, unsigned int const &rand_coord, unsigned int&, VT&)
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&)
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, int> line_positive_intersect(PointType const &r, PointType const &v, VT&, VT&)
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 update_position_internal(NT &t)
inline MT get_mat() const
inline bool is_normalized()
inline void normalize()
inline void resetFlags()
inline void set_flags(bool bool_flag)
inline MT get_C() const
inline void update_C(NT const &lambda)
inline int num_of_hyperplanes() const
inline void shift(VT e)
inline void compute_reflection(PointType &v, PointType const &r) 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

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 unsigned int dimension() const
Returns:

The dimension of the spectrahedron

inline LMI<NT, MT, VT> getLMI() const
Returns:

The LMI describing this spectrahedron

template<typename RNGType>
inline NT estimateDiameter(int const numPoints, PointType const &interiorPoint, RNGType &rng)
inline bool is_in(PointType const &p, NT tol = NT(0)) const
inline bool isExterior(MT const &mat) const

Find out is lmi(current position) = mat is in the exterior of the spectrahedron

Parameters:

mat – a matrix where mat = lmi(current position)

Returns:

true if position is outside the spectrahedron

inline bool isExterior(VT const &pos) const

Find out is pos is in the exterior of the spectrahedron

Parameters:

pos – a vector

Returns:

true if pos is outside the spectrahedron

Public Members

double maxDouble = std::numeric_limits<double>::max()
_PrecomputationOfValues precomputedValues
EigenvaluesProblems<NT, MT, VT> EigenvaluesProblem
unsigned int d

The dimension of the spectrahedron.

VT grad
std::pair<PointType, NT> _inner_ball
LMI<NT, MT, VT> lmi

The linear matrix inequality that describes the spectrahedron.