sg-ode
Data Fields
SgVectorDriverVt Struct Reference

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...
 

Detailed Description

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.

Field Documentation

◆ del

void(* SgVectorDriverVt::del) (const SgVectorDriverBase *self, SgVector *vector)

Destroys a vector.

This is a no-op if the vector is null.

◆ len

size_t(* SgVectorDriverVt::len) (const SgVectorDriverBase *self)

Retrieve the length of vectors created by this driver.

◆ operate

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.

Parameters
[in,out]selfA pointer to the associated SgVectorDriver.
[in,out]accumA 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_typeIf 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]fThe operation that is being performed. See SgVectorOperation.
[in]offsetThe starting index.
[in,out]vectorsThe 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_vectorsThe number of vectors.

◆ try_new

SgVector*(* SgVectorDriverVt::try_new) (const SgVectorDriverBase *self)

Creates a new uninitialized vector with a fixed length determined by the SgVectorDriver.


The documentation for this struct was generated from the following file: