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

# la_matrix_slice(_:_:_:_:_:_:_:)

## Declaration

```swift
func la_matrix_slice(_ matrix: la_object_t, _ matrix_first_row: la_index_t, _ matrix_first_col: la_index_t, _ matrix_row_stride: la_index_t, _ matrix_col_stride: la_index_t, _ slice_rows: la_count_t, _ slice_cols: la_count_t) -> la_object_t
```

## Parameters

- `matrix`: The matrix to be sliced.
- `matrix_first_row`: The index of the row of the source matrix containing the first element of new slice matrix.
- `matrix_first_col`: The index of the column of the source matrix containing the first element of the slice matrix.
- `matrix_row_stride`: The offset in the source matrix between rows that will be consecutive in the slice matrix.
- `matrix_col_stride`: The offset in the source matrix between columns that will be consecutve in the slice matrix.
- `slice_rows`: The number of rows in the slice matrix.
- `slice_cols`: The number of columns in the slice matrix.

## Return Value

Return Value A new matrix with size slice_rows x slice_cols whose elements are taken from the source matrix.

## Discussion

Discussion Create a slice of a matrix. The result object is the slice_rows x slice_cols matrix whose i,jth entry is: matrix[matrix_first_row + imatrix_row_stride, matrix_first_col + jmatrix_col_stride] Slices provide an efficient means to operate on tiles and strides.  These are lightweight objects that reference the storage of the matrix from which they originate.  In most cases, creating a slice does not require any allocation beyond the object representing the slice, nor require copying.  In some less common cases, a copy may be required. This function supports slicing a vector (interpreted as rows(matrix) x cols(matrix)) or a matrix.  If the object is not a matrix or vector, the returned object will have status LA_INVALID_PARAMETER_ERROR. If the slice references indices that are less than zero or greater than or equal to the dimensions of the matrix, LA_SLICE_OUT_OF_BOUNDS_ERROR is returned.

## 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)
