sg-ode
|
The minimal set of operations that a vector driver must support. More...
#include <vector.h>
Data Fields | |
size_t(* | len )(const SgVectorDriverBase *self) |
Retrieve the length of vectors created by this driver. More... | |
SgVector *(* | try_new )(const SgVectorDriverBase *self) |
Creates a new uninitialized vector with a fixed length determined by the SgVectorDriver . More... | |
void(* | del )(const SgVectorDriverBase *self, SgVector *vector) |
Destroys a vector. More... | |
void(* | operate )(const SgVectorDriverBase *self, SgVectorAccum *accum, SgVectorAccumType accum_type, SgVectorOperation *f, void *f_ctx, size_t offset, SgVector **vectors, size_t num_vectors) |
Applies an element-wise operation (map) to a set of vectors and then accumulates a combined result (fold) of a monoidal operation. More... | |
The minimal set of operations that a vector driver must support.
A vector driver allows element-wise operations and reductions on a vector, as well as creation and destruction.
void(* SgVectorDriverVt::del) (const SgVectorDriverBase *self, SgVector *vector) |
Destroys a vector.
This is a no-op if the vector is null.
size_t(* SgVectorDriverVt::len) (const SgVectorDriverBase *self) |
Retrieve the length of vectors created by this driver.
void(* SgVectorDriverVt::operate) (const SgVectorDriverBase *self, SgVectorAccum *accum, SgVectorAccumType accum_type, SgVectorOperation *f, void *f_ctx, size_t offset, SgVector **vectors, size_t num_vectors) |
Applies an element-wise operation (map) to a set of vectors and then accumulates a combined result (fold) of a monoidal operation.
This is a generic interface for performing many kinds of operations on vectors, possibly in parallel.
[in,out] | self | A pointer to the associated SgVectorDriver . |
[in,out] | accum | A pointer to an array containing the monoidal identity. This value shall be updated with the result at the end of the calculation. If accum_type is zero, the pointer is ignored. |
[in] | accum_type | If positive, the accumulator shall be an array of unsigned char with length accum_type . If negative, the accumulator shall be an array of double with length -accum_type . If zero, accum is ignored. |
[in] | f | The operation that is being performed. See SgVectorOperation . |
[in] | offset | The starting index. |
[in,out] | vectors | The vectors that are to be read and possibly modified. If a vector is being modified, it must appear only once inside the array of vectors . |
[in] | num_vectors | The number of vectors . |
SgVector*(* SgVectorDriverVt::try_new) (const SgVectorDriverBase *self) |
Creates a new uninitialized vector with a fixed length determined by the SgVectorDriver
.