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

#include <MatrixFuncs.h>

Inheritance diagram for Nektar::LowerTriangularMatrixFuncs:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LowerTriangularMatrixFuncs:
Collaboration graph
[legend]

Static Public Member Functions

static unsigned int CalculateIndex (unsigned int totalColumns, unsigned int curRow, unsigned int curColumn)
 
static boost::tuples::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 185 of file MatrixFuncs.h.

Member Function Documentation

boost::tuples::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 234 of file MatrixFuncs.cpp.

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

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

237  {
238  ASSERTL1(totalRows == totalColumns, "Triangular matrices must be square.");
239  ASSERTL1(curRow < totalRows, "Attemping to iterate through an element on row " +
240  boost::lexical_cast<std::string>(curRow) + " of a (" +
241  boost::lexical_cast<std::string>(totalRows) + ", " +
242  boost::lexical_cast<std::string>(totalColumns) + " lower triangular matrix.");
243  ASSERTL1(curColumn < totalColumns, "Attemping to iterate through an element on row " +
244  boost::lexical_cast<std::string>(curColumn) + " of a (" +
245  boost::lexical_cast<std::string>(totalRows) + ", " +
246  boost::lexical_cast<std::string>(totalColumns) + " lower triangular matrix.");
247  ASSERTL1(curRow >= curColumn, "Attemping to iterate through element (" +
248  boost::lexical_cast<std::string>(curRow) + ", " +
249  boost::lexical_cast<std::string>(curColumn) + ") of a (" +
250  boost::lexical_cast<std::string>(totalRows) + ", " +
251  boost::lexical_cast<std::string>(totalColumns) + " lower triangular matrix.");
252 
253  if( transpose == 'T' )
254  {
256  totalColumns, totalRows, 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 boost::tuples::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
280  }
static boost::tuples::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:191
unsigned int Nektar::LowerTriangularMatrixFuncs::CalculateIndex ( unsigned int  totalColumns,
unsigned int  curRow,
unsigned int  curColumn 
)
static

Definition at line 221 of file MatrixFuncs.cpp.

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

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