Learn R Programming

IFC (version 0.1.1)

cpp_resize: Matrix Resizing

Description

Resizes mat according to new_height and new_width parameters.

Arguments

mat

a numeric matrix.

new_height

an unsigned integer, giving the new height of returned mat. Default is 0 for no change.

new_width

an unsigned integer, giving the new width of returned mat. Default is 0 for no change.

add_noise

logical, if true adds normal noise when at least one new dimension is larger than original mat dimensions Rcpp::rnorm() function is used. Default is true.

bg

double, mean value of the background added if add_noise is true. Default is 0.

sd

double, standard deviation of the background added if add_noise is true. Default is 0.

Value

a resized matrix with padding background if new_height or new_width is larger than original mat dimensions.