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 232 of file MatrixFuncs.cpp.

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

◆ CalculateIndex()

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

Definition at line 219 of file MatrixFuncs.cpp.

221 {
222  if (curRow >= curColumn)
223  {
224  return curRow + (2 * totalColumns - curColumn - 1) * (curColumn) / 2;
225  }
226  else
227  {
228  return std::numeric_limits<unsigned int>::max();
229  }
230 }

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