File spectrahedron.h
-
template<typename NT, typename MT, typename VT>
struct PrecomputationOfValues - #include <spectrahedron.h>
Among successive calls of this class methods, we may need to pass data from one call to the next, to avoid repeating computations, or to efficiently update values Warning: this struct assists in many methods; perhaps for different methods use different instances
Public Functions
-
inline void resetFlags()
Sets all flags to false.
-
inline void set_mat_size(int const &m)
Public Members
-
bool computed_A = false
These flags indicate whether the corresponding matrices are computed if yes, we can use them and not compute them fro scratch
-
bool computed_C = false
-
bool computed_XY = false
-
inline void resetFlags()
-
template<typename Point>
class Spectrahedron - #include <spectrahedron.h>
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 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 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 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 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(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, 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 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
-
template<typename RNGType>
inline NT estimateDiameter(int const numPoints, PointType const &interiorPoint, RNGType &rng)
-
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