12 namespace FdEnergyDepositFinderKG {
33 const unsigned int n =
GetSize();
45 for (
unsigned int row = 0; row < n; ++row) {
46 const double*
const rowArray = &
fElements[(row*(row+1))/2];
48 for (
unsigned int col = 0; col <= row; ++col)
49 sum += rowArray[col] * rhs.
fElements[col];
61 const unsigned int n =
GetSize();
66 for (
unsigned int row = 0; row < n; ++row) {
67 const unsigned int idx_row = (row*(row+1))/2;
68 for (
unsigned int col = 0; col <= row; ++col) {
69 const unsigned int idx = idx_row + col;
81 const unsigned int n =
GetSize();
87 const double epsilon = std::numeric_limits<double>::epsilon();
90 for (
unsigned int i = 0; i < n; ++i) {
91 const double tmp = t(i, i);
92 if (fabs(tmp) > epsilon)
95 std::ostringstream errMsg;
96 errMsg <<
"singular lower triangular matrix "
97 "diagonal element " << i <<
" too small: "
104 for (
unsigned int i = 1; i < n; ++i) {
105 double diag = t(i, i);
106 for (
unsigned int k = 0; k < i; ++k) {
108 for (
unsigned int j = k; j < i; ++j)
109 sum += t(i, j) * r(j, k);
122 std::ostringstream dump;
123 dump << std::resetiosflags(std::ios::scientific)
124 << std::setiosflags(std::ios::fixed) << std::setprecision(2)
125 << std::setfill(
' ');
126 const unsigned int n =
GetSize();
127 dump <<
"LowerTriangularMatrix(" << n <<
"):\n";
128 for (
unsigned int row = 0; row < n; ++row) {
130 for (
unsigned int col = 0; col < n; ++col) {
131 dump << std::setw(8);
133 dump << (*this)(row, col) <<
" ";
139 std::cout << dump.str() << std::flush;
147 const unsigned int n =
GetSize();
152 for (
unsigned int row = 0; row < n; ++row) {
153 const unsigned int idx = (row*(row+1))/2 + row;
193 std::ostringstream dump;
194 dump << std::resetiosflags(std::ios::scientific)
195 << std::setiosflags(std::ios::fixed) << std::setprecision(2)
196 << std::setfill(
' ');
197 const unsigned int n =
GetSize();
198 dump <<
"DiagonalMatrix(" << n <<
"):\n";
199 for (
unsigned int row = 0; row < n; ++row) {
201 for (
unsigned int col = 0; col < n; ++col) {
202 dump << std::setw(8);
204 dump << (*this)(row) <<
' ';
210 std::cout << dump.str() << std::flush;
218 const unsigned int n =
GetSize();
223 for (
unsigned int row = 0; row < n; ++row)
234 const unsigned int n =
GetSize();
239 for (
unsigned int row = 0; row < n; ++row)
250 const unsigned int n =
GetSize();
256 const double epsilon = std::numeric_limits<double>::epsilon();
259 for (
unsigned int i = 0; i < n; ++i) {
260 const double tmp = t(i, i);
261 if (fabs(tmp) > epsilon)
264 std::ostringstream errMsg;
265 errMsg <<
"singular diagonal matrix "
266 "element " << i <<
" too small: "
282 const unsigned int n =
GetSize();
287 for (
unsigned int row = 0; row < n; ++row)
const double & operator()(const int row, const int col) const
Read-only access to a matrix element.
void Zero()
Set all elements to 0.
unsigned int GetSize() const
DiagonalMatrix GetInverse() const
ColumnVector operator*(const ColumnVector &rhs) const
void diag(const std::string &msg)
LowerTriangularMatrix operator+(const LowerTriangularMatrix &rhs) const
Exception for reporting variable out of valid range.
ColumnVector operator+(const ColumnVector &rhs) const
std::vector< double > fElements
void Zero()
Set all elements to 0.
unsigned int GetSize() const
LowerTriangularMatrix GetInverse() const
Get the inverse of the matrix.
void Print() const
Dump ASCII representation to STDOUT (for debugging)
ColumnVector operator*(const ColumnVector &rhs) const
std::vector< double > fElements
DiagonalMatrix operator+(const DiagonalMatrix &rhs) const
void Zero()
Set all elements to 0.
unsigned int GetSize() const
void Print() const
Dump ASCII representation to STDOUT (for debugging)
std::vector< double > fElements