Function rc_matrix_times_scalar#

Function Documentation#

int rc_matrix_times_scalar(rc_matrix_t *A, double s)#

Multiplies every entry in A by scalar value s.

It is not strictly necessary for A to be provided as a pointer since a copy of the struct A would also contain the correct pointer to the original matrix’s allocated memory. However, in this library we use the convention of passing an rc_vector_t struct or rc_matrix_t 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:
  • A – Matrix to be modified

  • s[in] scalar to multiply by

Returns:

Returns 0 on success or -1 on failure.