Skip to contents

Sets A[i,j] to 0 wherever the chosen comparison against x holds, leaving every other element unchanged – TDA's mnc (documented in tda.hlp). test chooses the comparison: "<=", "<", ">=", ">" (against the raw value), or the same four prefixed "abs" (against abs(A[i,j])).

Usage

tda_mnc(
  A,
  x,
  test = c("<=", "<", ">=", ">", "abs<=", "abs<", "abs>=", "abs>"),
  dir = tempfile("tda")
)

Arguments

A

a numeric matrix.

x

the threshold.

test

which comparison zeroes an element; see above.

dir

working directory.

Value

A numeric matrix.

Examples

A <- matrix(c(1, 5, 3, -2, 4, 6), 2, 3)
tda_mnc(A, 3, "<=")   # zero out every element <= 3
#>      [,1] [,2] [,3]
#> [1,]    0    0    4
#> [2,]    5    0    6