11 #ifndef MLPACK_CORE_OPTIMIZERS_SDP_SDP_HPP 12 #define MLPACK_CORE_OPTIMIZERS_SDP_SDP_HPP 18 namespace optimization {
38 template <
typename ObjectiveMatrixType>
67 const size_t numSparseConstraints,
68 const size_t numDenseConstraints);
71 size_t N()
const {
return c.n_rows; }
73 size_t N2bar()
const {
return N() * (
N() + 1) / 2; }
86 ObjectiveMatrixType&
C() {
return c; }
88 const ObjectiveMatrixType&
C()
const {
return c; }
92 const std::vector<arma::sp_mat>&
SparseA()
const {
return sparseA; }
96 std::vector<arma::sp_mat>&
SparseA() {
return sparseA; }
100 const std::vector<arma::mat>&
DenseA()
const {
return denseA; }
104 std::vector<arma::mat>&
DenseA() {
return denseA; }
107 const arma::vec&
SparseB()
const {
return sparseB; }
112 const arma::vec&
DenseB()
const {
return denseB; }
125 ObjectiveMatrixType c;
128 std::vector<arma::sp_mat> sparseA;
133 std::vector<arma::mat> denseA;
142 #include "sdp_impl.hpp" std::vector< arma::mat > & DenseA()
Modify the veector of dense A matrices (which correspond to the dense constraints).
Linear algebra utility functions, generally performed on matrices or vectors.
const ObjectiveMatrixType & C() const
Return the sparse objective function matrix (sparseC).
size_t NumSparseConstraints() const
Return the number of sparse constraints (constraints with sparse Ai) in the SDP.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t N() const
Return number of rows and columns in the objective matrix C.
const std::vector< arma::sp_mat > & SparseA() const
Return the vector of sparse A matrices (which correspond to the sparse constraints).
size_t NumConstraints() const
Return the total number of constraints in the SDP.
const std::vector< arma::mat > & DenseA() const
Return the vector of dense A matrices (which correspond to the dense constraints).
ObjectiveMatrixType & C()
Modify the sparse objective function matrix (sparseC).
ObjectiveMatrixType objective_matrix_type
size_t NumDenseConstraints() const
Return the number of dense constraints (constraints with dense Ai) in the SDP.
SDP()
Initialize this SDP to an empty state.
Specify an SDP in primal form.
arma::vec & SparseB()
Modify the vector of sparse B values.
std::vector< arma::sp_mat > & SparseA()
Modify the veector of sparse A matrices (which correspond to the sparse constraints).
arma::vec & DenseB()
Modify the vector of dense B values.
const arma::vec & DenseB() const
Return the vector of dense B values.
const arma::vec & SparseB() const
Return the vector of sparse B values.
bool HasLinearlyIndependentConstraints() const
Check whether or not the constraint matrices are linearly independent.