|
|
Apply a reduction/transformation operator over a set of vectors: op(op(v[0]...v[nv-1],z[0]...z[nz-1]),(*reduct_obj)) -> z[0]...z[nz-1],(*reduct_obj).
- Parameters:
-
| op | [in] Reduction/transformation operator to apply over each sub-vector and assemble the intermediate targets into reduct_obj (if reduct_obj != RTOp_REDUCT_OBJ_NULL). |
| num_vecs | [in] Number of non-mutable vectors in vecs[]. If vecs==NULL then this argument is ignored but should be set to zero. |
| vecs | [in] Array (length num_vecs) of a set of pointers to non-mutable vectors to include in the operation. The order of these vectors is significant to op. |
| num_targ_vecs | [in] Number of mutable vectors in targ_vecs[]. If targ_vecs==NULL then this argument is ignored but should be set to zero. |
| targ_vecs | [in] Array (length num_targ_vecs) of a set of pointers to mutable vectors to include in the operation. The order of these vectors is significant to op. If targ_vecs==NULL then op is called with no mutable vectors. |
| reduct_obj | [in/out] Target object of the reduction operation. This object must have been created by the op.reduct_obj_create_raw(&reduct_obj) function first. The reduction operation will be added to (*reduct_obj) if (*reduct_obj) has already been through a reduction. By allowing the info in (*reduct_obj) to be added to the reduction over all of these vectors, the reduction operation can be accumulated over a set of abstract vectors which can be useful for implementing composite vectors for instance. If op.get_reduct_type_num_entries(...) returns num_values == 0, num_indexes == 0 and num_chars == 0 then reduct_obj should be set to RTOp_REDUCT_OBJ_NULL and no reduction will be performed. |
| first_ele_offset | [in] (default = 0) The index of the first element in this to be included. |
| sub_dim | [in] (default = -1) The number of elements in these vectors to include in the reduction/transformation operation. The value of sub_dim < 0 means to include all available elements. The value of sub_dim == 0 means to include none of the elements of the vector. This last value is somewhat undefined but has meaning in some specialized contexts (such as for SPMD vectors). |
| global_offset | [in] (default = 0) The offset applied to the included vector elements. |
Preconditions:
-
[
num_vecs > 0] vecs[k]->space()->isCompatible(*this->space()) == true, for k = 0...num_vecs-1 (throw Exceptions::IncompatibleVectorSpaces)
-
[
num_targ_vecs > 0] targ_vecs[k]->space()->isCompatible(*this->space()) == true, for k = 0...num_targ_vecs-1 (throw Exceptions::IncompatibleVectorSpaces)
-
[
num_targ_vecs > 0] The vectors pointed to by targ_vecs[k], for k = 0...num_targ_vecs-1 must not alias each other or any of the vectors vecs[k], for k = 0...num_vecs-1. You have be warned!!!!
-
0 <= first_ele_offset < this->space()->dim() (throw std::out_of_range)
-
global_offset >= 0 (throw std::invalid_argument)
-
sub_dim - first_ele_offset <= this->space()->dim() (throw std::length_error).
Postconditions:
-
The vectors in
targ_vecs[] may be modified as determined by the definition of op.
-
[
reduct_obj!=RTOp_REDUCT_OBJ_NULL] The reduction object reduct_obj contains the combined reduction from the input state of reduct_obj and the reductions that where accumulated during this this function invocation.
The logical vector passed to the op.apply_op(...) function is:
v(k + global_offset) = this->get_ele(first_ele_offset + k)
, for k = 0 ... sub_dim-1
where v represents any one of the input or input/output vectors. The situation where first_ele_offset == 0 and global_offset > 1 corresponds to the case where the vectors represent constituent vectors in a larger aggregate vector. The situation where first_ele_offset > 0 and global_offset == 0 is for when a sub-view of the vectors are being treated as full vectors. Other combinations of these arguments are also possible.
Definition at line 486 of file Thyra_VectorBaseDecl.hpp. |