45 #include "RTOp_obj_value_vtbl.h"
46 #include "RTOp_obj_null_vtbl.h"
50 static int RTOp_TOp_assign_scalar_apply_op(
54 , RTOp_ReductTarget targ_obj )
61 const RTOp_value_type alpha = *((RTOp_value_type*)obj_data);
64 RTOp_index_type z_sub_dim = targ_vecs[0].sub_dim;
65 RTOp_value_type *z_val = targ_vecs[0].values;
66 ptrdiff_t z_val_s = targ_vecs[0].values_stride;
68 register RTOp_index_type k;
74 if( num_vecs != 0 || vecs != NULL )
75 return RTOp_ERR_INVALID_NUM_VECS;
76 if( num_targ_vecs != 1 || targ_vecs == NULL )
77 return RTOp_ERR_INVALID_NUM_TARG_VECS;
83 for( k = 0; k < z_sub_dim; ++k, z_val += z_val_s )
96 ,RTOp_TOp_assign_scalar_apply_op
103 int RTOp_TOp_assign_scalar_construct( RTOp_value_type alpha,
struct RTOp_RTOp* op )
105 op->vtbl = &RTOp_TOp_assign_scalar_vtbl;
106 op->vtbl->obj_data_vtbl->
obj_create(NULL,NULL,&op->obj_data);
107 *((RTOp_value_type*)op->obj_data) = alpha;
111 int RTOp_TOp_assign_scalar_destroy(
struct RTOp_RTOp* op )
113 op->vtbl->obj_data_vtbl->
obj_free(NULL,NULL,&op->obj_data);
118 int RTOp_TOp_assign_scalar_set_alpha( RTOp_value_type alpha,
struct RTOp_RTOp* op )
120 *((RTOp_value_type*)op->obj_data) = alpha;
int(* obj_create)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)
int(* obj_free)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)