Epetra Package Browser (Single Doxygen Collection)
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Epetra_SerialDenseVector.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_SERIALDENSEVECTOR_H
45
#define EPETRA_SERIALDENSEVECTOR_H
46
47
#include "
Epetra_Object.h
"
48
#include "
Epetra_SerialDenseMatrix.h
"
49
51
92
93
94
//=========================================================================
95
class
EPETRA_LIB_DLL_EXPORT
Epetra_SerialDenseVector
:
public
Epetra_SerialDenseMatrix
{
96
97
public
:
98
100
101
107
Epetra_SerialDenseVector
();
108
110
119
Epetra_SerialDenseVector
(
int
Length
);
120
122
132
Epetra_SerialDenseVector
(
Epetra_DataAccess
CV
,
double
*
Values
,
int
Length
);
133
135
136
Epetra_SerialDenseVector
(
const
Epetra_SerialDenseVector
& Source);
137
138
140
virtual
~Epetra_SerialDenseVector
();
142
144
145
147
157
int
Size
(
int
Length_in) {
return
(
Epetra_SerialDenseMatrix::Shape
(Length_in, 1));};
158
160
171
int
Resize
(
int
Length_in) {
return
(
Epetra_SerialDenseMatrix::Reshape
(Length_in, 1));};
172
174
176
177
184
Epetra_SerialDenseVector
&
operator =
(
const
Epetra_SerialDenseVector
& Source);
185
186
//let the compiler know we intend to overload the base-class function
187
//operator() rather than hide it.
188
using
Epetra_SerialDenseMatrix::operator();
189
191
197
double
&
operator ()
(
int
Index);
198
200
206
const
double
&
operator ()
(
int
Index)
const
;
207
209
215
double
&
operator []
(
int
Index);
216
218
224
const
double
&
operator []
(
int
Index)
const
;
225
227
229
230
237
int
Random
();
238
240
245
double
Dot(
const
Epetra_SerialDenseVector
& x)
const
;
246
248
251
double
Norm1()
const
;
252
254
258
double
Norm2()
const
;
259
261
264
double
NormInf
()
const
;
265
267
269
270
271
int
Length
()
const
{
return
(
M_
);};
272
274
double
*
Values
()
const
{
return
(
A_
);};
275
277
Epetra_DataAccess
CV
()
const
{
return
(
CV_
);};
278
280
282
283
284
virtual
void
Print
(std::ostream& os)
const
;
286
};
287
288
// inlined definitions of op() and op[]
289
//=========================================================================
290
inline
double
&
Epetra_SerialDenseVector::operator()
(
int
Index) {
291
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
292
if
(Index >=
M_
|| Index < 0)
293
throw
ReportError
(
"Index = "
+
toString
(Index) +
" Out of Range 0 - "
+
toString
(
M_
-1), -1);
294
#endif
295
return
(
A_
[Index]);
296
}
297
//=========================================================================
298
inline
const
double
&
Epetra_SerialDenseVector::operator()
(
int
Index)
const
{
299
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
300
if
(Index >=
M_
|| Index < 0)
301
throw
ReportError
(
"Index = "
+
toString
(Index) +
" Out of Range 0 - "
+
toString
(
M_
-1), -1);
302
#endif
303
return
(
A_
[Index]);
304
}
305
//=========================================================================
306
inline
double
&
Epetra_SerialDenseVector::operator []
(
int
Index) {
307
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
308
if
(Index >=
M_
|| Index < 0)
309
throw
ReportError
(
"Index = "
+
toString
(Index) +
" Out of Range 0 - "
+
toString
(
M_
-1), -1);
310
#endif
311
return
(
A_
[Index]);
312
}
313
//=========================================================================
314
inline
const
double
&
Epetra_SerialDenseVector::operator []
(
int
Index)
const
{
315
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
316
if
(Index >=
M_
|| Index < 0)
317
throw
ReportError
(
"Index = "
+
toString
(Index) +
" Out of Range 0 - "
+
toString
(
M_
-1), -1);
318
#endif
319
return
(
A_
[Index]);
320
}
321
//=========================================================================
322
323
#endif
/* EPETRA_SERIALDENSEVECTOR_H */
Epetra_DataAccess
Epetra_DataAccess
Definition
Epetra_DataAccess.h:55
Epetra_Object.h
Epetra_SerialDenseMatrix.h
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_SerialDenseMatrix::CV_
Epetra_DataAccess CV_
Definition
Epetra_SerialDenseMatrix.h:482
Epetra_SerialDenseMatrix::Print
virtual void Print(std::ostream &os) const
Print service methods; defines behavior of ostream << operator.
Definition
Epetra_SerialDenseMatrix.cpp:527
Epetra_SerialDenseMatrix::operator[]
double * operator[](int ColIndex)
Column access function.
Definition
Epetra_SerialDenseMatrix.h:523
Epetra_SerialDenseMatrix::A_
double * A_
Definition
Epetra_SerialDenseMatrix.h:492
Epetra_SerialDenseMatrix::M_
int M_
Definition
Epetra_SerialDenseMatrix.h:479
Epetra_SerialDenseMatrix::Epetra_SerialDenseMatrix
Epetra_SerialDenseMatrix(bool set_object_label=true)
Default constructor; defines a zero size object.
Definition
Epetra_SerialDenseMatrix.cpp:49
Epetra_SerialDenseMatrix::NormInf
virtual double NormInf() const
Computes the Infinity-Norm of the this matrix.
Definition
Epetra_SerialDenseMatrix.cpp:384
Epetra_SerialDenseMatrix::Random
int Random()
Set matrix values to random numbers.
Definition
Epetra_SerialDenseMatrix.cpp:551
Epetra_SerialDenseMatrix::operator=
Epetra_SerialDenseMatrix & operator=(const Epetra_SerialDenseMatrix &Source)
Value copy from one matrix to another.
Definition
Epetra_SerialDenseMatrix.cpp:221
Epetra_SerialDenseMatrix::Shape
int Shape(int NumRows, int NumCols)
Set dimensions of a Epetra_SerialDenseMatrix object; init values to zero.
Definition
Epetra_SerialDenseMatrix.cpp:186
Epetra_SerialDenseMatrix::operator()
double & operator()(int RowIndex, int ColIndex)
Element access function.
Definition
Epetra_SerialDenseMatrix.h:499
Epetra_SerialDenseMatrix::Reshape
int Reshape(int NumRows, int NumCols)
Reshape a Epetra_SerialDenseMatrix object.
Definition
Epetra_SerialDenseMatrix.cpp:157
Epetra_SerialDenseVector
Epetra_SerialDenseVector: A class for constructing and using dense vectors.
Definition
Epetra_SerialDenseVector.h:95
Epetra_SerialDenseVector::Size
int Size(int Length_in)
Set length of a Epetra_SerialDenseVector object; init values to zero.
Definition
Epetra_SerialDenseVector.h:157
Epetra_SerialDenseVector::Epetra_SerialDenseVector
Epetra_SerialDenseVector()
Default constructor; defines a zero size object.
Definition
Epetra_SerialDenseVector.cpp:45
Epetra_SerialDenseVector::CV
Epetra_DataAccess CV() const
Returns the data access mode of the this vector.
Definition
Epetra_SerialDenseVector.h:277
Epetra_SerialDenseVector::Resize
int Resize(int Length_in)
Resize a Epetra_SerialDenseVector object.
Definition
Epetra_SerialDenseVector.h:171
Epetra_SerialDenseVector::Values
double * Values() const
Returns pointer to the values in vector.
Definition
Epetra_SerialDenseVector.h:274
Epetra_SerialDenseVector::operator()
double & operator()(int Index)
Element access function.
Definition
Epetra_SerialDenseVector.h:290
Epetra_SerialDenseVector::operator[]
double & operator[](int Index)
Element access function.
Definition
Epetra_SerialDenseVector.h:306
Epetra_SerialDenseVector::Length
int Length() const
Returns length of vector.
Definition
Epetra_SerialDenseVector.h:271
Generated by
1.17.0