Function scale

Source
pub unsafe extern "C" fn scale(
    n: c_int,
    alpha: c_float,
    x: *mut c_float,
    inc_x: c_int,
)
Expand description

Multiplies each element of a vector by a constant.

This function performs the operation x[i] = alpha * x[i] for each element in the vector x.

§Precision

This function operates on single-precision (f32) numbers.

§Parameters

  • n: The number of elements in the vector x.
  • alpha: The constant to multiply each element of x by.
  • x: A pointer to the vector x. The result is stored in-place.
  • inc_x: Stride within x. For example, if inc_x is 7, every 7th element is scaled by alpha.

§Safety

This is an unsafe C function. The caller must ensure that the pointer passed to x is valid and that accessing x up to n * inc_x is safe.