Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_BasicRowMatrix.cpp
Go to the documentation of this file.
1 
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 
43 #include "Epetra_ConfigDefs.h"
44 #include "Epetra_BasicRowMatrix.h"
45 #include "Epetra_Map.h"
46 #include "Epetra_Import.h"
47 #include "Epetra_Export.h"
48 #include "Epetra_Vector.h"
49 #include "Epetra_MultiVector.h"
50 #include "Epetra_Comm.h"
51 #include "Epetra_Util.h"
53 #include "Epetra_RowMatrix.h"
54 #include "Epetra_CrsMatrix.h"
55 
56 
57 //==============================================================================
59  : Comm_(comm.Clone()),
60 #if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
61  OperatorDomainMap_(Epetra_Map(0,0,comm)),
62  OperatorRangeMap_(Epetra_Map(0,0,comm)),
63  RowMatrixRowMap_(Epetra_Map(0,0,comm)),
64  RowMatrixColMap_(Epetra_Map(0,0,comm)),
65 #endif
66  NumMyNonzeros_(0),
67  NumGlobalNonzeros_(0),
68  MaxNumEntries_(0),
69  NormInf_(0.0),
70  NormOne_(0.0),
71  UseTranspose_(false),
72  HasNormInf_(true),
73  LowerTriangular_(true),
74  UpperTriangular_(true),
75  HaveStructureConstants_(false),
76  HaveNumericConstants_(false),
77  HaveMaps_(false),
78  ImportVector_(0),
79  ExportVector_(0),
80  Importer_(0),
81  Exporter_(0)
82 {
83  SetLabel("Epetra::BasicRowMatrix");
84 }
85 
86 //==============================================================================
88 
89  if (ImportVector_!=0) delete ImportVector_;
90  ImportVector_=0;
91  if (ExportVector_!=0) delete ExportVector_;
92  ExportVector_=0;
93  if (Importer_!=0) delete Importer_;
94  Importer_=0;
95  if (Exporter_!=0) delete Exporter_;
96  Exporter_=0;
97  delete Comm_;
98 }
99 
100 //==============================================================================
101 void Epetra_BasicRowMatrix::SetMaps(const Epetra_Map & RowMap, const Epetra_Map & ColMap) {
102 
103  SetMaps(RowMap, ColMap, RowMap, RowMap);
104 }
105 
106 //==============================================================================
107 void Epetra_BasicRowMatrix::SetMaps(const Epetra_Map & RowMap, const Epetra_Map & ColMap,
108  const Epetra_Map & DomainMap, const Epetra_Map & RangeMap) {
109 
110  RowMatrixRowMap_ = RowMap;
111  RowMatrixColMap_ = ColMap;
112  OperatorDomainMap_ = DomainMap;
113  OperatorRangeMap_ = RangeMap;
114  HaveMaps_ = true;
115  HaveStructureConstants_ = false;
116  HaveNumericConstants_ = false;
117 
118  if (!OperatorDomainMap().UniqueGIDs()) throw RowMatrixRowMap().ReportError("At least one GID is repeated in domain map. Domain and range maps must have unique GIDs", -1);
119  if (!OperatorRangeMap().UniqueGIDs()) throw RowMatrixRowMap().ReportError("At least one GID is repeated in range map. Domain and range maps must have unique GIDs", -2);
120  SetImportExport();
121 }
122 
123 //==============================================================================
125 
126  // Check if non-trivial import/export operators
127  if (!(RowMatrixRowMap().SameAs(OperatorRangeMap())))
129 
130  if (!(RowMatrixColMap().SameAs(OperatorDomainMap())))
132 
135 }
136 
137 //==============================================================================
139  MaxNumEntries_ = 0;
140  NumMyNonzeros_ = 0;
141  NumGlobalNonzeros_ = 0;
142  int NumEntries = 0;
143  for (int i=0; i<NumMyRows_; i++) {
144  NumMyRowEntries(i, NumEntries);
145  NumMyNonzeros_ += NumEntries;
146  if (NumEntries>MaxNumEntries_) MaxNumEntries_ = NumEntries;
147  }
148 
149  long long tmp_NumMyNonzeros = NumMyNonzeros_;
150  RowMatrixRowMap().Comm().SumAll(&tmp_NumMyNonzeros, &NumGlobalNonzeros_, 1);
152 }
153 //=============================================================================
157  int NumEntries;
158  Epetra_Vector x1(RowMatrixRowMap()); // Need temp vector for row sums
159  Epetra_Vector x2(RowMatrixColMap()); // Need temp vector for column sums
160  for(int i = 0; i < NumMyRows_; i++) {
161  ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values());
162  for(int j = 0; j < NumEntries; j++) {
163  x1[i] += std::abs(Values[j]);
164  x2[Indices[j]] += std::abs(Values[j]);
165  if (Indices[j]<i) UpperTriangular_ = false;
166  if (Indices[j]>i) LowerTriangular_ = false;
167  }
168  }
169 
170  // If we have a non-trivial exporter, we must export elements that are permuted or belong to other processors
171  if(Exporter() != 0) {
172  Epetra_Vector xtmp(OperatorRangeMap()); // Create temporary import vector if needed
173  xtmp.Export(x1,*Exporter(),Add);
174  xtmp.MaxValue(&NormInf_); // This is the NormInf
175  }
176  else
177  x1.MaxValue(&NormInf_); // Find max
178 
179  // If we have a non-trivial importer, we must export elements that are permuted or belong to other processors
180  if(Importer() != 0) {
181  Epetra_Vector xtmp(OperatorDomainMap()); // Create temporary import vector if needed
182  xtmp.Export(x2,*Importer(),Add);
183  xtmp.MaxValue(&NormOne_); // This is the NormOne
184  }
185  else
186  x2.MaxValue(&NormOne_); // Find max
187 
189  HaveNumericConstants_ = true;
190 }
191 //=============================================================================
193 
194  if(!RowMatrixRowMap().SameAs(Diagonal.Map()))
195  EPETRA_CHK_ERR(-2); // Maps must be the same
196 
197  // Crude implementation in terms of ExtractMyRowCopy
198 
201  int NumEntries;
202 
203  for(int i = 0; i < NumMyRows_; i++) {
204  EPETRA_CHK_ERR(ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values()));
205  long long ii = RowMatrixRowMap().GID64(i);
206 
207  Diagonal[i] = 0.0;
208  for(int j = 0; j < NumEntries; j++) {
209  if(ii == RowMatrixColMap().GID64(Indices[j])) {
210  Diagonal[i] = Values[j];
211  break;
212  }
213  }
214  }
215  return(0);
216 }
217 //=============================================================================
219  int ierr = 0;
220  int i, j;
223  int NumEntries;
224  x.PutScalar(0.0); // Make sure we sum into a vector of zeros.
225  double * xp = (double*)x.Values();
226  if (OperatorRangeMap().SameAs(x.Map()) && Exporter() != 0) {
228  x_tmp.PutScalar(0.0);
229  double * x_tmp_p = (double*)x_tmp.Values();
230  for (i=0; i < NumMyRows_; i++) {
231  EPETRA_CHK_ERR(ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values()));
232  for (j=0; j < NumEntries; j++) x_tmp_p[i] += std::abs(Values[j]);
233  }
234  EPETRA_CHK_ERR(x.Export(x_tmp, *Exporter(), Add)); //Export partial row sums to x.
235  int myLength = x.MyLength();
236  for (i=0; i<myLength; i++) {
237  if (xp[i]<Epetra_MinDouble) {
238  if (xp[i]==0.0) ierr = 1; // Set error to 1 to signal that zero rowsum found (supercedes ierr = 2)
239  else if (ierr!=1) ierr = 2;
240  xp[i] = Epetra_MaxDouble;
241  }
242  else
243  xp[i] = 1.0/xp[i];
244  }
245  }
246  else if (RowMatrixRowMap().SameAs(x.Map())) {
247  for (i=0; i < NumMyRows_; i++) {
248  EPETRA_CHK_ERR(ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values()));
249  double scale = 0.0;
250  for (j=0; j < NumEntries; j++) scale += std::abs(Values[j]);
251  if (scale<Epetra_MinDouble) {
252  if (scale==0.0) ierr = 1; // Set error to 1 to signal that zero rowsum found (supercedes ierr = 2)
253  else if (ierr!=1) ierr = 2;
254  xp[i] = Epetra_MaxDouble;
255  }
256  else
257  xp[i] = 1.0/scale;
258  }
259  }
260  else { // x.Map different than both RowMatrixRowMap() and OperatorRangeMap()
261  EPETRA_CHK_ERR(-2); // The map of x must be the RowMap or RangeMap of A.
262  }
263  EPETRA_CHK_ERR(ierr);
265  return(0);
266 }
267 //=============================================================================
269  double *curValue;
270  int curRowIndex, curColIndex;
271  if(OperatorRangeMap().SameAs(x.Map()) && Exporter() != 0) {
273  xtmp.Import(x,*Exporter(),Insert);
274  for (int i=0; i<NumMyNonzeros_; i++) {
275  EPETRA_CHK_ERR(ExtractMyEntryView(i, curValue, curRowIndex, curColIndex));
276  *curValue *= xtmp[curRowIndex];
277  }
278  }
279  else if (RowMatrixRowMap().SameAs(x.Map()))
280  for (int i=0; i<NumMyNonzeros_; i++) {
281  EPETRA_CHK_ERR(ExtractMyEntryView(i, curValue, curRowIndex, curColIndex));
282  *curValue *= x[curRowIndex];
283  }
284  else {
285  EPETRA_CHK_ERR(-2); // The Map of x must be the RowMap or RangeMap of A.
286  }
287  HaveNumericConstants_ = false;
289  return(0);
290 }
291 //=============================================================================
293  int ierr = 0;
294  int i, j;
297  int NumEntries;
298  int MapNumMyElements = x.Map().NumMyElements();
299  x.PutScalar(0.0); // Make sure we sum into a vector of zeros.
300  double* xp = (double*)x.Values();
301  if(OperatorDomainMap().SameAs(x.Map()) && Importer() != 0) {
303  x_tmp.PutScalar(0.0);
304  double * x_tmp_p = (double*)x_tmp.Values();
305  for(i = 0; i < NumMyRows_; i++) {
306  EPETRA_CHK_ERR(ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values()));
307  for(j = 0; j < NumEntries; j++)
308  x_tmp_p[Indices[j]] += std::abs(Values[j]);
309  }
310  EPETRA_CHK_ERR(x.Export(x_tmp, *Importer(), Add)); // Fill x with partial column sums
311  }
312  else if(RowMatrixColMap().SameAs(x.Map())) {
313  for(i = 0; i < NumMyRows_; i++) {
314  EPETRA_CHK_ERR(ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values()));
315  for(j = 0; j < NumEntries; j++)
316  xp[Indices[j]] += std::abs(Values[j]);
317  }
318  }
319  else { //x.Map different than both RowMatrixColMap() and OperatorDomainMap()
320  EPETRA_CHK_ERR(-2); // x must have the same distribution as the domain of A
321  }
322 
323  // Invert values, don't allow them to get too large
324  for(i = 0; i < MapNumMyElements; i++) {
325  double scale = xp[i];
326  if(scale < Epetra_MinDouble) {
327  if(scale == 0.0)
328  ierr = 1; // Set error to 1 to signal that zero rowsum found (supercedes ierr = 2)
329  else if(ierr != 1)
330  ierr = 2;
331  xp[i] = Epetra_MaxDouble;
332  }
333  else
334  xp[i] = 1.0 / scale;
335  }
336 
337  EPETRA_CHK_ERR(ierr);
339  return(0);
340 }
341 //=============================================================================
343  double *curValue;
344  int curRowIndex, curColIndex;
345  if(OperatorDomainMap().SameAs(x.Map()) && Importer() != 0) {
347  xtmp.Import(x,*Importer(),Insert);
348  for (int i=0; i<NumMyNonzeros_; i++) {
349  EPETRA_CHK_ERR(ExtractMyEntryView(i, curValue, curRowIndex, curColIndex));
350  *curValue *= xtmp[curColIndex];
351  }
352  }
353  else if (RowMatrixColMap().SameAs(x.Map()))
354  for (int i=0; i<NumMyNonzeros_; i++) {
355  EPETRA_CHK_ERR(ExtractMyEntryView(i, curValue, curRowIndex, curColIndex));
356  *curValue *= x[curColIndex];
357  }
358  else {
359  EPETRA_CHK_ERR(-2); // The Map of x must be the RowMap or RangeMap of A.
360  }
361  HaveNumericConstants_ = false;
363  return(0);
364 }
365 //=============================================================================
367  //
368  // This function forms the product Y = A * Y or Y = A' * X
369  //
370 
373  int NumEntries;
374 
375  int NumVectors = X.NumVectors();
376  if (NumVectors!=Y.NumVectors()) {
377  EPETRA_CHK_ERR(-1); // Need same number of vectors in each MV
378  }
379 
380  UpdateImportVector(NumVectors); // Make sure Import and Export Vectors are compatible
381  UpdateExportVector(NumVectors);
382 
383  double ** Xp = (double**) X.Pointers();
384  double ** Yp = (double**) Y.Pointers();
385 
386  if (!TransA) {
387 
388  // If we have a non-trivial importer, we must import elements that are permuted or are on other processors
389  if (Importer()!=0) {
391  Xp = (double**)ImportVector_->Pointers();
392  }
393 
394  // If we have a non-trivial exporter, we must export elements that are permuted or belong to other processors
395  if (Exporter()!=0) {
396  Yp = (double**)ExportVector_->Pointers();
397  }
398 
399  // Do actual computation
400  for(int i = 0; i < NumMyRows_; i++) {
401  EPETRA_CHK_ERR(ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values()));
402  for (int k=0; k<NumVectors; k++) {
403  double sum = 0.0;
404  for(int j = 0; j < NumEntries; j++)
405  sum += Values[j]*Xp[k][Indices[j]];
406  Yp[k][i] = sum;
407  }
408  }
409 
410  if (Exporter()!=0) {
411  Y.PutScalar(0.0); // Make sure target is zero
412  Y.Export(*ExportVector_, *Exporter(), Add); // Fill Y with Values from export vector
413  }
414  // Handle case of rangemap being a local replicated map
415  if (!OperatorRangeMap().DistributedGlobal() && Comm().NumProc()>1) EPETRA_CHK_ERR(Y.Reduce());
416  }
417  else { // Transpose operation
418 
419 
420  // If we have a non-trivial exporter, we must import elements that are permuted or are on other processors
421 
422  if (Exporter()!=0) {
424  Xp = (double**)ExportVector_->Pointers();
425  }
426 
427  // If we have a non-trivial importer, we must export elements that are permuted or belong to other processors
428  if (Importer()!=0) {
429  Yp = (double**)ImportVector_->Pointers();
430  ImportVector_->PutScalar(0.0); // Make sure target is zero
431  }
432  else Y.PutScalar(0.0); // Make sure target is zero
433 
434  // Do actual computation
435  for(int i = 0; i < NumMyRows_; i++) {
436  EPETRA_CHK_ERR(ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values()));
437  for (int k=0; k<NumVectors; k++) {
438  double xtmp = Xp[k][i];
439  for(int j = 0; j < NumEntries; j++)
440  Yp[k][Indices[j]] += Values[j]*xtmp;
441  }
442  }
443 
444  if (Importer()!=0) {
445  Y.PutScalar(0.0); // Make sure target is zero
446  EPETRA_CHK_ERR(Y.Export(*ImportVector_, *Importer(), Add)); // Fill Y with Values from export vector
447  }
448  // Handle case of rangemap being a local replicated map
450  }
451 
452  UpdateFlops(2*NumVectors*NumGlobalNonzeros64());
453  return(0);
454 }
455 //=======================================================================================================
456 void Epetra_BasicRowMatrix::UpdateImportVector(int NumVectors) const {
457  if(Importer() != 0) {
458  if(ImportVector_ != 0) {
459  if(ImportVector_->NumVectors() != NumVectors) {
460  delete ImportVector_;
461  ImportVector_= 0;
462  }
463  }
464  if(ImportVector_ == 0)
465  ImportVector_ = new Epetra_MultiVector(Importer_->TargetMap(),NumVectors); // Create import vector if needed
466  }
467  return;
468 }
469 //=======================================================================================================
470 void Epetra_BasicRowMatrix::UpdateExportVector(int NumVectors) const {
471  if(Exporter() != 0) {
472  if(ExportVector_ != 0) {
473  if(ExportVector_->NumVectors() != NumVectors) {
474  delete ExportVector_;
475  ExportVector_= 0;
476  }
477  }
478  if(ExportVector_ == 0)
479  ExportVector_ = new Epetra_MultiVector(Exporter_->SourceMap(),NumVectors); // Create Export vector if needed
480  }
481  return;
482 }
483 
484 //=======================================================================================================
485 void Epetra_BasicRowMatrix::Print(std::ostream& os) const {
486 
487  int MyPID = RowMatrixRowMap().Comm().MyPID();
488  int NumProc = RowMatrixRowMap().Comm().NumProc();
489 
490  for (int iproc=0; iproc < NumProc; iproc++) {
491  if (MyPID==iproc) {
492  if (MyPID==0) {
493  os << "\nNumber of Global Rows = "; os << NumGlobalRows64(); os << std::endl;
494  os << "Number of Global Cols = "; os << NumGlobalCols64(); os << std::endl;
495  os << "Number of Global Diagonals = "; os << NumGlobalDiagonals64(); os << std::endl;
496  os << "Number of Global Nonzeros = "; os << NumGlobalNonzeros_; os << std::endl;
497  }
498 
499  os << "\nNumber of My Rows = "; os << NumMyRows_; os << std::endl;
500  os << "Number of My Cols = "; os << NumMyCols_; os << std::endl;
501  os << "Number of My Diagonals = "; os << NumMyDiagonals(); os << std::endl;
502  os << "Number of My Nonzeros = "; os << NumMyNonzeros_; os << std::endl;
503  os << "My Maximum Num Entries = "; os << MaxNumEntries_; os << std::endl; os << std::endl;
504  os << std::flush;
505 
506  }
507  // Do a few global ops to give I/O a chance to complete
508  Comm().Barrier();
509  Comm().Barrier();
510  Comm().Barrier();
511  }
512 
513  for (int iproc=0; iproc < NumProc; iproc++) {
514  if (MyPID==iproc) {
515  if (MyPID==0) {
516  os.width(8);
517  os << " Processor ";
518  os.width(10);
519  os << " Row Index ";
520  os.width(10);
521  os << " Col Index ";
522  os.width(20);
523  os << " Value ";
524  os << std::endl;
525  }
528  int NumEntries;
529 
530  for(int i = 0; i < NumMyRows_; i++) {
531  ExtractMyRowCopy(i, MaxNumEntries(), NumEntries, Values.Values(), Indices.Values());
532  long long Row = RowMatrixRowMap().GID64(i); // Get global row number
533 
534  for (int j = 0; j < NumEntries ; j++) {
535  long long Index = RowMatrixColMap().GID64(Indices[j]);
536  os.width(8);
537  os << MyPID ; os << " ";
538  os.width(10);
539  os << Row ; os << " ";
540  os.width(10);
541  os << Index; os << " ";
542  os.width(20);
543  os << Values[j]; os << " ";
544  os << std::endl;
545  }
546  }
547 
548  os << std::flush;
549 
550  }
551  // Do a few global ops to give I/O a chance to complete
552  Comm().Barrier();
553  Comm().Barrier();
554  Comm().Barrier();
555  }
556 
557  return;
558 }
void UpdateImportVector(int NumVectors) const
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
virtual const Epetra_Map & RowMatrixRowMap() const
Returns the Row Map object needed for implementing Epetra_RowMatrix.
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:127
bool DistributedGlobal() const
Returns true if map is defined across more than one processor.
virtual int InvColSums(Epetra_Vector &x) const
Computes the sum of absolute values of the columns of the Epetra_BasicRowMatrix, results returned in ...
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
virtual int LeftScale(const Epetra_Vector &x)
Scales the Epetra_BasicRowMatrix on the left with a Epetra_Vector x.
void SetMaps(const Epetra_Map &RowMap, const Epetra_Map &ColMap)
Set maps (Version 1); call this function or the next, but not both.
int MaxValue(double *Result) const
Compute maximum value of each vector in multi-vector.
virtual long long NumGlobalDiagonals64() const
virtual int NumMyDiagonals() const
Returns the number of local nonzero diagonal entries.
virtual int ExtractMyEntryView(int CurEntry, double *&Value, int &RowIndex, int &ColIndex)=0
Returns a reference to the ith entry in the matrix, along with its row and column index...
bool SameAs(const Epetra_BlockMap &Map) const
Returns true if this and Map are identical maps.
virtual void ComputeNumericConstants() const
Update the constants associated with the values of the matrix: Call only if values changes from the i...
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const
Returns a copy of the main diagonal in a user-provided vector.
const Epetra_BlockMap & SourceMap() const
Returns the SourceMap used to construct this exporter.
virtual const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this matrix.
virtual long long NumGlobalNonzeros64() const
int PutScalar(double ScalarConstant)
Initialize all values in a multi-vector with constant value.
int MyLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
virtual void SetLabel(const char *const Label)
Epetra_Object Label definition using char *.
double ** Pointers() const
Get pointer to individual vector pointers.
#define EPETRA_CHK_ERR(a)
virtual int InvRowSums(Epetra_Vector &x) const
Computes the sum of absolute values of the rows of the Epetra_BasicRowMatrix, results returned in x...
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
Definition: Epetra_Export.h:70
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
Definition: Epetra_Import.h:71
virtual void Barrier() const =0
Epetra_Comm Barrier function.
virtual int RightScale(const Epetra_Vector &x)
Scales the Epetra_BasicRowMatrix on the right with a Epetra_Vector x.
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const =0
Returns a copy of the specified local row in user-provided arrays.
int NumVectors() const
Returns the number of vectors in the multi-vector.
virtual int MyPID() const =0
Return my process ID.
virtual void Print(std::ostream &os) const
Print method.
void UpdateExportVector(int NumVectors) const
Epetra_SerialDenseVector: A class for constructing and using dense vectors.
virtual int SumAll(double *PartialSums, double *GlobalSums, int Count) const =0
Epetra_Comm Global Sum function.
int NumMyElements() const
Number of elements on the calling processor.
long long GID64(int LID) const
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.
virtual int MaxNumEntries() const
Returns the maximum number of nonzero entries across all rows on this processor.
Epetra_Comm: The Epetra Communication Abstract Base Class.
Definition: Epetra_Comm.h:81
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const =0
Return the current number of values stored for the specified local row.
const Epetra_BlockMap & TargetMap() const
Returns the TargetMap used to construct this importer.
Epetra_MultiVector * ExportVector_
const double Epetra_MaxDouble
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_BasicRowMatrix multiplied by a Epetra_MultiVector X in Y...
virtual const Epetra_Map & RowMatrixColMap() const
Returns the Column Map object needed for implementing Epetra_RowMatrix.
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
virtual ~Epetra_BasicRowMatrix()
Epetra_BasicRowMatrix Destructor.
virtual void ComputeStructureConstants() const
Update the constants associated with the structure of the matrix: Call only if structure changes from...
const double Epetra_MinDouble
double * Values() const
Get pointer to MultiVector values.
virtual const Epetra_Import * Importer() const
Returns the Epetra_Import object that contains the import operations for distributed operations...
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator (same as domain)...
virtual int NumProc() const =0
Returns total number of processes.
virtual const Epetra_Export * Exporter() const
Returns the Epetra_Export object that contains the export operations for distributed operations...
Epetra_BasicRowMatrix(const Epetra_Comm &Comm)
Epetra_BasicRowMatrix constructor.
virtual long long NumGlobalCols64() const
virtual long long NumGlobalRows64() const
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
int NumMyPoints() const
Number of local points for this map; equals the sum of all element sizes on the calling processor...
double * Values() const
Returns pointer to the values in vector.
int * Values()
Returns pointer to the values in vector.
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.
void UpdateFlops(int Flops_in) const
Increment Flop count for this object.
Epetra_MultiVector * ImportVector_
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.