This is the latest (main) BeagleBoard documentation. If you are looking for stable releases, use the drop-down menu on the bottom-left and select the desired version.

Function rc_matrix_diagonal

Function Documentation

int rc_matrix_diagonal(rc_matrix_t *A, rc_vector_t v)

Generates a diagonal matrix with the elements of specified vector v.

Resizes A to be a square matrix with the same number of rows and columns as vector v’s length. The diagonal entries of A are then populated with the contents of v and the off-diagonal entries are set to 0. The original contents of A are freed to avoid memory leaks.

Parameters
  • A – Pointer to user’s matrix struct

  • v[in] vector of diagonal entries

Returns

0 on success, -1 on failure.