Function rc_matrix_identity#

Function Documentation#

int rc_matrix_identity(rc_matrix_t *A, int dim)#

Resizes A to be a square identity matrix with dimensions dim-by-dim.

Any existing memory allocated for A is freed if necessary to avoid memory leaks before new memory is allocated for the specified dimension.

Parameters:
  • A – Pointer to user’s matrix struct

  • dim[in] The dimension of one side of square matrix

Returns:

0 on success, -1 on failure.