Learn R Programming

pcpr (version 1.0.0)

hard_threshold: 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)

Value

The hard-thresholded matrix.

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.

Examples

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

Run the code above in your browser using DataLab