47 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
76 int errorcode =
Shape(NumRows, NumCols);
82 int NumRows,
int NumCols)
92 throw ReportError(
"Null pointer passed as A_in parameter.", -3);
102 const int newsize =
LDA_ *
N_;
104 A_ =
new long long[newsize];
125 const int newsize =
LDA_ *
N_;
127 A_ =
new long long[newsize];
139 if(NumRows < 0 || NumCols < 0)
142 long long* A_tmp = 0;
143 const int newsize = NumRows * NumCols;
147 A_tmp =
new long long[newsize];
148 for(
int k = 0; k < newsize; k++)
166 if(NumRows < 0 || NumCols < 0)
173 const int newsize =
LDA_ *
N_;
175 A_ =
new long long[newsize];
176 #ifdef EPETRA_HAVE_OMP
177 #pragma omp parallel for
179 for(
int k = 0; k < newsize; k++)
210 throw ReportError(
"operator= type mismatch (lhs = " + std::string(
Label()) +
211 ", rhs = " + std::string(Source.
Label()) +
").", -5);
229 const int newsize =
LDA_ *
N_;
231 A_ =
new long long[newsize];
240 if((Source.
M_ <=
LDA_) && (Source.
N_ ==
N_)) {
249 const int newsize =
LDA_ *
N_;
251 A_ =
new long long[newsize];
265 if (
M_ != rhs.
M_ ||
N_ != rhs.
N_)
return(
false);
267 const long long* A_tmp =
A_;
268 const long long* rhsA = rhs.
A_;
270 for(
int j=0; j<
N_; ++j) {
272 int rhsOffset = j*rhs.
LDA_;
273 for(
int i=0; i<
M_; ++i) {
274 if (A_tmp[offset+i] != rhsA[rhsOffset+i]) {
302 long long* Target,
int Target_LDA)
305 long long* targetPtr = Target;
306 long long* sourcePtr = 0;
307 for(j = 0; j < NumCols; j++) {
308 targetPtr = Target + j * Target_LDA;
309 sourcePtr = Source + j * Source_LDA;
310 for(i = 0; i < NumRows; i++)
311 *targetPtr++ = *sourcePtr++;
320 for(
int j = 0; j <
N_; j++) {
323 for(
int i = 0; i <
M_; i++)
325 const long long val = *ptr++;
326 sum += (val > 0 ? val : -val);
339 for(
int i = 0; i <
M_; i++) {
342 for(
int j = 0; j <
N_; j++) {
343 const long long val = *ptr;
344 sum += (val > 0 ? val : -val);
355 os <<
"Data access mode: Copy" << std::endl;
357 os <<
"Data access mode: View" << std::endl;
359 os <<
"A_Copied: yes" << std::endl;
361 os <<
"A_Copied: no" << std::endl;
362 os <<
"Rows(M): " <<
M_ << std::endl;
363 os <<
"Columns(N): " <<
N_ << std::endl;
364 os <<
"LDA: " <<
LDA_ << std::endl;
365 if(
M_ == 0 ||
N_ == 0)
366 os <<
"(matrix is empty, no values to display)" << std::endl;
368 for(
int i = 0; i <
M_; i++) {
369 for(
int j = 0; j <
N_; j++){
370 os << (*this)(i,j) <<
" ";
381 for(
int j = 0; j <
N_; j++) {
382 long long* arrayPtr =
A_ + (j *
LDA_);
383 for(
int i = 0; i <
M_; i++) {
391 #endif // EPETRA_NO_64BIT_GLOBAL_INDICES
Epetra_LongLongSerialDenseMatrix()
Default constructor; defines a zero size object.
int MakeViewOf(const Epetra_LongLongSerialDenseMatrix &Source)
Reset an existing LongLongSerialDenseMatrix to point to another Matrix.
bool operator==(const Epetra_LongLongSerialDenseMatrix &rhs) const
Comparison operator.
virtual long long InfNorm()
Computes the Infinity-Norm of the this matrix.
void CopyMat(long long *Source, int Source_LDA, int NumRows, int NumCols, long long *Target, int Target_LDA)
unsigned int RandomInt()
Returns a random integer on the interval (0, 2^31-1)
virtual ~Epetra_LongLongSerialDenseMatrix()
Epetra_LongLongSerialDenseMatrix destructor.
virtual long long OneNorm()
Computes the 1-Norm of the this matrix.
Epetra_Util: The Epetra Util Wrapper Class.
virtual const char * Label() const
Epetra_Object Label access funtion.
std::string toString(const int &x) const
Epetra_Object: The base Epetra class.
int Random()
Set matrix values to random numbers.
int Shape(int NumRows, int NumCols)
Set dimensions of a Epetra_LongLongSerialDenseMatrix object; init values to zero. ...
int Reshape(int NumRows, int NumCols)
Reshape a Epetra_LongLongSerialDenseMatrix object.
Epetra_LongLongSerialDenseMatrix & operator=(const Epetra_LongLongSerialDenseMatrix &Source)
Copy from one matrix to another.
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
virtual void Print(std::ostream &os) const
Print service methods; defines behavior of ostream << operator.
Epetra_LongLongSerialDenseMatrix: A class for constructing and using general dense integer matrices...