Contents

la_vector_to_float_buffer(_:_:_:)

Declaration

func la_vector_to_float_buffer(_ buffer: UnsafeMutablePointer<Float>, _ buffer_stride: la_index_t, _ vector: la_object_t) -> la_status_t

Parameters

  • buffer:

    Pointer to the destination buffer.

  • buffer_stride:

    Offset (in floats) between the destinations of consecutive vector elements in the buffer. Negative strides are not supported (you can get the same effect by reversing the vector before calling this function).

  • vector:

    The vector to store.

Discussion

Stores the elements of a vector to a buffer.

The buffer must be large enough to accomodate the vector being stored. Specifically, it must have have sufficient space to hold

buffer_stride*(la_vector_length(vector)-1) + 1

float elements. Real usage in the most common case (stride = 1) will look roughly like this:

la_count_t length = la_vector_length(vector); if (!length) { // an error occured. } float *buffer = malloc(length * sizeof buffer[0]); la_vector_to_float_buffer(buffer, 1, vector);

This function supports storing the contents of a vector, or a matrix that has only one row or only one column. If the object satisfies those requirements, and it does not have an error status, its contents are stored to the buffer. If it has an error status, NaNs are stored to the buffer.

If the object is not a matrix or vector, or if it is a matrix with both dimensions larger than one, nothing is written to the buffer and LA_INVALID_PARAMETER_ERROR is returned.

See Also

Functions