Epetra Package Browser (Single Doxygen Collection)  Development
test/FusedImportExport_LL/cxx_main.cpp
Go to the documentation of this file.
1 //@HEADER
2 // ************************************************************************
3 //
4 // Epetra: Linear Algebra Services Package
5 // Copyright 2011 Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
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 Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 //@HEADER
41 
42 
43 #include "Epetra_Map.h"
44 #include "Epetra_Time.h"
45 #include "Epetra_CrsMatrix.h"
46 #include "Epetra_Import.h"
47 #include "Epetra_Export.h"
48 #include "Epetra_Vector.h"
49 #include "Epetra_Flops.h"
50 
51 #ifdef EPETRA_MPI
52 
53 #include "Epetra_MpiComm.h"
54 #include "mpi.h"
55 #include "../epetra_test_err.h"
56 #include "Epetra_Version.h"
57 
58 // prototypes
59 
60 int check(Epetra_CrsMatrix& A, int NumMyRows1, int NumGlobalRows1, int NumMyNonzeros1,
61  int NumGlobalNonzeros1, int * MyGlobalElements, bool verbose);
62 
63 int power_method(bool TransA, Epetra_CrsMatrix& A,
64  Epetra_Vector& q,
65  Epetra_Vector& z,
66  Epetra_Vector& resid,
67  double * lambda, int niters, double tolerance,
68  bool verbose);
69 
71 
73  const Epetra_Map & Xamap = A.DomainMap();
74  const Epetra_Map & Yamap = A.RangeMap();
75  const Epetra_Map & Xbmap = B.DomainMap();
76  const Epetra_Map & Ybmap = B.RangeMap();
77 
78  Epetra_Vector Xa(Xamap), Xb(Xbmap), Ya(Yamap), Yb(Ybmap), Diff(Yamap);
79 
80  Xa.SetSeed(24601);
81  Xa.Random();
82 
83  // Handle domain map change
84  if(!Xamap.SameAs(Xbmap)) {
85  Epetra_Import Ximport(Xbmap,Xamap);
86  Xb.Import(Xa,Ximport,Insert);
87  }
88  else {
89  Xb=Xa;
90  }
91 
92  // Do the multiplies
93  A.Apply(Xa,Ya);
94  B.Apply(Xb,Yb);
95 
96  // Handle Rangemap change
97  if(!Yamap.SameAs(Ybmap)) {
98  Epetra_Import Yimport(Yamap,Ybmap);
99  Diff.Import(Yb,Yimport,Insert);
100  }
101  else {
102  Diff=Yb;
103  }
104 
105  // Check solution
106  Diff.Update(-1.0,Ya,1.0);
107  double norm;
108  Diff.Norm2(&norm);
109 
110  return norm;
111 }
112 
113 // B here is the "reduced" matrix. Square matrices w/ Row=Domain=Range only.
114 double test_with_matvec_reduced_maps(const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B, const Epetra_Map & Bfullmap){
115  const Epetra_Map & Amap = A.DomainMap();
116  Epetra_Vector Xa(Amap), Ya(Amap), Diff(Amap);
117  const Epetra_Map *Bmap = Bfullmap.NumMyElements() > 0 ? &B.DomainMap() : 0;
118  Epetra_Vector *Xb = Bmap ? new Epetra_Vector(*Bmap) : 0;
119  Epetra_Vector *Yb = Bmap ? new Epetra_Vector(*Bmap) : 0;
120 
121  Epetra_Vector Xb_alias(View,Bfullmap, Bmap ? Xb->Values(): 0);
122  Epetra_Vector Yb_alias(View,Bfullmap, Bmap ? Yb->Values(): 0);
123 
124  Epetra_Import Ximport(Bfullmap,Amap);
125 
126  // Set the input vector
127  Xa.SetSeed(24601);
128  Xa.Random();
129  Xb_alias.Import(Xa,Ximport,Insert);
130 
131  // Do the multiplies
132  A.Apply(Xa,Ya);
133  if(Bmap) B.Apply(*Xb,*Yb);
134 
135  // Check solution
136  Epetra_Import Yimport(Amap,Bfullmap);
137  Diff.Import(Yb_alias,Yimport,Insert);
138 
139 
140  Diff.Update(-1.0,Ya,1.0);
141  double norm;
142  Diff.Norm2(&norm);
143 
144  delete Xb; delete Yb;
145  return norm;
146 }
147 
148 
149 int build_matrix_unfused(const Epetra_CrsMatrix & SourceMatrix, Epetra_Import & RowImporter, Epetra_CrsMatrix *&A){
150  int rv=0;
151  rv=A->Import(SourceMatrix, RowImporter, Insert);
152  if(rv) {cerr<<"build_matrix_unfused: Import failed"<<endl; return rv;}
153 
154  rv=A->FillComplete(SourceMatrix.DomainMap(), SourceMatrix.RangeMap());
155  return rv;
156 }
157 
158 int build_matrix_unfused(const Epetra_CrsMatrix & SourceMatrix, Epetra_Export & RowExporter, Epetra_CrsMatrix *&A){
159  int rv=0;
160  rv=A->Export(SourceMatrix, RowExporter, Insert);
161  if(rv) {cerr<<"build_matrix_unfused: Export failed"<<endl; return rv;}
162 
163  rv=A->FillComplete(SourceMatrix.DomainMap(), SourceMatrix.RangeMap());
164  return rv;
165 }
166 
167 
168 
169 void build_test_matrix(Epetra_MpiComm & Comm, int test_number, Epetra_CrsMatrix *&A){
170  int NumProc = Comm.NumProc();
171  int MyPID = Comm.MyPID();
172 
173  if(test_number==1){
174  // Case 1: Tridiagonal
175  int NumMyEquations = 100;
176 
177  long long NumGlobalEquations = (NumMyEquations * NumProc) + EPETRA_MIN(NumProc,3);
178  if(MyPID < 3) NumMyEquations++;
179 
180  // Construct a Map that puts approximately the same Number of equations on each processor
181  Epetra_Map Map(NumGlobalEquations, NumMyEquations, (long long)0, Comm);
182 
183  // Get update list and number of local equations from newly created Map
184  long long* MyGlobalElements = new long long[Map.NumMyElements()];
185  Map.MyGlobalElements(MyGlobalElements);
186 
187  // Create an integer vector NumNz that is used to build the Petra Matrix.
188  // NumNz[i] is the Number of OFF-DIAGONAL term for the ith global equation on this processor
189 
190  int* NumNz = new int[NumMyEquations];
191 
192  // We are building a tridiagonal matrix where each row has (-1 2 -1)
193  // So we need 2 off-diagonal terms (except for the first and last equation)
194 
195  for (int i = 0; i < NumMyEquations; i++)
196  if((MyGlobalElements[i] == 0) || (MyGlobalElements[i] == NumGlobalEquations - 1))
197  NumNz[i] = 1;
198  else
199  NumNz[i] = 2;
200 
201  // Create a Epetra_Matrix
202  A=new Epetra_CrsMatrix(Copy, Map, NumNz);
203 
204  // Add rows one-at-a-time
205  // Need some vectors to help
206  // Off diagonal Values will always be -1
207 
208  double* Values = new double[2];
209  Values[0] = -1.0;
210  Values[1] = -1.0;
211  long long* Indices = new long long[2];
212  double two = 2.0;
213  int NumEntries;
214 
215  for (int i = 0; i < NumMyEquations; i++) {
216  if(MyGlobalElements[i] == 0) {
217  Indices[0] = 1;
218  NumEntries = 1;
219  }
220  else if (MyGlobalElements[i] == NumGlobalEquations-1) {
221  Indices[0] = NumGlobalEquations-2;
222  NumEntries = 1;
223  }
224  else {
225  Indices[0] = MyGlobalElements[i]-1;
226  Indices[1] = MyGlobalElements[i]+1;
227  NumEntries = 2;
228  }
229  A->InsertGlobalValues(MyGlobalElements[i], NumEntries, Values, Indices);
230  A->InsertGlobalValues(MyGlobalElements[i], 1, &two, MyGlobalElements+i);
231  }
232 
233  A->FillComplete();
234 
235  // Cleanup
236  delete [] MyGlobalElements;
237  delete [] NumNz;
238  delete [] Values;
239  delete [] Indices;
240 
241  }
242 }
243 
244 
245 
246 
247 int main(int argc, char *argv[])
248 {
249  int total_err=0;
250 
251  // Initialize MPI
252 
253  MPI_Init(&argc,&argv);
254  int rank; // My process ID
255 
256  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
257  Epetra_MpiComm Comm( MPI_COMM_WORLD );
258 
259  bool verbose = false;
260 
261  // Check if we should print results to standard out
262  if (argc>1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true;
263 
264  int verbose_int = verbose ? 1 : 0;
265  Comm.Broadcast(&verbose_int, 1, 0);
266  verbose = verbose_int==1 ? true : false;
267 
268  Comm.SetTracebackMode(0); // This should shut down any error traceback reporting
269  int MyPID = Comm.MyPID();
270  int NumProc = Comm.NumProc();
271 
272  if(verbose && MyPID==0)
273  cout << Epetra_Version() << std::endl << std::endl;
274 
275  if (verbose) cout << "Processor "<<MyPID<<" of "<< NumProc
276  << " is alive."<<endl;
277 
278  // Redefine verbose to only print on PE 0
279  if(verbose && rank!=0) verbose = false;
280 
281  // Matrix & Map pointers
282  Epetra_CrsMatrix *A, *B, *C;
283  Epetra_Map* Map1;
284  Epetra_Import* Import1;
285  Epetra_Export* Export1;
286  double diff_tol=1e-12;
287 
288 #define ENABLE_TEST_1
289 #define ENABLE_TEST_2
290 #define ENABLE_TEST_3
291 #define ENABLE_TEST_4
292 #define ENABLE_TEST_5
293 #define ENABLE_TEST_6
294 
296  // Test #1: Tridiagonal Matrix; Migrate to Proc 0
298 #ifdef ENABLE_TEST_1
299  {
300  double diff;
301  build_test_matrix(Comm,1,A);
302  long long num_global = A->RowMap().NumGlobalElements64();
303 
304  // New map with all on Proc1
305  if(MyPID==0) Map1=new Epetra_Map(num_global,num_global,(long long) 0,Comm);
306  else Map1=new Epetra_Map(num_global,0,(long long)0,Comm);
307 
308  // Execute fused import constructor
309  Import1 = new Epetra_Import(*Map1,A->RowMap());
310  B=new Epetra_CrsMatrix(*A,*Import1,0,&A->RangeMap());
311 
312  diff=test_with_matvec(*A,*B);
313  if(diff > diff_tol){
314  if(MyPID==0) cout<<"FusedImport: Test #1 FAILED with norm diff = "<<diff<<"."<<endl;
315  total_err--;
316  }
317 
318  // Execute fused export constructor
319  delete B;
320  Export1 = new Epetra_Export(A->RowMap(),*Map1);
321  B=new Epetra_CrsMatrix(*A,*Export1,0,&A->RangeMap());
322 
323  diff=test_with_matvec(*A,*B);
324  if(diff > diff_tol){
325  if(MyPID==0) cout<<"FusedExport: Test #1 FAILED with norm diff = "<<diff<<"."<<endl;
326  total_err--;
327  }
328 
329  delete A; delete B; delete Map1; delete Import1; delete Export1;
330  }
331 #endif
332 
333 
335  // Test #2: Tridiagonal Matrix; Locally Reversed Map
337 #ifdef ENABLE_TEST_2
338  {
339  double diff;
340  build_test_matrix(Comm,1,A);
341  int num_local = A->RowMap().NumMyElements();
342 
343  std::vector<long long> MyGIDS(num_local);
344  for(int i=0; i<num_local; i++)
345  MyGIDS[i] = A->RowMap().GID64(num_local-i-1);
346 
347  // New map with all on Proc1
348  Map1=new Epetra_Map((long long)-1,num_local,&MyGIDS[0],0,Comm);
349 
350  // Execute fused import constructor
351  Import1 = new Epetra_Import(*Map1,A->RowMap());
352  B=new Epetra_CrsMatrix(*A,*Import1,0,&A->RangeMap());
353 
354  diff=test_with_matvec(*A,*B);
355  if(diff > diff_tol){
356  if(MyPID==0) cout<<"FusedImport: Test #2 FAILED with norm diff = "<<diff<<"."<<endl;
357  total_err--;
358  }
359 
360  // Execute fused export constructor
361  delete B;
362  Export1 = new Epetra_Export(A->RowMap(),*Map1);
363  B=new Epetra_CrsMatrix(*A,*Export1,0,&A->RangeMap());
364 
365  diff=test_with_matvec(*A,*B);
366  if(diff > diff_tol){
367  if(MyPID==0) cout<<"FusedExport: Test #2 FAILED with norm diff = "<<diff<<"."<<endl;
368  total_err--;
369  }
370 
371  delete A; delete B; delete Map1; delete Import1; delete Export1;
372  }
373 #endif
374 
376  // Test #3: Tridiagonal Matrix; Globally Reversed Map
378 #ifdef ENABLE_TEST_3
379  {
380  double diff;
381  build_test_matrix(Comm,1,A);
382  int num_local = A->RowMap().NumMyElements();
383  long long num_global = A->RowMap().NumGlobalElements64();
384  int num_scansum = 0;
385 
386  Comm.ScanSum(&num_local,&num_scansum,1);
387 
388  // New Map
389  std::vector<long long> MyGIDS(num_local);
390  for(int i=0; i<num_local; i++)
391  MyGIDS[i] = num_global - num_scansum + num_local - i - 1;
392  Map1=new Epetra_Map((long long)-1,num_local,&MyGIDS[0],(long long)0,Comm);
393 
394  // Execute fused import constructor
395  Import1 = new Epetra_Import(*Map1,A->RowMap());
396  B=new Epetra_CrsMatrix(*A,*Import1,0,&A->RangeMap());
397 
398  diff=test_with_matvec(*A,*B);
399  if(diff > diff_tol){
400  if(MyPID==0) cout<<"FusedImport: Test #3 FAILED with norm diff = "<<diff<<"."<<endl;
401  total_err--;
402  }
403 
404  // Execute fused export constructor
405  delete B;
406  Export1 = new Epetra_Export(A->RowMap(),*Map1);
407  B=new Epetra_CrsMatrix(*A,*Export1,0,&A->RangeMap());
408 
409  diff=test_with_matvec(*A,*B);
410  if(diff > diff_tol){
411  if(MyPID==0) cout<<"FusedExport: Test #3 FAILED with norm diff = "<<diff<<"."<<endl;
412  total_err--;
413  }
414 
415  delete A; delete B; delete Map1; delete Import1; delete Export1;
416  }
417 #endif
418 
419 
421  // Test #4: Tridiagonal Matrix; MMM style halo import
423 #ifdef ENABLE_TEST_4
424  {
425  double diff;
426  build_test_matrix(Comm,1,A);
427 
428  // Assume we always own the diagonal
429  int num_local = A->NumMyCols()-A->NumMyRows();
430  std::vector<long long> MyGIDS(num_local);
431 
432  for(int i=0, idx=0; i<A->NumMyCols(); i++)
433  if(A->LRID(A->GCID64(i)) == -1){
434  MyGIDS[idx] = A->GCID64(i);
435  idx++;
436  }
437 
438  // New map
439  const long long * MyGIDS_ptr = MyGIDS.size() ? &MyGIDS[0] : 0;
440  Map1=new Epetra_Map((long long)-1,num_local,MyGIDS_ptr,(long long)0,Comm);
441 
442  // Execute fused import constructor
443  Import1 = new Epetra_Import(*Map1,A->RowMap());
444  B=new Epetra_CrsMatrix(*A,*Import1,0,&A->RangeMap());
445 
446  // Build unfused matrix to compare
447  C=new Epetra_CrsMatrix(Copy,*Map1,0);
448  build_matrix_unfused(*A,*Import1,C);
449 
450  diff=test_with_matvec(*B,*C);
451  if(diff > diff_tol){
452  if(MyPID==0) cout<<"FusedImport: Test #4 FAILED with norm diff = "<<diff<<"."<<endl;
453  total_err--;
454  }
455 
456  // Execute fused export constructor
457  delete B;
458  Export1 = new Epetra_Export(A->RowMap(),*Map1);
459  B=new Epetra_CrsMatrix(*A,*Export1,0,&A->RangeMap());
460 
461  diff=test_with_matvec(*B,*C);
462  if(diff > diff_tol){
463  if(MyPID==0) cout<<"FusedExport: Test #4 FAILED with norm diff = "<<diff<<"."<<endl;
464  total_err--;
465  }
466 
467  delete A; delete B; delete C; delete Map1; delete Import1; delete Export1;
468  }
469 #endif
470 
471 
473  // Test 5: Tridiagonal Matrix; Migrate to Proc 0, Replace Maps
475 #ifdef ENABLE_TEST_5
476  {
477  double diff;
478  build_test_matrix(Comm,1,A);
479  long long num_global = A->RowMap().NumGlobalElements64();
480 
481  // New map with all on Proc1
482  if(MyPID==0) Map1=new Epetra_Map(num_global,num_global,(long long)0,Comm);
483  else Map1=new Epetra_Map(num_global,0,(long long)0,Comm);
484 
485  // Execute fused import constructor
486  Import1 = new Epetra_Import(*Map1,A->RowMap());
487  B=new Epetra_CrsMatrix(*A,*Import1,Map1,Map1);
488 
489  diff=test_with_matvec(*A,*B);
490  if(diff > diff_tol){
491  if(MyPID==0) cout<<"FusedImport: Test #5 FAILED with norm diff = "<<diff<<"."<<endl;
492  total_err--;
493  }
494 
495  // Execute fused export constructor
496  delete B;
497  Export1 = new Epetra_Export(A->RowMap(),*Map1);
498  B=new Epetra_CrsMatrix(*A,*Export1,Map1,Map1);
499 
500  diff=test_with_matvec(*A,*B);
501  if(diff > diff_tol){
502  if(MyPID==0) cout<<"FusedExport: Test #5 FAILED with norm diff = "<<diff<<"."<<endl;
503  total_err--;
504  }
505 
506  delete A; delete B; delete Map1; delete Import1; delete Export1;
507  }
508 #endif
509 
510 
512  // Test 6: Tridiagonal Matrix; Migrate to Proc 0, Replace Comm
514 #ifdef ENABLE_TEST_6
515  {
516  double diff;
517  build_test_matrix(Comm,1,A);
518  long long num_global = A->RowMap().NumGlobalElements64();
519 
520  // New map with all on Proc1
521  if(MyPID==0) Map1=new Epetra_Map(num_global,num_global,(long long)0,Comm);
522  else Map1=new Epetra_Map(num_global,0,(long long)0,Comm);
523 
524  // Execute fused import constructor
525  Import1 = new Epetra_Import(*Map1,A->RowMap());
526  B=new Epetra_CrsMatrix(*A,*Import1,Map1,Map1,true);
527 
528  diff=test_with_matvec_reduced_maps(*A,*B,*Map1);
529  if(diff > diff_tol){
530  if(MyPID==0) cout<<"FusedImport: Test #6 FAILED with norm diff = "<<diff<<"."<<endl;
531  total_err--;
532  }
533 
534  // Execute fused export constructor
535  delete B;
536  Export1 = new Epetra_Export(A->RowMap(),*Map1);
537  B=new Epetra_CrsMatrix(*A,*Export1,Map1,Map1,true);
538 
539  diff=test_with_matvec_reduced_maps(*A,*B,*Map1);
540  if(diff > diff_tol){
541  if(MyPID==0) cout<<"FusedExport: Test #6 FAILED with norm diff = "<<diff<<"."<<endl;
542  total_err--;
543  }
544 
545  delete A; delete B; delete Map1; delete Import1; delete Export1;
546  }
547 #endif
548 
549 
550  // Final output for OK
551  if(MyPID==0 && total_err==0)
552  cout<<"FusedImportExport: All tests PASSED."<<endl;
553 
554  // Cleanup
555  MPI_Finalize();
556 
557  return total_err ;
558 }
559 
560 
561 
562 #else
563 int main(){
564 
565  return 0;
566 }
567 #endif
const Epetra_Map & RowMap() const
Returns the Epetra_Map object associated with the rows of this matrix.
int Norm2(double *Result) const
Compute 2-norm of each vector in multi-vector.
double * Values() const
Get pointer to MultiVector values.
int NumProc() const
Returns total number of processes.
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:119
int LRID(int GRID_in) const
Returns the local row index for given global row index, returns -1 if no local row for this global ro...
int NumMyRows() const
Returns the number of matrix rows owned by the calling processor.
bool SameAs(const Epetra_BlockMap &Map) const
Returns true if this and Map are identical maps.
int check(Epetra_CrsMatrix &A, int NumMyRows1, int NumGlobalRows1, int NumMyNonzeros1, int NumGlobalNonzeros1, int *MyGlobalElements, bool verbose)
int NumMyCols() const
Returns the number of entries in the set of column-indices that appear on this processor.
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
Insert a list of elements in a given global row of the matrix.
static void SetTracebackMode(int TracebackModeValue)
Set the value of the Epetra_Object error traceback report mode.
int Broadcast(double *MyVals, int Count, int Root) const
Epetra_MpiComm Broadcast function.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
Definition: Epetra_Export.h:62
double test_with_matvec(const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B)
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
#define EPETRA_MIN(x, y)
Epetra_MpiComm: The Epetra MPI Communication Class.
long long NumGlobalElements64() const
std::string Epetra_Version()
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
Definition: Epetra_Import.h:63
const Epetra_Map & RangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
int FillComplete(bool OptimizeDataStorage=true)
Signal that data entry is complete. Perform transformations to local index space. ...
int build_matrix_unfused(const Epetra_CrsMatrix &SourceMatrix, Epetra_Import &RowImporter, Epetra_CrsMatrix *&A)
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
Exports an Epetra_DistObject using the Epetra_Import object.
Epetra_Comm: The Epetra Communication Abstract Base Class.
Definition: Epetra_Comm.h:73
long long GID64(int LID) const
int NumMyElements() const
Number of elements on the calling processor.
int MyPID() const
Return my process ID.
int main(int argc, char *argv[])
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
Update multi-vector values with scaled values of A, this = ScalarThis*this + ScalarA*A.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
int power_method(bool TransA, Epetra_CrsMatrix &A, Epetra_Vector &q, Epetra_Vector &z, Epetra_Vector &resid, double *lambda, int niters, double tolerance, bool verbose)
long long GCID64(int LCID_in) const
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y.
void build_test_matrix(Epetra_MpiComm &Comm, int test_number, Epetra_CrsMatrix *&A)
int check_graph_sharing(Epetra_Comm &Comm)
int Import(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
Imports an Epetra_DistObject using the Epetra_Import object.
double test_with_matvec_reduced_maps(const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B, const Epetra_Map &Bfullmap)
const Epetra_Map & DomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
int ScanSum(double *MyVals, double *ScanSums, int Count) const
Epetra_MpiComm Scan Sum function.