hard_threshold: Hard-thresholding operator

View source: R/hard_threshold.R

hard_thresholdR Documentation

Hard-thresholding operator

Description

hard_threshold() implements the hard-thresholding operator on a given matrix D, making D sparser: elements of D whose absolute value are less than a given threshold thresh are set to 0, i.e. D[|D| < thresh] = 0.

This is used in the non-convex PCP function rrmc() to provide a non-convex replacement for the prox_l1() method used in the convex PCP function root_pcp(). It is used to iteratively model the sparse S matrix with the help of an adaptive threshold (thresh changes over the course of optimization).

Usage

hard_threshold(D, thresh)

Arguments

D

The input data matrix.

thresh

The scalar-valued hard-threshold acting on D such that D[i, j] = 0 when abs(D[i, j]) < thresh, and D[i, j] = D[i, j] otherwise.

Value

The hard-thresholded matrix.

Examples

set.seed(42)
D <- matrix(rnorm(25), 5, 5)
S <- hard_threshold(D, thresh = 1)
D
S

Columbia-PRIME/pcpr documentation built on April 14, 2025, 8:33 a.m.