54 #define max(a,b) ( (a) > (b) ? (a) : (b) )
55 #define min(a,b) ( (a) < (b) ? (a) : (b) )
58 #include "RTOp_obj_null_vtbl.h"
64 static int RTOp_TOp_ele_wise_sqrt_apply_op(
68 , RTOp_ReductTarget reduct_obj )
75 RTOp_index_type sub_dim;
77 RTOp_value_type *z0_val;
81 register RTOp_index_type k;
86 if( num_vecs != 0 || ( num_vecs && vecs == NULL ) )
87 return RTOp_ERR_INVALID_NUM_VECS;
88 if( num_targ_vecs != 1 || ( num_targ_vecs && targ_vecs == NULL ) )
89 return RTOp_ERR_INVALID_NUM_TARG_VECS;
95 sub_dim = targ_vecs[0].sub_dim;
97 z0_val = targ_vecs[0].values;
98 z0_val_s = targ_vecs[0].values_stride;
104 for( k = 0; k < sub_dim; ++k, z0_val += z0_val_s )
107 assert(*z0_val >= 0);
108 (*z0_val) = sqrt((*z0_val));
121 ,RTOp_TOp_ele_wise_sqrt_apply_op
128 int RTOp_TOp_ele_wise_sqrt_construct(
struct RTOp_RTOp* op )
134 op->vtbl = &RTOp_TOp_ele_wise_sqrt_vtbl;
135 op->vtbl->obj_data_vtbl->
obj_create(NULL,NULL,&op->obj_data);
139 int RTOp_TOp_ele_wise_sqrt_destroy(
struct RTOp_RTOp* op )
141 op->vtbl->obj_data_vtbl->
obj_free(NULL,NULL,&op->obj_data);
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)