73 if( num_vecs != 2 || vecs == NULL )
75 if( num_targ_vecs != 1 || targ_vecs == NULL )
77 if( targ_vecs[0].sub_dim != vecs[0].sub_dim
78 || targ_vecs[0].sub_dim != vecs[1].sub_dim
79 || targ_vecs[0].global_offset != vecs[0].global_offset
80 || targ_vecs[0].global_offset != vecs[1].global_offset )
89 c_val = targ_vecs[0].
values;
102 if( c_val_s == 1 && xD_val_s == 1 && xI_val_s == 1 ) {
104 for( k = 0; k < sub_dim; ++k, ++xI_val )
105 *c_val++ = (*xD_val++) * (*xI_val - 1.0) - 10.0 * (*xI_val);
109 for( k = 0; k < sub_dim; ++k, c_val+=c_val_s, xD_val+=xD_val_s, xI_val+=xI_val_s )
110 *c_val = (*xD_val) * (*xI_val - 1.0) - 10.0 * (*xI_val);
120 ,
"TOp_explnlp2_c_eval"
167 int all_unit_stride = 0;
173 task = *(
int*)obj_data;
174 assert(0 <= task && task <= 2);
179 if( ( (task == 0 || task == 1) && num_vecs != 2 )
180 || ( (task == 2) && num_vecs != 3 )
183 if( ( (task == 0 || task == 1) && num_targ_vecs != 1 )
184 || ( (task == 2) && num_targ_vecs != 2 )
185 || targ_vecs == NULL )
187 if( targ_vecs[0].sub_dim != vecs[0].sub_dim
188 || targ_vecs[0].sub_dim != vecs[1].sub_dim
189 || ( task == 2 && ( targ_vecs[0].sub_dim != vecs[2].sub_dim ) )
190 || ( task == 2 && ( targ_vecs[0].sub_dim != targ_vecs[1].sub_dim ) )
191 || targ_vecs[0].global_offset != vecs[0].global_offset
192 || targ_vecs[0].global_offset != vecs[1].global_offset
193 || ( task == 2 && (targ_vecs[0].global_offset != vecs[2].global_offset ) )
194 || ( task == 2 && ( targ_vecs[0].global_offset != targ_vecs[1].global_offset ) ) )
208 if( task == 1 || task == 2 ) {
214 if( task == 0 || task == 2 ) {
221 if( task == 1 || task == 2 ) {
223 d_val = targ_vecs[k].
values;
227 if( task == 0 || task == 2 ) {
229 py_val = targ_vecs[k].
values;
236 for( k = 0; k < num_vecs && !all_unit_stride; ++k )
237 if( vecs[k].values_stride != 1 )
239 for( k = 0; k < num_targ_vecs && !all_unit_stride; ++k )
240 if( targ_vecs[k].values_stride != 1 )
247 if( all_unit_stride) {
250 for( k = 0; k < sub_dim; ++k )
251 *py_val++ = *c_val++ / ( 1.0 - *xI_val++ );
255 for( k = 0; k < sub_dim; ++k )
256 *d_val++ = ( *xD_val++ - 10.0 ) / ( 1.0 - *xI_val++ );
260 for( k = 0; k < sub_dim; ++k ) {
261 denom = ( 1.0 - *xI_val++ );
262 *d_val++ = ( *xD_val++ - 10.0 ) / denom;
263 *py_val++ = *c_val++ / denom;
278 ,
"TOp_explnlp2_calc_py_D"
289 assert( 0 <= task && task <= 2 );
294 if(result != 0)
return result;
305 assert( 0 <= task && task <= 2 );
316 if(result != 0)
return result;
const struct RTOp_RTOp_vtbl_t RTOp_TOp_explnlp2_c_eval_vtbl
int(* obj_create)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)
const struct RTOp_obj_type_vtbl_t * obj_data_vtbl
int RTOp_TOp_explnlp2_calc_py_D_set_task(int task, struct RTOp_RTOp *op)
int RTOp_TOp_explnlp2_calc_py_D_destroy(struct RTOp_RTOp *op)
static int explnlp2_calc_py_D_apply_op(const struct RTOp_RTOp_vtbl_t *vtbl, const void *obj_data, const int num_vecs, const struct RTOp_SubVector vecs[], const int num_targ_vecs, const struct RTOp_MutableSubVector targ_vecs[], RTOp_ReductTarget targ_obj)
#define RTOp_ERR_INCOMPATIBLE_VECS
const struct RTOp_obj_type_vtbl_t * reduct_vtbl
static int explnlp2_c_eval_apply_op(const struct RTOp_RTOp_vtbl_t *vtbl, const void *obj_data, const int num_vecs, const struct RTOp_SubVector vecs[], const int num_targ_vecs, const struct RTOp_MutableSubVector targ_vecs[], RTOp_ReductTarget targ_obj)
int RTOp_TOp_explnlp2_c_eval_destroy(struct RTOp_RTOp *op)
const RTOp_value_type * values
const struct RTOp_RTOp_vtbl_t RTOp_TOp_explnlp2_calc_py_D_vtbl
int RTOp_TOp_explnlp2_c_eval_construct(struct RTOp_RTOp *op)
#define RTOp_ERR_INVALID_NUM_VECS
int RTOp_TOp_explnlp2_calc_py_D_construct(int task, struct RTOp_RTOp *op)
int(* obj_free)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)
const struct RTOp_obj_type_vtbl_t RTOp_obj_null_vtbl
const struct RTOp_RTOp_vtbl_t * vtbl
const struct RTOp_obj_type_vtbl_t RTOp_obj_index_vtbl
#define RTOp_ERR_INVALID_NUM_TARG_VECS
Teuchos_Ordinal RTOp_index_type