Epetra Package Browser (Single Doxygen Collection)
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Epetra_IntSerialDenseMatrix.h
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
44
#ifndef EPETRA_INTSERIALDENSEMATRIX_H
45
#define EPETRA_INTSERIALDENSEMATRIX_H
46
47
#include "
Epetra_Object.h
"
48
50
114
115
116
//=========================================================================
117
class
EPETRA_LIB_DLL_EXPORT
Epetra_IntSerialDenseMatrix
:
public
Epetra_Object
{
118
119
public
:
120
122
123
129
Epetra_IntSerialDenseMatrix
();
130
132
143
Epetra_IntSerialDenseMatrix
(
int
NumRows,
int
NumCols);
144
146
161
Epetra_IntSerialDenseMatrix
(
Epetra_DataAccess
CV
,
int
*
A
,
int
LDA
,
int
NumRows,
int
NumCols);
162
164
167
Epetra_IntSerialDenseMatrix
(
const
Epetra_IntSerialDenseMatrix
& Source);
168
170
virtual
~Epetra_IntSerialDenseMatrix
();
172
174
175
188
int
Shape
(
int
NumRows,
int
NumCols);
189
191
204
int
Reshape
(
int
NumRows,
int
NumCols);
206
208
209
211
214
virtual
int
OneNorm
();
215
217
virtual
int
InfNorm
();
218
220
226
Epetra_IntSerialDenseMatrix
&
operator =
(
const
Epetra_IntSerialDenseMatrix
& Source);
227
229
232
bool
operator==
(
const
Epetra_IntSerialDenseMatrix
& rhs)
const
;
233
235
237
bool
operator!=
(
const
Epetra_IntSerialDenseMatrix
& rhs)
const
238
{
return
!(*
this
== rhs); }
239
241
250
int
& operator () (
int
RowIndex,
int
ColIndex);
251
253
262
const
int
& operator () (
int
RowIndex,
int
ColIndex)
const
;
263
265
275
int
* operator [] (
int
ColIndex);
276
278
288
const
int
* operator [] (
int
ColIndex)
const
;
289
291
297
int
Random
();
298
300
int
M
()
const
{
return
(
M_
);};
301
303
int
N
()
const
{
return
(
N_
);};
304
306
const
int
*
A
()
const
{
return
(
A_
);};
307
309
int
*
A
() {
return
(
A_
);};
310
312
int
LDA
()
const
{
return
(
LDA_
);};
313
315
Epetra_DataAccess
CV
()
const
{
return
(
CV_
);};
317
319
320
321
virtual
void
Print
(std::ostream& os)
const
;
323
325
326
328
344
345
int
MakeViewOf(
const
Epetra_IntSerialDenseMatrix
& Source);
347
348
protected
:
349
350
void
CopyMat(
int
* Source,
int
Source_LDA,
int
NumRows,
int
NumCols,
int
* Target,
int
Target_LDA);
351
void
CleanupData();
352
353
Epetra_DataAccess
CV_
;
354
bool
A_Copied_
;
355
int
M_
;
356
int
N_
;
357
int
LDA_
;
358
int
*
A_
;
359
360
};
361
362
// inlined definitions of op() and op[]
363
//=========================================================================
364
inline
int
&
Epetra_IntSerialDenseMatrix::operator ()
(
int
RowIndex,
int
ColIndex) {
365
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
366
if
(RowIndex >=
M_
|| RowIndex < 0)
367
throw
ReportError
(
"Row index = "
+
toString
(RowIndex) +
368
" Out of Range 0 - "
+
toString
(
M_
-1),-1);
369
if
(ColIndex >=
N_
|| ColIndex < 0)
370
throw
ReportError
(
"Column index = "
+
toString
(ColIndex) +
371
" Out of Range 0 - "
+
toString
(
N_
-1),-2);
372
#endif
373
return
(
A_
[ColIndex*
LDA_
+ RowIndex]);
374
}
375
//=========================================================================
376
inline
const
int
&
Epetra_IntSerialDenseMatrix::operator ()
(
int
RowIndex,
int
ColIndex)
const
{
377
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
378
if
(RowIndex >=
M_
|| RowIndex < 0)
379
throw
ReportError
(
"Row index = "
+
toString
(RowIndex) +
380
" Out of Range 0 - "
+
toString
(
M_
-1),-1);
381
if
(ColIndex >=
N_
|| ColIndex < 0)
382
throw
ReportError
(
"Column index = "
+
toString
(ColIndex) +
383
" Out of Range 0 - "
+
toString
(
N_
-1),-2);
384
#endif
385
return
(
A_
[ColIndex *
LDA_
+ RowIndex]);
386
}
387
//=========================================================================
388
inline
int
*
Epetra_IntSerialDenseMatrix::operator []
(
int
ColIndex) {
389
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
390
if
(ColIndex >=
N_
|| ColIndex < 0)
391
throw
ReportError
(
"Column index = "
+
toString
(ColIndex) +
392
" Out of Range 0 - "
+
toString
(
N_
-1),-2);
393
#endif
394
return
(
A_
+ ColIndex *
LDA_
);
395
}
396
//=========================================================================
397
inline
const
int
*
Epetra_IntSerialDenseMatrix::operator []
(
int
ColIndex)
const
{
398
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
399
if
(ColIndex >=
N_
|| ColIndex < 0)
400
throw
ReportError
(
"Column index = "
+
toString
(ColIndex) +
401
" Out of Range 0 - "
+
toString
(
N_
-1),-2);
402
#endif
403
return
(
A_
+ ColIndex *
LDA_
);
404
}
405
//=========================================================================
406
407
#endif
/* EPETRA_INTSERIALDENSEMATRIX_H */
Epetra_DataAccess
Epetra_DataAccess
Definition
Epetra_DataAccess.h:55
Epetra_Object.h
Epetra_IntSerialDenseMatrix
Epetra_IntSerialDenseMatrix: A class for constructing and using general dense integer matrices.
Definition
Epetra_IntSerialDenseMatrix.h:117
Epetra_IntSerialDenseMatrix::A_
int * A_
Definition
Epetra_IntSerialDenseMatrix.h:358
Epetra_IntSerialDenseMatrix::Shape
int Shape(int NumRows, int NumCols)
Set dimensions of a Epetra_IntSerialDenseMatrix object; init values to zero.
Definition
Epetra_IntSerialDenseMatrix.cpp:162
Epetra_IntSerialDenseMatrix::Epetra_IntSerialDenseMatrix
Epetra_IntSerialDenseMatrix()
Default constructor; defines a zero size object.
Definition
Epetra_IntSerialDenseMatrix.cpp:47
Epetra_IntSerialDenseMatrix::LDA
int LDA() const
Returns the leading dimension of the this matrix.
Definition
Epetra_IntSerialDenseMatrix.h:312
Epetra_IntSerialDenseMatrix::M
int M() const
Returns row dimension of system.
Definition
Epetra_IntSerialDenseMatrix.h:300
Epetra_IntSerialDenseMatrix::M_
int M_
Definition
Epetra_IntSerialDenseMatrix.h:355
Epetra_IntSerialDenseMatrix::A
int * A()
Returns pointer to the this matrix.
Definition
Epetra_IntSerialDenseMatrix.h:309
Epetra_IntSerialDenseMatrix::operator!=
bool operator!=(const Epetra_IntSerialDenseMatrix &rhs) const
Inequality operator.
Definition
Epetra_IntSerialDenseMatrix.h:237
Epetra_IntSerialDenseMatrix::Reshape
int Reshape(int NumRows, int NumCols)
Reshape a Epetra_IntSerialDenseMatrix object.
Definition
Epetra_IntSerialDenseMatrix.cpp:135
Epetra_IntSerialDenseMatrix::operator[]
int * operator[](int ColIndex)
Column access function.
Definition
Epetra_IntSerialDenseMatrix.h:388
Epetra_IntSerialDenseMatrix::operator==
bool operator==(const Epetra_IntSerialDenseMatrix &rhs) const
Comparison operator.
Definition
Epetra_IntSerialDenseMatrix.cpp:260
Epetra_IntSerialDenseMatrix::A_Copied_
bool A_Copied_
Definition
Epetra_IntSerialDenseMatrix.h:354
Epetra_IntSerialDenseMatrix::N
int N() const
Returns column dimension of system.
Definition
Epetra_IntSerialDenseMatrix.h:303
Epetra_IntSerialDenseMatrix::N_
int N_
Definition
Epetra_IntSerialDenseMatrix.h:356
Epetra_IntSerialDenseMatrix::LDA_
int LDA_
Definition
Epetra_IntSerialDenseMatrix.h:357
Epetra_IntSerialDenseMatrix::InfNorm
virtual int InfNorm()
Computes the Infinity-Norm of the this matrix.
Definition
Epetra_IntSerialDenseMatrix.cpp:328
Epetra_IntSerialDenseMatrix::OneNorm
virtual int OneNorm()
Computes the 1-Norm of the this matrix.
Definition
Epetra_IntSerialDenseMatrix.cpp:314
Epetra_IntSerialDenseMatrix::CV_
Epetra_DataAccess CV_
Definition
Epetra_IntSerialDenseMatrix.h:353
Epetra_IntSerialDenseMatrix::CV
Epetra_DataAccess CV() const
Returns the data access mode of the this matrix.
Definition
Epetra_IntSerialDenseMatrix.h:315
Epetra_IntSerialDenseMatrix::A
const int * A() const
Returns const pointer to the this matrix.
Definition
Epetra_IntSerialDenseMatrix.h:306
Epetra_IntSerialDenseMatrix::operator()
int & operator()(int RowIndex, int ColIndex)
Element access function.
Definition
Epetra_IntSerialDenseMatrix.h:364
Epetra_IntSerialDenseVector::Random
int Random()
Set vector values to random numbers.
Definition
Epetra_IntSerialDenseVector.cpp:107
Epetra_Object::Print
virtual void Print(std::ostream &os) const
Definition
Epetra_Object.cpp:97
Epetra_Object::ReportError
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
Definition
Epetra_Object.cpp:103
Epetra_Object::toString
std::string toString(const int &x) const
Definition
Epetra_Object.h:145
Epetra_Object::Epetra_Object
Epetra_Object(int TracebackModeIn=-1, bool set_label=true)
Epetra_Object Constructor.
Definition
Epetra_Object.cpp:50
Epetra_Object::operator=
Epetra_Object & operator=(const Epetra_Object &src)
Definition
Epetra_Object.h:164
Generated by
1.17.0