MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_VectorMutableBlocked.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #include <typeinfo>
43 #include <algorithm>
44 
48 #include "Teuchos_Workspace.hpp"
49 #include "Teuchos_Assert.hpp"
50 #include "Teuchos_FancyOStream.hpp"
51 
52 // Uncomment to ignore cache of reduction data
53 //#define ALAP_VECTOR_MUTABLE_BLOCKED_IGNORE_CACHE_DATA
54 
55 namespace {
56 template< class T >
57 inline
58 T my_max( const T& v1, const T& v2 ) { return v1 > v2 ? v1 : v2; }
59 template< class T >
60 inline
61 T my_min( const T& v1, const T& v2 ) { return v1 < v2 ? v1 : v2; }
62 } // end namespace
63 
64 namespace AbstractLinAlgPack {
65 
68  ,const vec_space_comp_ptr_t& vec_space
69  )
70  // The members will be initialized in this->has_changed()
71 {
72  initialize(vecs,vec_space);
73 }
74 
77  ,const vec_space_comp_ptr_t& vec_space
78  )
79 {
81  vec_space.get() == NULL, std::logic_error
82  ,"VectorMutableBlocked::initialize(...): Error, Must be constructed from "
83  "a non-null block vector space!" );
84  const int num_vec_spaces = vec_space->num_vector_spaces();
85  vecs_.resize(num_vec_spaces);
86  std::copy(vecs,vecs+num_vec_spaces,vecs_.begin());
87  vec_space_ = vec_space;
88  this->has_changed();
89 }
90 
91 // overriddend form Vector
92 
94 {
95  return vec_space_->dim();
96 }
97 
99 {
100  return *vec_space_;
101 }
102 
104  const RTOpPack::RTOp& op
105  ,const size_t num_vecs, const Vector* vecs[]
106  ,const size_t num_targ_vecs, VectorMutable* targ_vecs[]
107  ,RTOpPack::ReductTarget *reduct_obj
108  ,const index_type first_ele_in, const index_type sub_dim_in, const index_type global_offset_in
109  ) const
110 {
111  using Teuchos::Workspace;
113 
114  const index_type
115  n = this->dim();
116 
117  // Validate the compatibility of the vectors!
118 #ifdef TEUCHOS_DEBUG
120  !(1 <= first_ele_in && first_ele_in <= n), std::out_of_range
121  ,"VectorMutableBlocked::apply_op(...): Error, "
122  "first_ele_in = " << first_ele_in << " is not in range [1,"<<n<<"]" );
124  sub_dim_in < 0, std::invalid_argument
125  ,"VectorMutableBlocked::apply_op(...): Error, "
126  "sub_dim_in = " << sub_dim_in << " is not acceptable" );
128  global_offset_in < 0, std::invalid_argument
129  ,"VectorMutableBlocked::apply_op(...): Error, "
130  "global_offset_in = " << global_offset_in << " is not acceptable" );
132  sub_dim_in > 0 && sub_dim_in - (first_ele_in - 1) > n, std::length_error
133  ,"VectorMutableBlocked::apply_op(...): Error, "
134  "global_offset_in = " << global_offset_in << ", sub_dim_in = " << sub_dim_in
135  << "first_ele_in = " << first_ele_in << " and n = " << n
136  << " are not compatible" );
137  bool test_failed;
138  {for(int k = 0; k < num_vecs; ++k) {
139  test_failed = !this->space().is_compatible(vecs[k]->space());
142  ,"VectorMutableBlocked::apply_op(...): Error vecs["<<k<<"]->space() "
143  <<"of type \'"<<typeName(vecs[k]->space())<<"\' is not compatible with this "
144  <<"\'VectorSpaceBlocked\' vector space!"
145  );
146  }}
147  {for(int k = 0; k < num_targ_vecs; ++k) {
148  test_failed = !this->space().is_compatible(targ_vecs[k]->space());
151  ,"VectorMutableBlocked::apply_op(...): Error targ_vecs["<<k<<"]->space() "
152  <<"of type \'"<<typeName(vecs[k]->space())<<"\' is not compatible with this "
153  <<"\'VectorSpaceBlocked\' vector space!"
154  );
155  }}
156 #endif
157 
158  // Dynamic cast the pointers for the vector arguments
159  Workspace<const VectorMutableBlocked*>
160  vecs_args(wss,num_vecs);
161  {for(int k = 0; k < num_vecs; ++k) {
162  vecs_args[k] = dynamic_cast<const VectorMutableBlocked*>(vecs[k]);
163 #ifdef TEUCHOS_DEBUG
165  vecs_args[k] == NULL, VectorSpace::IncompatibleVectorSpaces
166  ,"VectorMutableBlocked::apply_op(...): Error vecs["<<k<<"] "
167  <<"of type \'"<<typeName(*vecs[k])<<"\' does not support the "
168  <<"\'VectorMutableBlocked\' interface!"
169  );
170 #endif
171  }}
172  Workspace<VectorMutableBlocked*>
173  targ_vecs_args(wss,num_targ_vecs);
174  {for(int k = 0; k < num_targ_vecs; ++k) {
175  targ_vecs_args[k] = dynamic_cast<VectorMutableBlocked*>(targ_vecs[k]);
176 #ifdef TEUCHOS_DEBUG
178  targ_vecs_args[k] == NULL, VectorSpace::IncompatibleVectorSpaces
179  ,"VectorMutableBlocked::apply_op(...): Error targ_vecs["<<k<<"] "
180  <<"of type \'"<<typeName(*targ_vecs[k])<<"\' does not support the "
181  <<"\'VectorMutableBlocked\' interface!"
182  );
183 #endif
184  }}
185 
186  // Perform the reduction on each vector segment at a time.
187  // ToDo: There could be a parallel version of this method!
188  const index_type this_dim = this->dim();
189  const index_type sub_dim = ( sub_dim_in == 0
190  ? this_dim - (first_ele_in - 1)
191  : sub_dim_in );
192  index_type num_elements_remaining = sub_dim;
193  const int num_vec_spaces = vec_space_->num_vector_spaces();
194  Workspace<const Vector*>
195  sub_vecs(wss,num_vecs);
196  Workspace<VectorMutable*>
197  sub_targ_vecs(wss,num_targ_vecs);
198  index_type g_off = -first_ele_in + 1;
199  for(int k = 0; k < num_vec_spaces; ++k) {
200  const index_type local_dim = vecs_[k]->dim();
201  if( g_off < 0 && -g_off > local_dim ) {
202  g_off += local_dim;
203  continue;
204  }
205  const index_type
206  local_sub_dim = ( g_off >= 0
207  ? my_min( local_dim, num_elements_remaining )
208  : my_min( local_dim + g_off, num_elements_remaining ) );
209  if( local_sub_dim <= 0 )
210  break;
211  for( int i = 0; i < num_vecs; ++i ) // Fill constituent vectors for segment k
212  sub_vecs[i] = vecs_args[i]->vecs_[k].get();
213  for( int j = 0; j < num_targ_vecs; ++j ) // Fill constituent target vectors for segment k
214  sub_targ_vecs[j] = targ_vecs_args[j]->vecs_[k].get();
216  op
217  ,num_vecs,num_vecs?&sub_vecs[0]:NULL
218  ,num_targ_vecs,num_targ_vecs?&sub_targ_vecs[0]:NULL
219  ,reduct_obj
220  ,g_off < 0 ? -g_off + 1 : 1 // first_ele
221  ,local_sub_dim // sub_dim
222  ,g_off < 0 ? global_offset_in : global_offset_in + g_off // global_offset
223  );
224  g_off += local_dim;
225  num_elements_remaining -= local_sub_dim;
226  }
227  TEUCHOS_TEST_FOR_EXCEPT( !( num_elements_remaining == 0 ) );
228  // Must allert all of the block vectors that they may have changed!
229  {for(int k = 0; k < num_targ_vecs; ++k) {
230  targ_vecs[k]->has_changed();
231  }}
232 }
233 
235 {
236  if( nz_ < 0.0 ) {
237  const int num_vec_spaces = vec_space_->num_vector_spaces();
238  nz_ = 0;
239  for( int k = 0; k < num_vec_spaces; ++k )
240  nz_ += vecs_[k]->nz();
241  }
242  return nz_;
243 }
244 
246  std::ostream& out_arg, bool print_dim, bool newline
247  ,index_type global_offset
248  ) const
249 {
250  Teuchos::RCP<Teuchos::FancyOStream> out = Teuchos::getFancyOStream(Teuchos::rcp(&out_arg,false));
251  Teuchos::OSTab tab(out);
252  if(print_dim)
253  *out << this->dim() << std::endl;
254  size_type off = global_offset;
255  const int num_vec_spaces = vec_space_->num_vector_spaces();
256  for( int k = 0; k < num_vec_spaces; ++k ) {
257  vecs_[k]->output(*out,false,false,off);
258  off += vecs_[k]->dim();
259  }
260  if(newline)
261  *out << std::endl;
262  return out_arg;
263 }
264 
266 {
267  int kth_vector_space = -1;
268  index_type kth_global_offset = 0;
269  vec_space_->get_vector_space_position(i,&kth_vector_space,&kth_global_offset);
270 #ifdef TEUCHOS_DEBUG
271  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= vecs_.size() ) );
272 #endif
273  return vecs_[kth_vector_space]->get_ele( i - kth_global_offset );
274 }
275 
277 {
278 #ifdef ALAP_VECTOR_MUTABLE_BLOCKED_IGNORE_CACHE_DATA
279  if( true ) {
280 #else
281  if( norm_1_ < 0.0 ) {
282 #endif
283  const int num_vec_spaces = vec_space_->num_vector_spaces();
284  norm_1_ = 0.0;
285  for( int k = 0; k < num_vec_spaces; ++k )
286  norm_1_ += vecs_[k]->norm_1();
287  }
288  return norm_1_;
289 }
290 
292 {
293 #ifdef ALAP_VECTOR_MUTABLE_BLOCKED_IGNORE_CACHE_DATA
294  if( true ) {
295 #else
296  if( norm_inf_ < 0.0 ) {
297 #endif
298  const int num_vec_spaces = vec_space_->num_vector_spaces();
299  norm_inf_ = 0.0;
300  for( int k = 0; k < num_vec_spaces; ++k )
301  norm_inf_ = my_max( norm_inf_, vecs_[k]->norm_inf() );
302  }
303  return norm_inf_;
304 }
305 
307 {
308  return Vector::inner_product(v); // ToDo: Specialize? (why bother?)
309 }
310 
312 {
313  const Range1D
314  rng = rng_in.full_range() ? Range1D( 1, this->dim()) : rng_in;
315  int kth_vector_space = -1;
316  index_type kth_global_offset = 0;
317  vec_space_->get_vector_space_position(rng.lbound(),&kth_vector_space,&kth_global_offset);
318 #ifdef TEUCHOS_DEBUG
319  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= vecs_.size() ) );
320 #endif
321  if( rng.lbound() + rng.size() <= kth_global_offset + 1 + vecs_[kth_vector_space]->dim() ) {
322  // This involves only one sub-vector so just return it.
323  static_cast<const Vector*>(vecs_[kth_vector_space].get())->get_sub_vector(
324  rng - kth_global_offset, sub_vec );
325  sub_vec->setGlobalOffset( sub_vec->globalOffset() + kth_global_offset );
326  }
327  else {
328  // Just let the default implementation handle this. ToDo: In the futrue
329  // we could manually construct an explicit sub-vector that spanned
330  // two or more consitituent vectors but this would be a lot of work.
331  // However, this would require the use of temporary memory but
332  // so what.
333  Vector::get_sub_vector(rng_in,sub_vec);
334  }
335 }
336 
338 {
339  if( sub_vec->values() == NULL ) return;
340  int kth_vector_space = -1;
341  index_type kth_global_offset = 0;
342  vec_space_->get_vector_space_position(
343  sub_vec->globalOffset()+1,&kth_vector_space,&kth_global_offset);
344 #ifdef TEUCHOS_DEBUG
345  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= vecs_.size() ) );
346 #endif
347  if( sub_vec->globalOffset() + sub_vec->subDim() <= kth_global_offset + vecs_[kth_vector_space]->dim() ) {
348  // This sub_vec was extracted from a single constituent vector
349  sub_vec->setGlobalOffset( sub_vec->globalOffset() - kth_global_offset );
350  vecs_[kth_vector_space].get()->free_sub_vector(sub_vec);
351  }
352  else {
353  // This sub_vec was created by the default implementation!
354  Vector::free_sub_vector(sub_vec);
355  }
356 }
357 
359 {
360  nz_ = -1; // set to uninitalized!
361  norm_1_ = norm_inf_ = -1.0;
363 }
364 
365 // overridden from VectorMutable
366 
369 {
370  namespace rcp = MemMngPack;
371  const index_type dim = this->dim();
372  const Range1D rng = rng_in.full_range() ? Range1D(1,dim) : rng_in;
373  // Validate the preconditions
374 #ifdef TEUCHOS_DEBUG
376  dim < rng.ubound(), std::out_of_range
377  ,"VectorMutableBlocked::sub_view(...): Error, rng = "
378  << "["<<rng.lbound()<<","<<rng.ubound()<<"] is not in range [1,"<<dim<<"]" );
379 #endif
380  vecs_t &vecs = this->vecs_; // Need to examine in debugger!
381  // See if the entire vector is being returned or just NULL
382  if( rng.lbound() == 1 && rng.ubound() == dim ) {
383  if( vecs.size() == 1 ) return vecs[0]->sub_view(Range1D());
384  else return Teuchos::rcp(this,false);
385  }
386  // From here on out we will return a view that could change the
387  // elements of one or more of the constituent vectors so we had
388  // better wipe out the cache
389  this->has_changed();
390  // Get the position of the vector space object of interest
391  int kth_vector_space = -1;
392  index_type kth_global_offset = 0;
393  vec_space_->get_vector_space_position(rng.lbound(),&kth_vector_space,&kth_global_offset);
394  const VectorSpace::space_ptr_t* vector_spaces = vec_space_->vector_spaces();
395  const index_type* vec_spaces_offsets = vec_space_->vector_spaces_offsets();
396 #ifdef TEUCHOS_DEBUG
397  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= vecs.size() ) );
398 #endif
399  if( rng.lbound() == kth_global_offset + 1
400  && rng.size() == vec_spaces_offsets[kth_vector_space+1] - vec_spaces_offsets[kth_vector_space] )
401  // The client selected a whole single constituent vector.
402  return vecs[kth_vector_space]->sub_view(Range1D());
403  if( rng.ubound() <= vec_spaces_offsets[kth_vector_space+1] )
404  // The client selected a sub-vector of a single consituent vector
405  return vecs[kth_vector_space]->sub_view( rng - vec_spaces_offsets[kth_vector_space] );
406  // The client selected a sub-vector that spans two or more constituent vectors.
407  // Get the position of the vector space object with the last element of interest
408  int end_kth_vector_space = -1;
409  index_type end_kth_global_offset = 0;
410  vec_space_->get_vector_space_position(rng.ubound(),&end_kth_vector_space,&end_kth_global_offset);
411 #ifdef TEUCHOS_DEBUG
412  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= end_kth_vector_space && end_kth_vector_space <= vecs.size() ) );
413  TEUCHOS_TEST_FOR_EXCEPT( !( end_kth_vector_space > kth_vector_space ) );
414 #endif
415  // Create a VectorWithOpMutableCompsiteStd object containing the relavant constituent vectors
417  vec_comp = Teuchos::rcp(new VectorMutableBlocked(
418  &vecs[kth_vector_space]
420  &vector_spaces[kth_vector_space]
421  ,end_kth_vector_space - kth_vector_space + 1 ))
422  ));
423  if( rng.lbound() == kth_global_offset + 1
424  && rng.size() == vec_spaces_offsets[end_kth_vector_space+1] - vec_spaces_offsets[kth_vector_space] )
425  // The client selected exactly a contigous set of vectors
426  return vec_comp;
427  // The client selected some sub-set of elements in the contigous set of vectors
428  return Teuchos::rcp(
430  vec_comp
431  ,Range1D(
432  rng.lbound()-vec_spaces_offsets[kth_vector_space]
433  ,rng.ubound()-vec_spaces_offsets[kth_vector_space] )
434  ) );
435 }
436 
438 {
439  VectorMutable::axpy(alpha,x); // ToDo: Specialize? (why bother?)
440  this->has_changed();
441 }
442 
444 {
445  const int num_vec_spaces = vec_space_->num_vector_spaces();
446  for( int k = 0; k < num_vec_spaces; ++k )
447  *vecs_[k] = alpha;
448  this->has_changed();
449  return *this;
450 }
451 
453 {
454  VectorMutable::operator=(v); // ToDo: Specialize (why bother?)
455  this->has_changed();
456  return *this;
457 }
458 
460 {
461  int kth_vector_space = -1;
462  index_type kth_global_offset = 0;
463  vec_space_->get_vector_space_position(i,&kth_vector_space,&kth_global_offset);
464 #ifdef TEUCHOS_DEBUG
465  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= vecs_.size() ) );
466 #endif
467  vecs_[kth_vector_space]->set_ele( i - kth_global_offset, val );
468  this->has_changed();
469 }
470 
472 {
473  int kth_vector_space = -1;
474  index_type kth_global_offset = 0;
475  vec_space_->get_vector_space_position(
476  sub_vec.globalOffset()+1,&kth_vector_space,&kth_global_offset);
477 #ifdef TEUCHOS_DEBUG
478  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= vecs_.size() ) );
479 #endif
480  if( sub_vec.globalOffset() + sub_vec.subDim() <= kth_global_offset + vecs_[kth_vector_space]->dim() ) {
481  // This sub-vector fits into a single constituent vector
482  RTOpPack::SparseSubVector sub_vec_g = sub_vec;
483  sub_vec_g.setGlobalOffset( sub_vec_g.globalOffset() - kth_global_offset );
484  vecs_[kth_vector_space]->set_sub_vector(sub_vec_g);
485  }
486  else {
487  // Let the default implementation take care of this. ToDo: In the futrue
488  // it would be possible to manualy set the relavent constituent
489  // vectors with no temp memory allocations.
491  }
492  this->has_changed();
493 }
494 
496 {
499  k >= vec_space_->num_vector_spaces(), std::logic_error
500  ,"VectorMutableBlocked::assert_in_range(k) : Error, k = " << k << " is not "
501  "in range [0," << vec_space_->num_vector_spaces() << "]" );
502 }
503 
505 {
506  TEUCHOS_TEST_FOR_EXCEPTION(!vec_space_.get(),std::logic_error,"Error, this is not initalized!");
507 }
508 
509 } // end namespace AbstractLinAlgPack
virtual void set_sub_vector(const RTOpPack::SparseSubVector &sub_vec)
Set a specific sub-vector.
std::string typeName(const T &t)
virtual void get_sub_vector(const Range1D &rng, RTOpPack::SubVector *sub_vec) const
Get a non-mutable explicit view of a sub-vector.
void set_sub_vector(const RTOpPack::SparseSubVector &sub_vec)
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Index size() const
Return the size of the range (ubound() - lbound() + 1)
Index ubound() const
Return upper bound of the range.
const Scalar * values() const
T * get() const
value_type norm_inf_
< 0, not initialized, > 0 already calculated
void apply_op(const RTOpPack::RTOp &op, const size_t num_vecs, const Vector *vecs[], const size_t num_targ_vecs, VectorMutable *targ_vecs[], RTOpPack::ReductTarget *reduct_obj, const index_type first_ele, const index_type sub_dim, const index_type global_offset) const
void get_sub_vector(const Range1D &rng, RTOpPack::SubVector *sub_vec) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
. One-based subregion index range class.
virtual void has_changed() const
Must be called by any vector subclass that modifies this vector object!
RTOpT< RTOp_value_type > RTOp
Teuchos_Ordinal subDim() const
Abstract interface for objects that represent a space for mutable coordinate vectors.
void copy(const f_int &N, const f_dbl_prec *X, const f_int &INCX, f_dbl_prec *Y, const f_int &INCY)
std::ostream * out
VectorSpace subclass for the composite of one or more VectorSpace objects.
bool full_range() const
Returns true if the range represents the entire region (constructed from Range1D()) ...
virtual void axpy(value_type alpha, const Vector &x)
Adds a linear combination of another vector to this vector object.
Concrete subclass for a sub-view of a VectorMutable object.
virtual void free_sub_vector(RTOpPack::SubVector *sub_vec) const
Free an explicit view of a sub-vector.
virtual bool is_compatible(const VectorSpace &vec_spc) const =0
Compare the compatibility of two vector spaces.
Teuchos_Ordinal globalOffset() const
Index lbound() const
Return lower bound of the range.
virtual VectorMutable & operator=(value_type alpha)
Assign the elements of this vector to a scalar.
std::ostream & output(std::ostream &out, bool print_dim, bool newline, index_type global_offset) const
Abstract interface for mutable coordinate vectors {abstract}.
void apply_op(EApplyBy apply_by, const RTOpPack::RTOp &primary_op, const size_t num_multi_vecs, const MultiVector *multi_vecs[], const size_t num_targ_multi_vecs, MultiVectorMutable *targ_multi_vecs[], RTOpPack::ReductTarget *reduct_objs[]=NULL, const index_type primary_first_ele=1, const index_type primary_sub_dim=0, const index_type primary_global_offset=0, const index_type secondary_first_ele=1, const index_type secondary_sub_dim=0)
Apply a reduction/transformation operator column by column and return an array of the reduction objec...
void setGlobalOffset(Teuchos_Ordinal globalOffset)
SparseSubVectorT< RTOp_value_type > SparseSubVector
void initialize(VectorMutable::vec_mut_ptr_t *vecs, const vec_space_comp_ptr_t &vec_space)
Initialize given a list of constituent vectors.
std::vector< VectorMutable::vec_mut_ptr_t > vecs_t
Type for list of constituent vectors.
virtual value_type inner_product(const Vector &v) const
Return the inner product of *this with v.
int n
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Class for a non-mutable sub-vector.
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
index_type nz_
dim() not initalized, < dim() already initialized!