Function

sparse_inner_product_sparse_float(_:_:_:_:_:_:)

Computes the inner product of sparse vector x with sparse vector y, with both vectors containing single-precision values.

Declaration

func sparse_inner_product_sparse_float(_ nzx: sparse_dimension, _ nzy: sparse_dimension, _ x: UnsafePointer<Float>!, _ indx: UnsafePointer<sparse_index>!, _ y: UnsafePointer<Float>!, _ indy: UnsafePointer<sparse_index>!) -> Float

Parameters

nzx

The number of nonzero entries in the sparse vector x.

nzy

The number of nonzero entries in the sparse vector y.

x

Pointer to the dense storage for the values of the sparse vector x. The corresponding entry in indx holds the index of the value. Contains nzx values.

indx

Pointer to the dense storage for the index values of the sparse vector x. The corresponding entry in x holds the values of the vector. Contains nzx values.

y

Pointer to the dense storage for the values of the sparse vector y. The corresponding entry in indy holds the index of the value. Contains nzy values.

indy

Pointer to the dense storage for the index values of the sparse vector y. The corresponding entry in y holds the values of the vector. Contains nzy values.

Return Value

The inner product of sparse vector x with sparse vector y. Returns zero if nzx or nzy is less than or equal to zero.

Discussion

Indices in indx and indy are always assumed to be stored in ascending order. Additionally, indices are assumed to be unique. The behavior of this function is undefined if either of these assumptions are not met.

All indices are 0 based (the first element of a pointer is ptr[0]).

See Also

Vector-Vector Operations

func sparse_inner_product_dense_double(sparse_dimension, UnsafePointer<Double>!, UnsafePointer<sparse_index>!, UnsafePointer<Double>!, sparse_stride) -> Double

Computes the inner product of sparse vector x with double-precision y, with both vectors containing double-precision values.

func sparse_inner_product_dense_float(sparse_dimension, UnsafePointer<Float>!, UnsafePointer<sparse_index>!, UnsafePointer<Float>!, sparse_stride) -> Float

Computes the inner product of sparse vector x with dense vector y, with both vectors containing single-precision values.

func sparse_vector_add_with_scale_dense_double(sparse_dimension, Double, UnsafePointer<Double>!, UnsafePointer<sparse_index>!, UnsafeMutablePointer<Double>!, sparse_stride)

Scales the sparse vector x by alpha and adds the result to the dense vector y, with both vectors containing double-precision values.

func sparse_vector_add_with_scale_dense_float(sparse_dimension, Float, UnsafePointer<Float>!, UnsafePointer<sparse_index>!, UnsafeMutablePointer<Float>!, sparse_stride)

Scales the sparse vector x by alpha and adds the result to the dense vector y, with both vectors containing single-precision values.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software