15#ifndef dealii_diagonal_matrix_h
16#define dealii_diagonal_matrix_h
28template <
typename number>
34 template <
typename,
typename>
60template <
typename VectorType = Vector<
double>>
164 template <
typename number2>
169 const number2 *values,
170 const bool elide_zero_values =
true,
171 const bool col_indices_are_sorted =
false);
186 vmult(VectorType &dst,
const VectorType &src)
const;
194 Tvmult(VectorType &dst,
const VectorType &src)
const;
202 vmult_add(VectorType &dst,
const VectorType &src)
const;
231 const unsigned int end_range,
232 const value_type *src_pointer_to_current_range,
233 value_type *dst_pointer_to_current_range)
const;
262template <
typename VectorType>
269template <
typename VectorType>
278template <
typename VectorType>
282 return diagonal.memory_consumption();
287template <
typename VectorType>
296template <
typename VectorType>
300 dst.reinit(diagonal);
305template <
typename VectorType>
314template <
typename VectorType>
323template <
typename VectorType>
332template <
typename VectorType>
333typename VectorType::size_type
341template <
typename VectorType>
342typename VectorType::size_type
350template <
typename VectorType>
351typename VectorType::value_type
353 const size_type j)
const
362template <
typename VectorType>
363typename VectorType::value_type &
373template <
typename VectorType>
374template <
typename number2>
377 const size_type n_cols,
378 const size_type *col_indices,
379 const number2 *values,
383 for (size_type i = 0; i < n_cols; ++i)
384 if (col_indices[i] == row)
390template <
typename VectorType>
394 const value_type value)
406 template <
typename VectorType>
408 assign_and_scale(VectorType &dst,
409 const VectorType &src,
410 const VectorType &diagonal)
416 template <
typename Number>
424 auto *
const dst_ptr = dst.
begin();
425 const auto *
const src_ptr = src.
begin();
426 const auto *
const diagonal_ptr =
diagonal.begin();
430 dst_ptr[i] = src_ptr[i] * diagonal_ptr[i];
437template <
typename VectorType>
441 internal::DiagonalMatrix::assign_and_scale(dst, src, diagonal);
446template <
typename VectorType>
455template <
typename VectorType>
458 const VectorType &src)
const
467template <
typename VectorType>
470 const VectorType &src)
const
477template <
typename VectorType>
478typename VectorType::value_type
480 const value_type src)
const
483 return diagonal.local_element(index) * src;
488template <
typename VectorType>
491 const unsigned int begin_range,
492 const unsigned int end_range,
493 const value_type *src_pointer_to_current_range,
494 value_type *dst_pointer_to_current_range)
const
497 diagonal.locally_owned_elements().n_elements() + 1);
499 diagonal.locally_owned_elements().n_elements() + 1);
501 const value_type *diagonal_entry =
diagonal.begin() + begin_range;
502 const unsigned int length = end_range - begin_range;
505 for (
unsigned int i = 0; i < length; ++i)
506 dst_pointer_to_current_range[i] =
507 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.
Tpetra::Vector< Number, LO, GO, NodeType< MemorySpace > > VectorType