Equivalent to abs(x - y)
but aims to be faster by
avoiding allocations.
abs_diff(x, y, nThread = getOption("hutilscpp.nThread", 1L), option = 1L)max_abs_diff(x, y, nThread = getOption("hutilscpp.nThread", 1L))
Atomic, numeric, equilength vectors.
Number of threads to use.
An integer, provides backwards-compatible method to change results.
Return max(abs(x - y))
(without allocation).
Return abs(x - y)
with the expectation that every element will be integer
,
returning a double
only if required.
Return abs(x - y)
but always a double
vector, regardless of necessity.
Return which.max(abs(x - y))
x <- sample(10)
y <- sample(10)
abs_diff(x, y)
max_abs_diff(x, y)
Run the code above in your browser using DataLab