15 template <
typename _Type>
38 BandedMatrix(
const std::size_t& rows,
const std::size_t& offdiag,
const _Type& fill);
50 const _Type&
operator()(
const std::size_t& row,
const std::size_t& col)
const;
52 _Type&
operator()(
const std::size_t& row,
const std::size_t& col);
54 const _Type&
get(
const std::size_t& row,
const std::size_t& col)
const;
56 _Type&
set(
const std::size_t& row,
const std::size_t& col);
60 std::size_t
nrows()
const;
64 std::size_t
ncols()
const;
68 std::size_t
nelts()
const;
72 void scale(
const _Type& mult);
121 void row_swap(
const std::size_t& row1,
const std::size_t& row2);
146 template <
typename _Type >
150 if((row >= m_N) || (row < 0) || (col >= m_N) || (col < 0)) {
152 problem =
" The const operator() of BandedMatrix has been called \n";
153 problem +=
" with a (row, col) index that is outside \n";
154 problem +=
" the square m_Nxm_N matrix.\n";
158 if(!((col + m_L >= row) && (col <= 2*m_L + row))) {
160 problem =
" The const operator() of BandedMatrix has been called \n";
161 problem +=
" with a (row, col) index that is outside \n";
162 problem +=
" the band structure. Bandwidth and offset from\n";
163 problem +=
" the diagonal information follows.\n";
171 return m_storage[ m_L * (3 * col + 2) + row ];
174 template <
typename _Type>
178 if((row >= m_N) || (row < 0) || (col >= m_N) || (col < 0)) {
180 problem =
" The operator() of BandedMatrix has been called \n";
181 problem +=
" with a (row, col) index that is outside \n";
182 problem +=
" the square m_Nxm_N matrix.\n";
186 if(!((col + m_L >= row) && (col <= 2*m_L + row))) {
188 problem =
" The operator() of BandedMatrix has been called \n";
189 problem +=
" with a (row, col) index that is outside \n";
190 problem +=
" the band structure.\n";
191 std::cout <<
" m_L = " << m_L <<
"\n";
192 std::cout <<
" row = " << row <<
"\n";
193 std::cout <<
" col = " << col <<
"\n";
201 return m_storage[ m_L * (3 * col + 2) + row ];
204 template <
typename _Type>
206 (
const std::size_t& row,
const std::size_t& col)
const {
207 return operator()(row, col);
210 template <
typename _Type>
212 (
const std::size_t& row,
const std::size_t& col) {
213 return operator()(row, col);
216 template <
typename _Type>
221 template <
typename _Type>
226 template <
typename _Type>
Specification for a templated DenseVector class – a dense, dynamic, vector object.
The collection of CppNoddy exceptions.
A base matrix class to ensure a consistent interface between the inheriting dense/banded matrix class...
A matrix class that constructs a BANDED matrix.
const _Type & operator()(const std::size_t &row, const std::size_t &col) const
Access operator.
void transpose()
Transpose the matrix.
void scale(const _Type &mult)
Scale all entries in the matrix by a scalar.
std::size_t noffdiag() const
Get the number of off-diagonal elements where the total INPUT band width is 2*noffdiag+1 since the ba...
DenseVector< _Type > multiply(const DenseVector< _Type > &X) const
Right multiply the matrix by a DENSE vector.
std::size_t nrows() const
Get the number of rows.
std::size_t m_L
Max number of (INPUT) bands above OR below the main diagonal.
const _Type & get(const std::size_t &row, const std::size_t &col) const
Access operator.
double * base()
Allow direct access to the vector m_storage.
BandedMatrix & operator=(const BandedMatrix &source)
Assignment operator.
std::size_t m_N
The number of rows/cols in the matrix.
DenseVector< _Type > m_storage
A contiguous vector.
BandedMatrix()
Empty constructor .. should we stop this?
void assign(_Type elt)
Assign a value the matrix so that it has the same geometry, but zero entries in all locations includi...
std::size_t ncols() const
Get the number of columns.
void row_swap(const std::size_t &row1, const std::size_t &row2)
Exchange rows in the matrix.
std::size_t nelts() const
Get the number of elements.
DenseVector< _Type >::elt_iter elt_iter
elt_iter get_elt_iter(std::size_t row, std::size_t col)
void dump() const
Output the matrix contents to std::cout.
_Type & set(const std::size_t &row, const std::size_t &col)
Access operator.
An DenseVector class – a dense vector object.
std::vector< _Type >::iterator elt_iter
An exception class to be thrown when a container of incorrect geometry used in any class/method.
An exception to indicate that a CppNoddy container has been accessed with index/indices outside the m...
A base matrix class for sequential matrices.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...