---
title: "la_vector_from_matrix_diagonal(_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/la_vector_from_matrix_diagonal(_:_:)"
---

# la_vector_from_matrix_diagonal(_:_:)

Creates a vector from the specified diagonal of the matrix.

## Declaration

```swift
func la_vector_from_matrix_diagonal(_ matrix: la_object_t, _ matrix_diagonal: la_index_t) -> la_object_t
```

## Parameters

- `matrix`: Matrix from which to create the vector.
- `matrix_diagonal`: The index of the diagonal to create the vector from.

## Return Value

Return Value The resulting vector is a length x 1 vector where length is min(rows(matrix),cols(matrix)-abs(matrix_diagonal)

## Discussion

Discussion Creates a vector from the specified diagonal of the matrix.  If the value for matrix_diagonal is less than zero and abs(matrix_diagonal) > rows(matrix)-1, or if matrix_diagonal is greater than zero and matrix_diagonal >  cols(matrix)-1, LA_INVALID_PARAMETER_ERROR is returned. If matrix is a splat, LA_INVALID_PARAMETER_ERROR is returned. Always returns a vector_length x 1 vector.

## See Also

### Functions

- [caxpy_(_:_:_:_:_:_:)](accelerate/caxpy_(_:_:_:_:_:_:).md)
- [ccopy_(_:_:_:_:_:)](accelerate/ccopy_(_:_:_:_:_:).md)
- [cdotc_(_:_:_:_:_:_:)](accelerate/cdotc_(_:_:_:_:_:_:).md)
- [cdotu_(_:_:_:_:_:_:)](accelerate/cdotu_(_:_:_:_:_:_:).md)
- [cgbmv_(_:_:_:_:_:_:_:_:_:_:_:_:_:)](accelerate/cgbmv_(_:_:_:_:_:_:_:_:_:_:_:_:_:).md)
- [cgemm_(_:_:_:_:_:_:_:_:_:_:_:_:_:)](accelerate/cgemm_(_:_:_:_:_:_:_:_:_:_:_:_:_:).md)
- [cgemv_(_:_:_:_:_:_:_:_:_:_:_:)](accelerate/cgemv_(_:_:_:_:_:_:_:_:_:_:_:).md)
- [cgerc_(_:_:_:_:_:_:_:_:_:)](accelerate/cgerc_(_:_:_:_:_:_:_:_:_:).md)
- [cgeru_(_:_:_:_:_:_:_:_:_:)](accelerate/cgeru_(_:_:_:_:_:_:_:_:_:).md)
- [chbmv_(_:_:_:_:_:_:_:_:_:_:_:)](accelerate/chbmv_(_:_:_:_:_:_:_:_:_:_:_:).md)
- [chemm_(_:_:_:_:_:_:_:_:_:_:_:_:)](accelerate/chemm_(_:_:_:_:_:_:_:_:_:_:_:_:).md)
- [chemv_(_:_:_:_:_:_:_:_:_:_:)](accelerate/chemv_(_:_:_:_:_:_:_:_:_:_:).md)
- [cher2_(_:_:_:_:_:_:_:_:_:)](accelerate/cher2_(_:_:_:_:_:_:_:_:_:).md)
- [cher2k_(_:_:_:_:_:_:_:_:_:_:_:_:)](accelerate/cher2k_(_:_:_:_:_:_:_:_:_:_:_:_:).md)
- [cher_(_:_:_:_:_:_:_:)](accelerate/cher_(_:_:_:_:_:_:_:).md)
