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

# la_vector_slice(_:_:_:_:)

## Declaration

```swift
func la_vector_slice(_ vector: la_object_t, _ vector_first: la_index_t, _ vector_stride: la_index_t, _ slice_length: la_count_t) -> la_object_t
```

## Parameters

- `vector`: The vector to be sliced.
- `vector_first`: The index of the source vector element that will become the first element of the new slice vector.
- `vector_stride`: The offset in the source vector between elements that will be consecutive in the new slice vector.
- `slice_length`: The length of the resulting slice vector.

## Return Value

Return Value A new vector with length slice_length whose elements are taken from vector.

## Discussion

Discussion Create a slice of a vector. The result object is the vector: [ vector[vector_first], vector[vector_first+vector_stride], … … , vector[vector_first + (slice_length-1)*vector_stride] ] Slices provide an efficient means to operate on subvectors and strides. These are lightweight objects that reference the storage of the vector from which they originate.  Creating a vector slice does not require any allocation beyond the object representing the slice, nor does it require copying. This function supports slicing a vector, or a matrix that has only one row or only one column.  If the object is not a matrix or vector, or if it is a matrix with both dimensions larger than one, 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 length of the vector, LA_SLICE_OUT_OF_BOUNDS_ERROR is returned. Always return a vector with the same orientation as the input.  If input is vector_length x 1, output is vector_length x 1 and if input is 1 x vector_length, output is 1 x vector_length.

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