function diagonal( matrix, v ) {
	var M = matrix.shape[ 0 ];
	var i;
	for ( i = 0; i < M; i++ ) {
		matrix.set( i, i, v );
	}
	return matrix;
}
Sets the values along the main diagonal of a square matrix.

@private
@param {ndarray} matrix - input square matrix
@param {number} v - value
@returns {ndarray} input matrix