Nektar++
Static Public Member Functions | List of all members
Nektar::UpperTriangularMatrixFuncs Struct Reference

#include <MatrixFuncs.h>

Inheritance diagram for Nektar::UpperTriangularMatrixFuncs:
[legend]

Static Public Member Functions

static unsigned int CalculateIndex (unsigned int curRow, unsigned int curColumn)
 
static std::tuple< unsigned int, unsigned int > Advance (const unsigned int totalRows, const unsigned int totalColumns, const unsigned int curRow, const unsigned int curColumn)
 
- Static Public Member Functions inherited from Nektar::TriangularMatrixFuncs
static unsigned int GetRequiredStorageSize (unsigned int rows, unsigned int columns)
 

Detailed Description

Definition at line 196 of file MatrixFuncs.h.

Member Function Documentation

◆ Advance()

std::tuple< unsigned int, unsigned int > Nektar::UpperTriangularMatrixFuncs::Advance ( const unsigned int  totalRows,
const unsigned int  totalColumns,
const unsigned int  curRow,
const unsigned int  curColumn 
)
static

Definition at line 168 of file MatrixFuncs.cpp.

172{
173 ASSERTL1(totalRows == totalColumns, "Triangular matrices must be square.");
174 ASSERTL1(curRow < totalRows,
175 "Attemping to iterate through an element on row " +
176 std::to_string(curRow) + " of a (" +
177 std::to_string(totalRows) + ", " +
178 std::to_string(totalColumns) + " upper triangular matrix.");
179 ASSERTL1(curColumn < totalColumns,
180 "Attemping to iterate through an element on row " +
181 std::to_string(curColumn) + " of a (" +
182 std::to_string(totalRows) + ", " +
183 std::to_string(totalColumns) + " upper triangular matrix.");
184 ASSERTL1(curRow <= curColumn,
185 "Attemping to iterate through element (" + std::to_string(curRow) +
186 ", " + std::to_string(curColumn) + ") of a (" +
187 std::to_string(totalRows) + ", " +
188 std::to_string(totalColumns) + " upper triangular matrix.");
189
190 unsigned int nextRow = curRow;
191 unsigned int nextColumn = curColumn;
192
193 if (nextRow <= nextColumn)
194 {
195 ++nextRow;
196 }
197
198 if (nextRow > nextColumn)
199 {
200 ++nextColumn;
201 nextRow = 0;
202 }
203
204 if (nextColumn >= totalColumns)
205 {
206 nextRow = std::numeric_limits<unsigned int>::max();
207 nextColumn = std::numeric_limits<unsigned int>::max();
208 }
209
210 return std::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
211}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242

References ASSERTL1.

Referenced by Nektar::LowerTriangularMatrixFuncs::Advance(), Nektar::NekMatrix< DataType, StandardMatrixTag >::Advance(), and Nektar::UpperTriangularUnitTests::BOOST_AUTO_TEST_CASE().

◆ CalculateIndex()

unsigned int Nektar::UpperTriangularMatrixFuncs::CalculateIndex ( unsigned int  curRow,
unsigned int  curColumn 
)
static

Definition at line 155 of file MatrixFuncs.cpp.

157{
158 if (curRow <= curColumn)
159 {
160 return curRow + curColumn * (curColumn + 1) / 2;
161 }
162 else
163 {
164 return std::numeric_limits<unsigned int>::max();
165 }
166}