1 #ifndef G_LD1RHWBBXD615K1PEKWNYBSHDF5Q8 2 #define G_LD1RHWBBXD615K1PEKWNYBSHDF5Q8 8 #include "inline_begin.h" 9 #include "restrict_begin.h" 62 const SgVectorAccum *val,
77 size_t (*
len)(
const SgVectorDriverBase *
self);
81 SgVector *(*try_new)(
const SgVectorDriverBase *
self);
84 void (*
del)(
const SgVectorDriverBase *
self, SgVector *vector);
120 void (*
operate)(
const SgVectorDriverBase *
self,
121 SgVectorAccum *accum,
122 SgVectorAccumType accum_type,
133 const SgVectorDriverBase *data;
152 SgVectorAccum *accum,
153 SgVectorAccumType accum_type,
174 SG_EXTERN
void sg_vector_neg_assign(
struct SgVectorDriver drv, SgVector *z);
232 const SgVector *vector);
250 drv.vtable = &SG_BASIC_VECTOR_DRIVER_VT;
257 #include "restrict_end.h" 258 #include "inline_end.h" void sg_vector_del(struct SgVectorDriver drv, SgVector *vector)
Destroys the vector.
Definition: vector.c:22
void SgVectorOperation(void *f_ctx, SgVectorAccum *accum, const SgVectorAccum *val, size_t offset, double **data, size_t num_elems)
An operation suitable for use in SgVectorDriverVt.operate.
Definition: vector.h:60
void(* del)(const SgVectorDriverBase *self, SgVector *vector)
Destroys a vector.
Definition: vector.h:84
int SgVectorAccumType
The type of an accumulator.
Definition: vector.h:35
void sg_vector_linear_assign(struct SgVectorDriver drv, double alpha, double beta, const SgVector *y, SgVector *z)
Calculate z ← α z + β y.
double sg_vector_sum(struct SgVectorDriver drv, const SgVector *vector)
Sums the values of a vector.
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 (f...
Definition: vector.h:120
A vector driver.
Definition: vector.h:132
void sg_vector_operate(struct SgVectorDriver drv, SgVectorAccum *accum, SgVectorAccumType accum_type, SgVectorOperation *f, void *f_ctx, size_t offset, SgVector **vectors, size_t num_vectors)
Perform a generic operation on some vectors.
Definition: vector.c:32
SgVector * sg_vector_new(struct SgVectorDriver drv)
Creates a vector.
Definition: vector.c:15
void SgVectorAccum
An accumulator is an array of some kind.
Definition: vector.h:18
void SgVectorDriverBase
Represents an opaque vector driver.
Definition: vector.h:68
size_t sg_vector_len(struct SgVectorDriver drv)
Gets the length of any vector created by this vector driver.
Definition: vector.c:27
void sg_vector_fill(struct SgVectorDriver drv, double value, SgVector *vector)
Set every element of a vector to the same value.
Definition: vector.c:45
size_t(* len)(const SgVectorDriverBase *self)
Retrieve the length of vectors created by this driver.
Definition: vector.h:77
void sg_vector_scale(struct SgVectorDriver drv, double alpha, const SgVector *x, SgVector *z)
Calculate scalar multiplication of a vector.
void sg_vector_copy(struct SgVectorDriver drv, const SgVector *src, SgVector *dest)
Copy the contents of a vector.
Definition: vector.c:83
void sg_vector_linear(struct SgVectorDriver drv, double alpha, const SgVector *x, double beta, const SgVector *y, SgVector *z)
Calculate the linear combination of two vectors.
The minimal set of operations that a vector driver must support.
Definition: vector.h:75
SgVectorOperation sg_vector_sum_operation
The underlying operation used by sg_vector_sum.
void sg_vector_scale_assign(struct SgVectorDriver drv, double alpha, SgVector *z)
In-place scalar multiplication of a vector.
SgVector * sg_vector_try_new(struct SgVectorDriver drv)
Creates a vector, returning NULL if it fails.
Definition: vector.c:10
void SgVector
A vector is an opaque data type containing a finite number of doubles.
Definition: vector.h:15