48 #include "RTOp_obj_null_vtbl.h"
52 static int RTOp_TOp_sign_apply_op(
56 , RTOp_ReductTarget reduct_obj )
63 RTOp_index_type sub_dim;
65 RTOp_value_type *z0_val;
68 const RTOp_value_type *v0_val;
72 register RTOp_index_type k;
77 if( num_vecs != 1 || ( num_vecs && vecs == NULL ) )
78 return RTOp_ERR_INVALID_NUM_VECS;
79 if( num_targ_vecs != 1 || ( num_targ_vecs && targ_vecs == NULL ) )
80 return RTOp_ERR_INVALID_NUM_TARG_VECS;
82 targ_vecs[0].sub_dim != vecs[0].sub_dim
84 return RTOp_ERR_INCOMPATIBLE_VECS;
90 sub_dim = vecs[0].sub_dim;
92 z0_val = targ_vecs[0].values;
93 z0_val_s = targ_vecs[0].values_stride;
95 v0_val = vecs[0].values;
96 v0_val_s = vecs[0].values_stride;
102 for( k = 0; k < sub_dim; ++k, v0_val += v0_val_s, z0_val += z0_val_s )
105 (*z0_val) = ( (*v0_val) == 0.0 ? 0.0 : ( (*v0_val) < 0.0 ? -1.0 : +1.0 ) );
118 ,RTOp_TOp_sign_apply_op
125 int RTOp_TOp_sign_construct(
struct RTOp_RTOp* op )
131 op->vtbl = &RTOp_TOp_sign_vtbl;
132 op->vtbl->obj_data_vtbl->
obj_create(NULL,NULL,&op->obj_data);
136 int RTOp_TOp_sign_destroy(
struct RTOp_RTOp* op )
138 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)