45 #include "RTOp_obj_null_vtbl.h"
46 #include "RTOp_obj_value_vtbl.h"
47 #include "RTOp_reduct_sum_value.h"
58 static int RTOp_ROp_num_nonzeros_apply_op(
62 , RTOp_ReductTarget targ_obj )
64 RTOp_index_type v0_sub_dim;
65 const RTOp_value_type *v0_val;
67 register RTOp_index_type k;
68 RTOp_index_type nz = 0;
74 return RTOp_ERR_INVALID_NUM_VECS;
76 if( num_targ_vecs != 0 )
77 return RTOp_ERR_INVALID_NUM_TARG_VECS;
84 v0_sub_dim = vecs[0].sub_dim;
85 v0_val = vecs[0].values;
86 v0_val_s = vecs[0].values_stride;
92 for( k = 0; k < v0_sub_dim; ++k, v0_val += v0_val_s )
99 *((RTOp_value_type*)targ_obj) += nz;
108 ,&RTOp_obj_value_vtbl
111 ,RTOp_ROp_num_nonzeros_apply_op
112 ,RTOp_reduct_sum_value
113 ,RTOp_get_reduct_sum_value_op
118 int RTOp_ROp_num_nonzeros_construct(
struct RTOp_RTOp* op )
121 op->vtbl = &RTOp_ROp_num_nonzeros_vtbl;
125 int RTOp_ROp_num_nonzeros_destroy(
struct RTOp_RTOp* op )
132 RTOp_index_type RTOp_ROp_num_nonzeros_val(RTOp_ReductTarget targ_obj)
134 return (RTOp_index_type)*((RTOp_value_type*)targ_obj);