45 #include "RTOp_obj_null_vtbl.h"
46 #include "RTOp_obj_value_vtbl.h"
47 #include "RTOp_reduct_sum_value.h"
51 static int RTOp_ROp_sum_apply_op(
55 , RTOp_ReductTarget targ_obj )
57 RTOp_index_type v0_sub_dim;
58 const RTOp_value_type *v0_val;
60 register RTOp_index_type k;
61 RTOp_value_type sum = 0.0;
67 return RTOp_ERR_INVALID_NUM_VECS;
68 if( num_targ_vecs != 0 )
69 return RTOp_ERR_INVALID_NUM_TARG_VECS;
76 v0_sub_dim = vecs[0].sub_dim;
77 v0_val = vecs[0].values;
78 v0_val_s = vecs[0].values_stride;
84 for( k = 0; k < v0_sub_dim; ++k, v0_val += v0_val_s )
90 *((RTOp_value_type*)targ_obj) += sum;
102 ,RTOp_ROp_sum_apply_op
103 ,RTOp_reduct_sum_value
104 ,RTOp_get_reduct_sum_value_op
109 int RTOp_ROp_sum_construct(
struct RTOp_RTOp* op )
112 op->vtbl = &RTOp_ROp_sum_vtbl;
116 int RTOp_ROp_sum_destroy(
struct RTOp_RTOp* op )
123 RTOp_value_type RTOp_ROp_sum_val(RTOp_ReductTarget targ_obj)
125 return *((RTOp_value_type*)targ_obj);