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

#include <MatrixFuncs.h>

Static Public Member Functions

static unsigned int GetRequiredStorageSize (unsigned int totalRows, unsigned int totalColumns, unsigned int subDiags, unsigned int superDiags)
 Calculates and returns the storage size required. More...
 
static unsigned int CalculateNumberOfDiags (unsigned int totalRows, unsigned int diags)
 
static unsigned int CalculateNumberOfRows (unsigned int totalRows, unsigned int subDiags, unsigned int superDiags)
 
static unsigned int CalculateIndex (unsigned int totalRows, unsigned int totalColumns, unsigned int row, unsigned int column, unsigned int sub, unsigned int super)
 
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)
 

Detailed Description

Definition at line 50 of file MatrixFuncs.h.

Member Function Documentation

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

Definition at line 91 of file MatrixFuncs.cpp.

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

93  {
94  unsigned int nextRow = curRow;
95  unsigned int nextColumn = curColumn;
96 
97  //if( transpose == 'N' )
98  //{
99  // if( (column <= row && (row - column) <= data.GetNumberOfSubDiagonals(totalRows)) ||
100  // (column > row && (column - row) <= data.GetNumberOfSuperDiagonals(totalRows)) )
101  // {
102  // unsigned int arrayColumns = totalColumns;
103 
104  // unsigned int elementRow = data.GetNumberOfSuperDiagonals(totalRows)+row-column;
105  // unsigned int elementColumn = column;
106 
107  // return elementRow + elementColumn*CalculateNumberOfRows(totalRows, data);
108  // }
109  // else
110  // {
111  // return boost::optional<unsigned int>();
112  // }
113  //}
114  //else
115  //{
116  //}
117  return boost::tuples::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
118  }
unsigned int Nektar::BandedMatrixFuncs::CalculateIndex ( unsigned int  totalRows,
unsigned int  totalColumns,
unsigned int  row,
unsigned int  column,
unsigned int  sub,
unsigned int  super 
)
static

Definition at line 70 of file MatrixFuncs.cpp.

References CalculateNumberOfDiags(), and CalculateNumberOfRows().

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

74  {
75  if( (column <= row && (row - column) <= CalculateNumberOfDiags(totalRows, sub)) ||
76  (column > row && (column - row) <= CalculateNumberOfDiags(totalRows, super)) )
77  {
78  unsigned int elementRow = CalculateNumberOfDiags(totalRows, super)+row-column;
79  unsigned int elementColumn = column;
80 
81  return elementRow + elementColumn*CalculateNumberOfRows(totalRows, sub, super);
82  }
83  else
84  {
85  return std::numeric_limits<unsigned int>::max();
86  }
87  }
static unsigned int CalculateNumberOfDiags(unsigned int totalRows, unsigned int diags)
Definition: MatrixFuncs.cpp:49
static unsigned int CalculateNumberOfRows(unsigned int totalRows, unsigned int subDiags, unsigned int superDiags)
Definition: MatrixFuncs.cpp:65
unsigned int Nektar::BandedMatrixFuncs::CalculateNumberOfDiags ( unsigned int  totalRows,
unsigned int  diags 
)
static

Definition at line 49 of file MatrixFuncs.cpp.

Referenced by CalculateIndex(), and CalculateNumberOfRows().

50  {
51  if( diags != std::numeric_limits<unsigned int>::max() )
52  {
53  return diags;
54  }
55  else if( totalRows > 0 )
56  {
57  return totalRows-1;
58  }
59  else
60  {
61  return 0;
62  }
63  }
unsigned int Nektar::BandedMatrixFuncs::CalculateNumberOfRows ( unsigned int  totalRows,
unsigned int  subDiags,
unsigned int  superDiags 
)
static

Definition at line 65 of file MatrixFuncs.cpp.

References CalculateNumberOfDiags().

Referenced by CalculateIndex(), and GetRequiredStorageSize().

66  {
67  return CalculateNumberOfDiags(totalRows, subDiags) + CalculateNumberOfDiags(totalRows, superDiags) + 1;
68  }
static unsigned int CalculateNumberOfDiags(unsigned int totalRows, unsigned int diags)
Definition: MatrixFuncs.cpp:49
unsigned int Nektar::BandedMatrixFuncs::GetRequiredStorageSize ( unsigned int  totalRows,
unsigned int  totalColumns,
unsigned int  subDiags,
unsigned int  superDiags 
)
static

Calculates and returns the storage size required.

This method assumes that the matrix will be used with LU factorizationa and allocates additional storage as appropriate.

Definition at line 43 of file MatrixFuncs.cpp.

References CalculateNumberOfRows().

Referenced by Nektar::LinearSystem::FactorMatrix(), and Nektar::ConstMatrix< DataType >::GetRequiredStorageSize().

45  {
46  return CalculateNumberOfRows(totalRows, subDiags, superDiags)*totalColumns;
47  }
static unsigned int CalculateNumberOfRows(unsigned int totalRows, unsigned int subDiags, unsigned int superDiags)
Definition: MatrixFuncs.cpp:65