la_vector_slice(_:_:_:_:)
Declaration
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_tParameters
- 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
A new vector with length slice_length whose elements are taken from vector.
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_(_:_:_:_:_:_:)ccopy_(_:_:_:_:_:)cdotc_(_:_:_:_:_:_:)cdotu_(_:_:_:_:_:_:)cgbmv_(_:_:_:_:_:_:_:_:_:_:_:_:_:)cgemm_(_:_:_:_:_:_:_:_:_:_:_:_:_:)cgemv_(_:_:_:_:_:_:_:_:_:_:_:)cgerc_(_:_:_:_:_:_:_:_:_:)cgeru_(_:_:_:_:_:_:_:_:_:)chbmv_(_:_:_:_:_:_:_:_:_:_:_:)chemm_(_:_:_:_:_:_:_:_:_:_:_:_:)chemv_(_:_:_:_:_:_:_:_:_:_:)cher2_(_:_:_:_:_:_:_:_:_:)cher2k_(_:_:_:_:_:_:_:_:_:_:_:_:)cher_(_:_:_:_:_:_:_:)