17 #include <deal.II/lac/lapack_templates.h> 18 #include <deal.II/lac/tridiagonal_matrix.h> 19 #include <deal.II/lac/vector.h> 23 DEAL_II_NAMESPACE_OPEN
27 template <
typename number>
38 template <
typename number>
51 template <
typename number>
57 typename std::vector<number>::const_iterator i;
58 typename std::vector<number>::const_iterator e;
61 for (i =
diagonal.begin(); i != e; ++i)
62 if (std::abs(*i) != 0.)
66 for (i = left.begin(); i != e; ++i)
67 if (std::abs(*i) != 0.)
71 for (i = right.begin(); i != e; ++i)
72 if (std::abs(*i) != 0.)
79 template <
typename number>
83 const bool adding)
const 98 typename std::vector<number>::const_iterator d =
diagonal.begin();
99 typename std::vector<number>::const_iterator r = right.begin();
103 typename std::vector<number>::const_iterator l = left.begin();
112 w(0) += (*d) * v(0) + (*r) * v(1);
116 for (
size_type i = 1; i < e; ++i, ++d, ++r, ++l)
117 w(i) += (*l) * v(i - 1) + (*d) * v(i) + (*r) * v(i + 1);
119 w(e) += (*l) * v(e - 1) + (*d) * v(e);
123 w(0) = (*d) * v(0) + (*r) * v(1);
126 for (
size_type i = 1; i < e; ++i, ++d, ++r, ++l)
127 w(i) = (*l) * v(i - 1) + (*d) * v(i) + (*r) * v(i + 1);
128 w(e) = (*l) * v(e - 1) + (*d) * v(e);
133 template <
typename number>
143 template <
typename number>
147 const bool adding)
const 158 typename std::vector<number>::const_iterator d =
diagonal.begin();
159 typename std::vector<number>::const_iterator r = right.begin();
160 typename std::vector<number>::const_iterator l = left.begin();
168 w(0) += (*d) * v(0) + (*l) * v(1);
171 for (
size_type i = 1; i < e; ++i, ++d, ++r, ++l)
172 w(i) += (*l) * v(i + 1) + (*d) * v(i) + (*r) * v(i - 1);
173 w(e) += (*d) * v(e) + (*r) * v(e - 1);
177 w(0) = (*d) * v(0) + (*l) * v(1);
180 for (
size_type i = 1; i < e; ++i, ++d, ++r, ++l)
181 w(i) = (*l) * v(i + 1) + (*d) * v(i) + (*r) * v(i - 1);
182 w(e) = (*d) * v(e) + (*r) * v(e - 1);
188 template <
typename number>
198 template <
typename number>
206 typename std::vector<number>::const_iterator d =
diagonal.begin();
207 typename std::vector<number>::const_iterator r = right.begin();
208 typename std::vector<number>::const_iterator l = left.begin();
214 number result = w(0) * ((*d) * v(0) + (*r) * v(1));
217 for (
size_type i = 1; i < e; ++i, ++d, ++r, ++l)
218 result += w(i) * ((*l) * v(i - 1) + (*d) * v(i) + (*r) * v(i + 1));
219 result += w(e) * ((*l) * v(e - 1) + (*d) * v(e));
225 template <
typename number>
229 return matrix_scalar_product(v, v);
234 template <
typename number>
238 #ifdef DEAL_II_WITH_LAPACK 248 static_cast<number *
>(
nullptr),
250 static_cast<number *>(
nullptr),
262 template <
typename number>
283 #ifdef DEAL_II_WITH_COMPLEX_VALUES 288 DEAL_II_NAMESPACE_CLOSE
void compute_eigenvalues()
Contents is actually a matrix.
void vmult(Vector< number > &w, const Vector< number > &v, const bool adding=false) const
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void Tvmult_add(Vector< number > &w, const Vector< number > &v) const
static ::ExceptionBase & ExcNeedsLAPACK()
static ::ExceptionBase & ExcState(State arg1)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
number matrix_scalar_product(const Vector< number > &u, const Vector< number > &v) const
TridiagonalMatrix(size_type n=0, bool symmetric=false)
number matrix_norm_square(const Vector< number > &v) const
number eigenvalue(const size_type i) const
void Tvmult(Vector< number > &w, const Vector< number > &v, const bool adding=false) const
static ::ExceptionBase & ExcNotImplemented()
void reinit(size_type n, bool symmetric=false)
Eigenvalue vector is filled.
void vmult_add(Vector< number > &w, const Vector< number > &v) const
types::global_dof_index size_type
static ::ExceptionBase & ExcInternalError()