Contents

la_diagonal_matrix_from_vector(_:_:)

Declaration

func la_diagonal_matrix_from_vector(_ vector: la_object_t, _ matrix_diagonal: la_index_t) -> la_object_t

Parameters

  • vector:

    Vector providing the data for the non-zero diagonal.

  • matrix_diagonal:

    The index of the non-zero diagonal.

Discussion

Create a matrix with a specified diagonal provided by a vector, and zeros in all the other entries.

Creates a new matrix with entries on the specified diagonal taken from the vector argument, and zeros in the other entries. The matrix is square, and has size length(vector) + abs(matrix_diagonal).

If matrix_diagonal is zero, the main diagonal is set. If matrix_diagonal is +1, the first superdiagonal is set. If matrix_diagonal is -2, the second subdiagonal is set.

The diagonal may be specified by a vector or by a matrix that has only one row or only one column. If the provided object is not a vector or matrix, or is a matrix with both dimensions larger than one, the returned object will have status LA_INVALID_PARAMETER_ERROR.

See Also

Functions