10 const Eigen::VectorXd& beta,
11 const Eigen::ArrayXd& lambda,
12 const std::vector<int>& indices)
14 using namespace Eigen;
24 VectorXd flat_abs_gradient = gradient(indices).cwiseAbs();
26 auto ord =
sortIndex(flat_abs_gradient,
true);
29 ArrayXd diff = flat_abs_gradient(ord).array() - lambda.head(indices.size());
33 auto which_violations =
which(tmp);
35 for (
const auto& ind : which_violations) {
36 out.emplace_back(indices[ind]);
Karush-Kuhn-Tucker (KKT) optimality condition checking for SLOPE regression.
Mathematical support functions for the slope package.
Namespace containing SLOPE regression implementation.
Eigen::Array< bool, Eigen::Dynamic, 1 > ArrayXb
Dynamic-size column vector of boolean values Wrapper around Eigen::Array<bool, Eigen::Dynamic,...
std::vector< int > kktCheck(const Eigen::VectorXd &gradient, const Eigen::VectorXd &beta, const Eigen::ArrayXd &lambda, const std::vector< int > &indices)
Checks KKT conditions for SLOPE optimization.
std::vector< int > which(const T &x)
Eigen::ArrayXd cumSum(const T &x)
std::vector< int > sortIndex(T &v, const bool descending=false)
void inversePermute(T &values, const std::vector< int > &ind)
Various utility functions.