2#include <NDEVR/Buffer.h>
3#include <NDEVR/Vertex.h>
11 template<
class t_type>
22 return m_upper.
size() - 1;
26 return m_lower.
size() - 1;
38 m_upper[i].setSize(
dim);
40 m_lower[i].setSize(
dim);
44 if (m_upper.
size() > 0)
45 return m_upper[0].
size();
54 return m_upper[j - i][i];
56 return m_lower[i - j][i];
61 return m_upper[j - i][i];
63 return m_lower[i - j][i];
82 lib_assert((*
this)(i, i) != 0.0,
"Bad decompision");
86 for (
uint04 j = j_min; j <= j_max; j++)
95 for (
uint04 i = k + 1; i <= i_max; i++)
97 lib_assert((*
this)(k, k) != 0.0,
"get minimum");
98 t_type x = -(*this)(i, k) / (*
this)(k, k);
101 for (
uint04 j = k + 1; j <= j_max; j++)
104 (*this)(i, j) = (*
this)(i, j) + x * (*
this)(k, j);
110 template<
class t_l_type>
120 for (
uint04 j = j_start; j < i; j++)
121 sum += (*
this)(i, j) * x[j];
127 template<
class t_r_type>
137 for (
uint04 j = i + 1; j <= j_stop; j++)
138 sum += (*
this)(i, j) * x[j];
139 x[i] = (b[i] - sum) / (*
this)(i, i);
143 template<
class t_l_type>
147 if (!is_lu_decomposed)
#define lib_assert(expression, message)
Asserts some logic in the code. Disabled in non debug mode by default. Can be re-enabled in release u...
Definition LibAssert.h:70
Band Matrix solver.
Definition BandMatrix.hpp:13
~BandMatrix()
Definition BandMatrix.hpp:19
t_type savedDiag(uint04 i) const
Definition BandMatrix.hpp:66
uint04 dim() const
Definition BandMatrix.hpp:42
uint04 upperCount() const
Definition BandMatrix.hpp:20
Buffer< t_l_type > luSolve(const Buffer< t_l_type > &b, bool is_lu_decomposed=false)
Definition BandMatrix.hpp:144
void luDecompose()
Definition BandMatrix.hpp:78
Buffer< t_r_type > rSolve(const Buffer< t_r_type > &b) const
Definition BandMatrix.hpp:128
t_type & operator()(uint04 i, uint04 j)
Definition BandMatrix.hpp:51
BandMatrix(uint04 dim, uint04 n_u, uint04 n_l)
Definition BandMatrix.hpp:28
BandMatrix()
Definition BandMatrix.hpp:18
uint04 lowerCount() const
Definition BandMatrix.hpp:24
Buffer< t_l_type > lSolve(const Buffer< t_l_type > &b) const
Definition BandMatrix.hpp:111
void resize(uint04 dim, uint04 n_u, uint04 n_l)
Definition BandMatrix.hpp:32
t_type & savedDiag(uint04 i)
Definition BandMatrix.hpp:71
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
constexpr t_index_type size() const
Definition Buffer.hpp:1461
void setSize(t_index_type new_size)
Definition Buffer.hpp:1413
constexpr t_type getMax(const t_type &left, const t_type &right)
Finds the max of the given arguments using the > operator.
Definition BaseFunctions.hpp:116
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
constexpr bool isNaN(const t_type &value)
Query if 'value' is valid or invalid.
Definition BaseFunctions.hpp:200
constexpr t_type getMin(const t_type &left, const t_type &right)
Finds the minimum of the given arguments based on the < operator.
Definition BaseFunctions.hpp:67