File EigenvaluesProblems.h

template<typename NT, typename MT = Eigen::Matrix<NT, Eigen::Dynamic, Eigen::Dynamic>, typename VT = Eigen::Matrix<NT, Eigen::Dynamic, 1>>
class EigenvaluesProblems
#include <EigenvaluesProblems.h>

Solver for various eigenvalue problems arising in convex optimization Provides methods for quadratic eigenvalue problems (QEP), generalized eigenvalue problems, and negative definiteness checks via eigenvalue analysis.

Template Parameters:
  • NT – Numeric type for scalar values

  • MT – Matrix type (defaults to Eigen::Matrix with dynamic dimensions)

  • VT – Vector type (defaults to Eigen::Matrix column vector with dynamic size)

Public Functions

inline NT minPosQuadraticEigenvalue(const MT &A, const MT &B, const MT &C, MT&, MT&, VT &eigvec, bool = false, int = 0)

Find minimum positive eigenvalue for quadratic eigenvalue problem Solves (A + t*B + t²*C)v = 0 to find smallest positive t Used in convex optimization for barrier function step size computation

Parameters:
  • A[in] Constant coefficient matrix

  • B[in] Linear coefficient matrix

  • C[in] Quadratic coefficient matrix

  • X[inout] Auxiliary matrix (unused, kept for API compatibility)

  • Y[inout] Auxiliary matrix (unused, kept for API compatibility)

  • eigvec[out] Eigenvector corresponding to minimum positive eigenvalue

  • updateOnly[in] Unused flag (kept for API compatibility)

  • num_constraints[in] Unused parameter (kept for API compatibility)

Returns:

Minimum positive t satisfying the QEP, or infinity if none exists

Public Static Functions

static inline std::pair<NT, NT> symGeneralizedProblem(const MT &A, const MT &B)

Solve generalized symmetric eigenvalue problem B*v = λ*(-A)*v Finds both minimum positive and maximum negative eigenvalues simultaneously

Parameters:
  • A[in] Symmetric matrix (multiplied by -1 in problem formulation)

  • B[in] Symmetric matrix

Returns:

Pair (min_positive_eigenvalue, max_negative_eigenvalue)

static inline NT findSymEigenvalue(const MT &M)

Check if symmetric matrix M is negative definite and return an estimate of the largest eigenvalue (most negative)

Parameters:

M[in] Symmetric matrix

Returns:

Estimated largest eigenvalue if M is negative definite, infinity otherwise

Private Static Functions

static inline constexpr NT eps()

Machine epsilon for numeric type NT.

static inline constexpr NT sqrt_eps()

Square root of machine epsilon (used for moderate tolerance checks)

static inline constexpr NT LARGE_VAL()

Largest representable value for numeric type NT.

static inline constexpr NT EPS()

Machine epsilon alias for consistency with existing code.

static inline NT solveQEP(const MT &B0, const MT &B1, const MT &B2, VT &eigvec)

Solve quadratic eigenvalue problem to find smallest positive parameter Solves (B0 + t*B1 + t²*B2)v = 0 for the smallest positive t Uses Spectra library with linearization approach via QEPOperator

Parameters:
  • B0[in] Constant coefficient matrix

  • B1[in] Linear coefficient matrix

  • B2[in] Quadratic coefficient matrix

  • eigvec[out] Eigenvector corresponding to smallest positive t

Returns:

Smallest positive value of t, or infinity if none exists

class QEPOperator

Operator for structured quadratic eigenvalue problem (QEP) linearization Implements the matrix-vector product for the linearized system C1^{-1}C0 where the original QEP is: (A + λB + λ²C)v = 0

Public Types

using Scalar = NT

Scalar type required by Spectra library.

Public Functions

inline QEPOperator(const MT &A, const MT &B, const MT &C)

Construct QEP operator from coefficient matrices

Parameters:
  • A[in] Constant term matrix

  • B[in] Linear term matrix

  • C[in] Quadratic term matrix (should be positive definite)

inline int rows() const

Number of rows in linearized system (twice original dimension)

inline int cols() const

Number of columns in linearized system (twice original dimension)

inline void perform_op(const NT *x_in, NT *y_out) const

Perform matrix-vector product y = Op * x for Spectra eigenvalue solver Implements the linearized QEP system operator using efficient factorizations

Parameters:
  • x_in[in] Input vector of size 2*n

  • y_out[out] Output vector of size 2*n

Private Members

const MT &A_

Coefficient matrix A in QEP.

const MT &B_

Coefficient matrix B in QEP.

const MT &C_

Coefficient matrix C in QEP (must be positive definite)

const int n_

Dimension of original problem.

mutable Eigen::LLT<MT> lltC_

Cholesky decomposition of C (LLT)

mutable Eigen::LDLT<MT> ldltC_

LDLT decomposition of C (fallback)

mutable bool chol_computed_ = false

Flag indicating if decomposition is computed.

mutable bool use_llt_ = false

Flag indicating which decomposition to use.