15#ifndef dealii_householder_h
16#define dealii_householder_h
31template <
typename number>
77template <
typename number>
94 template <
typename number2>
102 template <
typename number2>
116 template <
typename number2>
123 template <
typename number2>
132 template <
typename VectorType>
134 vmult(VectorType &dst,
const VectorType &src)
const;
140 template <
typename VectorType>
142 Tvmult(VectorType &dst,
const VectorType &src)
const;
165template <
typename number>
166template <
typename number2>
170 const size_type m = M.n_rows(), n = M.n_cols();
171 storage.reinit(m, n);
177 Assert(storage.n_cols() <= storage.n_rows(),
180 for (size_type j = 0; j < n; ++j)
185 for (i = j; i < m; ++i)
186 sigma += storage(i, j) * storage(i, j);
198 number2 beta =
std::sqrt(1. / (sigma - s * storage(j, j)));
203 diagonal[j] = beta * (storage(j, j) - s);
206 for (i = j + 1; i < m; ++i)
207 storage(i, j) *= beta;
212 for (size_type k = j + 1; k < n; ++k)
214 number2 sum = diagonal[j] * storage(j, k);
215 for (i = j + 1; i < m; ++i)
216 sum += storage(i, j) * storage(i, k);
218 storage(j, k) -= sum * this->diagonal[j];
219 for (i = j + 1; i < m; ++i)
220 storage(i, k) -= sum * storage(i, j);
227template <
typename number>
228template <
typename number2>
236template <
typename number>
237template <
typename number2>
246 const size_type m = storage.m(), n = storage.n();
253 for (size_type j = 0; j < n; ++j)
257 for (size_type i = j + 1; i < m; ++i)
258 sum +=
static_cast<number2
>(storage(i, j)) * aux(i);
261 for (size_type i = j + 1; i < m; ++i)
262 aux(i) -=
sum *
static_cast<number2
>(storage(i, j));
266 for (size_type i = n; i < m; ++i)
267 sum += aux(i) * aux(i);
271 storage.backward(dst, aux);
278template <
typename number>
279template <
typename number2>
288 const size_type m = storage.m(), n = storage.n();
297 for (size_type j = 0; j < n; ++j)
301 for (size_type i = j + 1; i < m; ++i)
302 sum += storage(i, j) * aux(i);
305 for (size_type i = j + 1; i < m; ++i)
306 aux(i) -=
sum * storage(i, j);
310 for (size_type i = n; i < m; ++i)
311 sum += *aux(i) * aux(i);
319 storage.backward(v_dst, v_aux);
327template <
typename number>
328template <
typename VectorType>
332 least_squares(dst, src);
336template <
typename number>
337template <
typename VectorType>
virtual size_type size() const override
void reinit(const unsigned int n_blocks, const size_type block_size=0, const bool omit_zeroing_entries=false)
void fill(const FullMatrix< number2 > &src, const size_type dst_offset_i=0, const size_type dst_offset_j=0, const size_type src_offset_i=0, const size_type src_offset_j=0)
void vmult(VectorType &dst, const VectorType &src) const
double least_squares(BlockVector< number2 > &dst, const BlockVector< number2 > &src) const
void Tvmult(VectorType &dst, const VectorType &src) const
std::vector< number > diagonal
FullMatrix< number > storage
types::global_dof_index size_type
Householder(const FullMatrix< number2 > &A)
void initialize(const FullMatrix< number2 > &A)
number2 least_squares(Vector< number2 > &dst, const Vector< number2 > &src) const
virtual size_type size() const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NOT_IMPLEMENTED()
static ::ExceptionBase & ExcEmptyMatrix()
#define Assert(cond, exc)
#define AssertIsFinite(number)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
types::global_dof_index size_type
@ diagonal
Matrix is diagonal.
T sum(const T &t, const MPI_Comm mpi_communicator)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
unsigned int global_dof_index
static constexpr bool is_complex