45 #include "RTOp_obj_value_vtbl.h"
46 #include "RTOp_obj_null_vtbl.h"
50 static int RTOp_TOp_scale_vector_apply_op(
54 , RTOp_ReductTarget targ_obj )
56 RTOp_value_type alpha = 0.0;
57 RTOp_index_type z_sub_dim;
58 RTOp_value_type *z_val;
60 register RTOp_index_type k;
66 if( num_vecs != 0 || vecs != NULL )
67 return RTOp_ERR_INVALID_NUM_VECS;
68 if( num_targ_vecs != 1 || targ_vecs == NULL )
69 return RTOp_ERR_INVALID_NUM_TARG_VECS;
77 alpha = *((RTOp_value_type*)obj_data);
80 z_sub_dim = targ_vecs[0].sub_dim;
81 z_val = targ_vecs[0].values;
82 z_val_s = targ_vecs[0].values_stride;
88 for( k = 0; k < z_sub_dim; ++k, z_val += z_val_s )
101 ,RTOp_TOp_scale_vector_apply_op
108 int RTOp_TOp_scale_vector_construct( RTOp_value_type alpha,
struct RTOp_RTOp* op )
110 op->vtbl = &RTOp_TOp_scale_vector_vtbl;
111 op->vtbl->obj_data_vtbl->
obj_create(NULL,NULL,&op->obj_data);
112 *((RTOp_value_type*)op->obj_data) = alpha;
116 int RTOp_TOp_scale_vector_destroy(
struct RTOp_RTOp* op )
118 op->vtbl->obj_data_vtbl->
obj_free(NULL,NULL,&op->obj_data);
123 int RTOp_TOp_scale_vector_set_alpha( RTOp_value_type alpha,
struct RTOp_RTOp* op )
125 *((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)