Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | List of all members
Nektar::DiagonalMatrixFuncs Struct Reference

#include <MatrixFuncs.h>

Static Public Member Functions

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)
template<typename DataType >
static void Invert (unsigned int rows, unsigned int columns, Array< OneD, DataType > &data)
static unsigned int GetRequiredStorageSize (unsigned int rows, unsigned int columns)
static unsigned int CalculateIndex (unsigned int row, unsigned int col)

Detailed Description

Definition at line 208 of file MatrixFuncs.h.

Member Function Documentation

boost::tuples::tuple< unsigned int, unsigned int > Nektar::DiagonalMatrixFuncs::Advance ( const unsigned int  totalRows,
const unsigned int  totalColumns,
const unsigned int  curRow,
const unsigned int  curColumn 
)
static

Definition at line 333 of file MatrixFuncs.cpp.

References ASSERTL0.

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

{
ASSERTL0(curRow == curColumn, "Iteration of a diagonal matrix is only valid along the diagonal.");
unsigned int nextRow = curRow;
unsigned int nextColumn = curColumn;
if( nextRow < totalRows )
{
++nextRow;
++nextColumn;
}
if( nextRow >= totalRows )
{
nextRow = std::numeric_limits<unsigned int>::max();
nextColumn = std::numeric_limits<unsigned int>::max();
}
return boost::tuples::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
}
unsigned int Nektar::DiagonalMatrixFuncs::CalculateIndex ( unsigned int  row,
unsigned int  col 
)
static

Definition at line 362 of file MatrixFuncs.cpp.

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

{
if( row == col )
{
return row;
}
else
{
return std::numeric_limits<unsigned int>::max();
}
}
unsigned int Nektar::DiagonalMatrixFuncs::GetRequiredStorageSize ( unsigned int  rows,
unsigned int  columns 
)
static

Definition at line 356 of file MatrixFuncs.cpp.

References ASSERTL0.

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

{
ASSERTL0(rows==columns, "Diagonal matrices must be square.");
return rows;
}
template<typename DataType >
static void Nektar::DiagonalMatrixFuncs::Invert ( unsigned int  rows,
unsigned int  columns,
Array< OneD, DataType > &  data 
)
inlinestatic

Definition at line 215 of file MatrixFuncs.h.

References ASSERTL0.

{
ASSERTL0(rows==columns, "Only square matrices can be inverted.");
for(unsigned int i = 0; i < rows; ++i)
{
data[i] = 1.0/data[i];
}
}