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

#include <MatrixFuncs.h>

Inheritance diagram for Nektar::LowerTriangularMatrixFuncs:
[legend]

Static Public Member Functions

static unsigned int CalculateIndex (unsigned int totalColumns, 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, char transpose='N')
 
- Static Public Member Functions inherited from Nektar::TriangularMatrixFuncs
static unsigned int GetRequiredStorageSize (unsigned int rows, unsigned int columns)
 

Detailed Description

Definition at line 207 of file MatrixFuncs.h.

Member Function Documentation

◆ Advance()

std::tuple< unsigned int, unsigned int > Nektar::LowerTriangularMatrixFuncs::Advance ( const unsigned int  totalRows,
const unsigned int  totalColumns,
const unsigned int  curRow,
const unsigned int  curColumn,
char  transpose = 'N' 
)
static

Definition at line 226 of file MatrixFuncs.cpp.

229{
230 ASSERTL1(totalRows == totalColumns, "Triangular matrices must be square.");
231 ASSERTL1(curRow < totalRows,
232 "Attemping to iterate through an element on row " +
233 std::to_string(curRow) + " of a (" +
234 std::to_string(totalRows) + ", " +
235 std::to_string(totalColumns) + " lower triangular matrix.");
236 ASSERTL1(curColumn < totalColumns,
237 "Attemping to iterate through an element on row " +
238 std::to_string(curColumn) + " of a (" +
239 std::to_string(totalRows) + ", " +
240 std::to_string(totalColumns) + " lower triangular matrix.");
241 ASSERTL1(curRow >= curColumn,
242 "Attemping to iterate through element (" + std::to_string(curRow) +
243 ", " + std::to_string(curColumn) + ") of a (" +
244 std::to_string(totalRows) + ", " +
245 std::to_string(totalColumns) + " lower triangular matrix.");
246
247 if (transpose == 'T')
248 {
249 return UpperTriangularMatrixFuncs::Advance(totalColumns, totalRows,
250 curColumn, curRow);
251 }
252
253 unsigned int nextRow = curRow;
254 unsigned int nextColumn = curColumn;
255
256 if (nextRow < totalRows)
257 {
258 ++nextRow;
259 }
260
261 if (nextRow >= totalRows)
262 {
263 ++nextColumn;
264 nextRow = nextColumn;
265 }
266
267 if (nextColumn >= totalColumns)
268 {
269 nextRow = std::numeric_limits<unsigned int>::max();
270 nextColumn = std::numeric_limits<unsigned int>::max();
271 }
272
273 return std::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
274}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
static std::tuple< unsigned int, unsigned int > Advance(const unsigned int totalRows, const unsigned int totalColumns, const unsigned int curRow, const unsigned int curColumn)

References Nektar::UpperTriangularMatrixFuncs::Advance(), and ASSERTL1.

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

◆ CalculateIndex()

unsigned int Nektar::LowerTriangularMatrixFuncs::CalculateIndex ( unsigned int  totalColumns,
unsigned int  curRow,
unsigned int  curColumn 
)
static

Definition at line 213 of file MatrixFuncs.cpp.

215{
216 if (curRow >= curColumn)
217 {
218 return curRow + (2 * totalColumns - curColumn - 1) * (curColumn) / 2;
219 }
220 else
221 {
222 return std::numeric_limits<unsigned int>::max();
223 }
224}

Referenced by Nektar::ConstMatrix< DataType >::CalculateIndex().