73 int errorcode =
Shape(NumRows, NumCols);
79 int NumRows,
int NumCols)
89 throw ReportError(
"Null pointer passed as A_in parameter.", -3);
99 const int newsize =
LDA_ *
N_;
101 A_ =
new int[newsize];
122 const int newsize =
LDA_ *
N_;
124 A_ =
new int[newsize];
136 if(NumRows < 0 || NumCols < 0)
140 const int newsize = NumRows * NumCols;
144 A_tmp =
new int[newsize];
145 for(
int k = 0; k < newsize; k++)
163 if(NumRows < 0 || NumCols < 0)
170 const int newsize =
LDA_ *
N_;
172 A_ =
new int[newsize];
173 #ifdef EPETRA_HAVE_OMP
174 #pragma omp parallel for
176 for(
int k = 0; k < newsize; k++)
207 throw ReportError(
"operator= type mismatch (lhs = " + std::string(
Label()) +
208 ", rhs = " + std::string(Source.
Label()) +
").", -5);
226 const int newsize =
LDA_ *
N_;
228 A_ =
new int[newsize];
237 if((Source.
M_ <=
LDA_) && (Source.
N_ ==
N_)) {
246 const int newsize =
LDA_ *
N_;
248 A_ =
new int[newsize];
262 if (
M_ != rhs.
M_ ||
N_ != rhs.
N_)
return(
false);
264 const int* A_tmp =
A_;
265 const int* rhsA = rhs.
A_;
267 for(
int j=0; j<
N_; ++j) {
269 int rhsOffset = j*rhs.
LDA_;
270 for(
int i=0; i<
M_; ++i) {
271 if (A_tmp[offset+i] != rhsA[rhsOffset+i]) {
299 int* Target,
int Target_LDA)
302 int* targetPtr = Target;
304 for(j = 0; j < NumCols; j++) {
305 targetPtr = Target + j * Target_LDA;
306 sourcePtr = Source + j * Source_LDA;
307 for(i = 0; i < NumRows; i++)
308 *targetPtr++ = *sourcePtr++;
317 for(
int j = 0; j <
N_; j++) {
320 for(
int i = 0; i <
M_; i++)
321 sum += std::abs(*ptr++);
333 for(
int i = 0; i <
M_; i++) {
336 for(
int j = 0; j <
N_; j++) {
337 sum += std::abs(*ptr);
348 os <<
"Data access mode: Copy" << std::endl;
350 os <<
"Data access mode: View" << std::endl;
352 os <<
"A_Copied: yes" << std::endl;
354 os <<
"A_Copied: no" << std::endl;
355 os <<
"Rows(M): " <<
M_ << std::endl;
356 os <<
"Columns(N): " <<
N_ << std::endl;
357 os <<
"LDA: " <<
LDA_ << std::endl;
358 if(
M_ == 0 ||
N_ == 0)
359 os <<
"(matrix is empty, no values to display)" << std::endl;
361 for(
int i = 0; i <
M_; i++) {
362 for(
int j = 0; j <
N_; j++){
363 os << (*this)(i,j) <<
" ";
374 for(
int j = 0; j <
N_; j++) {
375 int* arrayPtr =
A_ + (j *
LDA_);
376 for(
int i = 0; i <
M_; i++) {
virtual ~Epetra_IntSerialDenseMatrix()
Epetra_IntSerialDenseMatrix destructor.
bool operator==(const Epetra_IntSerialDenseMatrix &rhs) const
Comparison operator.
int Shape(int NumRows, int NumCols)
Set dimensions of a Epetra_IntSerialDenseMatrix object; init values to zero.
void CopyMat(int *Source, int Source_LDA, int NumRows, int NumCols, int *Target, int Target_LDA)
unsigned int RandomInt()
Returns a random integer on the interval (0, 2^31-1)
Epetra_Util: The Epetra Util Wrapper Class.
virtual const char * Label() const
Epetra_Object Label access funtion.
std::string toString(const int &x) const
int Random()
Set matrix values to random numbers.
Epetra_Object: The base Epetra class.
virtual void Print(std::ostream &os) const
Print service methods; defines behavior of ostream << operator.
Epetra_IntSerialDenseMatrix: A class for constructing and using general dense integer matrices...
virtual int InfNorm()
Computes the Infinity-Norm of the this matrix.
int Reshape(int NumRows, int NumCols)
Reshape a Epetra_IntSerialDenseMatrix object.
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
virtual int OneNorm()
Computes the 1-Norm of the this matrix.
Epetra_IntSerialDenseMatrix & operator=(const Epetra_IntSerialDenseMatrix &Source)
Copy from one matrix to another.
Epetra_IntSerialDenseMatrix()
Default constructor; defines a zero size object.
int MakeViewOf(const Epetra_IntSerialDenseMatrix &Source)
Reset an existing IntSerialDenseMatrix to point to another Matrix.