std::string LRSDPFunction<SDPType>::ToString() const { std::ostringstream convert; convert << "LRSDPFunction [" << this << "]" << std::endl; convert << " Number of constraints: " << SDP().NumConstraints() << std::endl; convert << " Problem size: n=" << initialPoint.n_rows << ", r=" << initialPoint.n_cols << std::endl; convert << " Sparse Constraint b_i values: " << SDP().SparseB().t(); convert << " Dense Constraint b_i values: " << SDP().DenseB().t(); return convert.str(); }
double LRSDPFunction<SDPType>::EvaluateConstraint(const size_t index, const arma::mat& coordinates) const { const arma::mat rrt = coordinates * trans(coordinates); if (index < SDP().NumSparseConstraints()) return accu(SDP().SparseA()[index] % rrt) - SDP().SparseB()[index]; const size_t index1 = index - SDP().NumSparseConstraints(); return accu(SDP().DenseA()[index1] % rrt) - SDP().DenseB()[index1]; }
double LRSDPFunction<SDPType>::Evaluate(const arma::mat& coordinates) const { const arma::mat rrt = coordinates * trans(coordinates); return accu(SDP().C() % rrt); }