16#ifndef dealii_diagonal_matrix_h
17#define dealii_diagonal_matrix_h
29template <
typename number>
35 template <
typename,
typename>
61template <
typename VectorType = Vector<
double>>
165 template <
typename number2>
170 const number2 * values,
171 const bool elide_zero_values =
true,
172 const bool col_indices_are_sorted =
false);
187 vmult(VectorType &dst,
const VectorType &src)
const;
195 Tvmult(VectorType &dst,
const VectorType &src)
const;
203 vmult_add(VectorType &dst,
const VectorType &src)
const;
232 const unsigned int end_range,
233 const value_type * src_pointer_to_current_range,
234 value_type * dst_pointer_to_current_range)
const;
263template <
typename VectorType>
270template <
typename VectorType>
279template <
typename VectorType>
283 return diagonal.memory_consumption();
288template <
typename VectorType>
297template <
typename VectorType>
301 dst.reinit(diagonal);
306template <
typename VectorType>
315template <
typename VectorType>
324template <
typename VectorType>
333template <
typename VectorType>
334typename VectorType::size_type
342template <
typename VectorType>
343typename VectorType::size_type
351template <
typename VectorType>
352typename VectorType::value_type
354 const size_type j)
const
363template <
typename VectorType>
364typename VectorType::value_type &
374template <
typename VectorType>
375template <
typename number2>
378 const size_type n_cols,
379 const size_type *col_indices,
380 const number2 * values,
384 for (size_type i = 0; i < n_cols; ++i)
385 if (col_indices[i] == row)
391template <
typename VectorType>
395 const value_type value)
407 template <
typename VectorType>
409 assign_and_scale(VectorType & dst,
410 const VectorType &src,
411 const VectorType &diagonal)
417 template <
typename Number>
425 const auto dst_ptr = dst.
begin();
426 const auto src_ptr = src.
begin();
427 const auto diagonal_ptr =
diagonal.begin();
431 dst_ptr[i] = src_ptr[i] * diagonal_ptr[i];
438template <
typename VectorType>
442 internal::DiagonalMatrix::assign_and_scale(dst, src, diagonal);
447template <
typename VectorType>
456template <
typename VectorType>
459 const VectorType &src)
const
468template <
typename VectorType>
471 const VectorType &src)
const
478template <
typename VectorType>
479typename VectorType::value_type
481 const value_type src)
const
484 return diagonal.local_element(index) * src;
489template <
typename VectorType>
492 const unsigned int begin_range,
493 const unsigned int end_range,
494 const value_type * src_pointer_to_current_range,
495 value_type * dst_pointer_to_current_range)
const
498 diagonal.locally_owned_elements().n_elements() + 1);
500 diagonal.locally_owned_elements().n_elements() + 1);
502 const value_type * diagonal_entry =
diagonal.begin() + begin_range;
503 const unsigned int length = end_range - begin_range;
506 for (
unsigned int i = 0; i < length; ++i)
507 dst_pointer_to_current_range[i] =
508 diagonal_entry[i] * src_pointer_to_current_range[i];
void initialize_dof_vector(VectorType &dst) const
void Tvmult_add(VectorType &dst, const VectorType &src) const
value_type apply(const unsigned int index, const value_type src) const
void apply_to_subrange(const unsigned int begin_range, const unsigned int end_range, const value_type *src_pointer_to_current_range, value_type *dst_pointer_to_current_range) const
value_type & operator()(const size_type i, const size_type j)
VectorType & get_vector()
std::size_t memory_consumption() const
void add(const size_type i, const size_type j, const value_type value)
DiagonalMatrix(const VectorType &vec)
value_type operator()(const size_type i, const size_type j) const
typename VectorType::size_type size_type
void compress(VectorOperation::values operation)
const VectorType & get_vector() const
void vmult(VectorType &dst, const VectorType &src) const
void reinit(const VectorType &vec)
void add(const size_type row, const size_type n_cols, const size_type *col_indices, const number2 *values, const bool elide_zero_values=true, const bool col_indices_are_sorted=false)
typename VectorType::value_type value_type
void vmult_add(VectorType &dst, const VectorType &src) const
void Tvmult(VectorType &dst, const VectorType &src) const
size_type locally_owned_size() const
#define DEAL_II_OPENMP_SIMD_PRAGMA
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
@ diagonal
Matrix is diagonal.