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

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

References ASSERTL1.

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

◆ CalculateIndex()

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

Definition at line 150 of file MatrixFuncs.cpp.

151  {
152  if( curRow <= curColumn )
153  {
154  return curRow + curColumn*(curColumn+1)/2;
155  }
156  else
157  {
158  return std::numeric_limits<unsigned int>::max();
159  }
160  }

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