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

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

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

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

◆ CalculateIndex()

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

Definition at line 207 of file MatrixFuncs.cpp.

Referenced by Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::CalculateIndex().

208  {
209  if( curRow >= curColumn )
210  {
211  return curRow + (2*totalColumns - curColumn - 1)*(curColumn)/2;
212  }
213  else
214  {
215  return std::numeric_limits<unsigned int>::max();
216  }
217  }