queso-0.51.1
Matrix.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008,2009,2010,2011,2012,2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_MATRIX_H
26 #define UQ_MATRIX_H
27 
28 #include <queso/Environment.h>
29 #include <queso/Vector.h>
30 #include <iostream>
31 
32 namespace QUESO {
33 
46 class Matrix
47 {
48 public:
50 
51  Matrix();
53 
55  Matrix(const BaseEnvironment& env, const Map& map);
56 
58  Matrix(const Matrix& rhs);
59 
61  virtual ~Matrix();
63 
65 
66  Matrix& operator= (const Matrix& rhs);
68 
70  Matrix& operator*=(double a);
71 
73  Matrix& operator+=(const Matrix& rhs);
74 
76  Matrix& operator-=(const Matrix& rhs);
78 
80 
81  const BaseEnvironment& env () const;
82  const Map& map () const;
83  unsigned int numOfProcsForStorage() const;
85 
87 
88  virtual unsigned int numRowsLocal () const = 0;
90 
92  virtual unsigned int numRowsGlobal () const = 0;
93 
95  virtual unsigned int numCols () const = 0;
97 
99 
100  virtual int chol () = 0;
103 
104 
106 
107  virtual void zeroLower (bool includeDiagonal = false) = 0;
109 
111  virtual void zeroUpper (bool includeDiagonal = false) = 0;
113 
115 
116  virtual void print (std::ostream& os) const = 0;
118 
120  void setPrintHorizontally(bool value) const; // Yes, 'const'
121 
123  bool getPrintHorizontally() const;
124 
126  void setInDebugMode (bool value) const; // Yes, 'const'
127 
129  bool getInDebugMode () const;
131 
132 protected:
134  virtual void copy (const Matrix& src);
135 
138 
139 #ifdef QUESO_CLASSES_INSTANTIATE_NEW_MAPS
140 
142  const Map m_map;
143 
144 #else
145 
147  const Map& m_map;
148 
149 #endif
150 
152  mutable bool m_printHorizontally;
153 
155  mutable bool m_inDebugMode;
156 };
157 
158 } // End namespace QUESO
159 
160 #endif // UQ_MATRIX_H
virtual unsigned int numRowsGlobal() const =0
Returns the number of rows global of the matrix.
A class for partitioning vectors and matrices.
Definition: Map.h:49
const BaseEnvironment & env() const
Definition: Matrix.C:116
Matrix & operator*=(double a)
Operator for multiplication of the matrix by a scalar.
Definition: Matrix.C:82
virtual unsigned int numCols() const =0
Returns the number of columns local of the matrix.
Matrix & operator-=(const Matrix &rhs)
Operator for subtraction (element-wise) of two matrices.
Definition: Matrix.C:105
virtual void print(std::ostream &os) const =0
Print this matrix.
Matrix()
Default constructor.
Definition: Matrix.C:31
virtual void copy(const Matrix &src)
Copies matrix src to this matrix.
Definition: Matrix.C:168
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:187
Class for matrix operations (virtual).
Definition: Matrix.h:46
virtual void zeroUpper(bool includeDiagonal=false)=0
Sets to zero all the elements above (including or not) the diagonal of the matrix.
virtual unsigned int numRowsLocal() const =0
Returns the number of rows local of the matrix.
bool m_inDebugMode
Flag for either or not QUESO is in debug mode.
Definition: Matrix.h:155
Matrix & operator=(const Matrix &rhs)
Operator for copying a matrix.
Definition: Matrix.C:71
virtual int chol()=0
Performs Cholesky factorization of the matrix.
virtual ~Matrix()
Virtual Destructor.
Definition: Matrix.C:65
virtual void zeroLower(bool includeDiagonal=false)=0
Sets to zero all the elements bellow (including or not) the diagonal of the matrix.
const Map & m_map
Mapping variable.
Definition: Matrix.h:147
bool getInDebugMode() const
Checks if QUESO will run through this class in debug mode.
Definition: Matrix.C:161
bool m_printHorizontally
Flag for either or not print this matrix.
Definition: Matrix.h:152
const Map & map() const
Definition: Matrix.C:123
const BaseEnvironment & m_env
QUESO environment variable.
Definition: Matrix.h:137
bool getPrintHorizontally() const
Checks if matrix will be is printed horizontally.
Definition: Matrix.C:146
Matrix & operator+=(const Matrix &rhs)
Operator for addition (element-wise) of two matrices.
Definition: Matrix.C:94
void setInDebugMode(bool value) const
Determines whether QUESO will run through this class in debug mode.
Definition: Matrix.C:153
unsigned int numOfProcsForStorage() const
Definition: Matrix.C:131
void setPrintHorizontally(bool value) const
Determines whether the matrix should be printed horizontally.
Definition: Matrix.C:138

Generated on Thu Apr 23 2015 19:26:15 for queso-0.51.1 by  doxygen 1.8.5