Function rc_vector_times_scalar#

Function Documentation#

int rc_vector_times_scalar(rc_vector_t *v, double s)#

Multiplies every entry in vector v by scalar s.

It is not strictly necessary for v to be provided as a pointer since a copy of the struct v would also contain the correct pointer to the original vector’s allocated memory. However, in this library we use the convention of passing an rc_vector_t struct or rc_matrix_struct as a pointer when its data is to be modified by the function, and as a normal argument when it is only to be read by the function.

Parameters:
  • v – Pointer to user’s rc_vector_t struct

  • s[in] scalar multiplier

Returns:

Returns 0 on success or -1 on failure.