13#ifndef dealii_householder_h
14#define dealii_householder_h
29template <
typename number>
75template <
typename number>
92 template <
typename number2>
100 template <
typename number2>
114 template <
typename number2>
121 template <
typename number2>
130 template <
typename VectorType>
132 vmult(VectorType &dst,
const VectorType &src)
const;
138 template <
typename VectorType>
140 Tvmult(VectorType &dst,
const VectorType &src)
const;
163template <
typename number>
164template <
typename number2>
168 const size_type m = M.n_rows(), n = M.n_cols();
169 storage.reinit(m, n);
175 Assert(storage.n_cols() <= storage.n_rows(),
178 for (size_type j = 0; j < n; ++j)
183 for (i = j; i < m; ++i)
184 sigma += storage(i, j) * storage(i, j);
196 number2 beta =
std::sqrt(1. / (sigma - s * storage(j, j)));
201 diagonal[j] = beta * (storage(j, j) - s);
204 for (i = j + 1; i < m; ++i)
205 storage(i, j) *= beta;
210 for (size_type k = j + 1; k < n; ++k)
212 number2 sum = diagonal[j] * storage(j, k);
213 for (i = j + 1; i < m; ++i)
214 sum += storage(i, j) * storage(i, k);
216 storage(j, k) -= sum * this->diagonal[j];
217 for (i = j + 1; i < m; ++i)
218 storage(i, k) -= sum * storage(i, j);
225template <
typename number>
226template <
typename number2>
234template <
typename number>
235template <
typename number2>
244 const size_type m = storage.m(), n = storage.n();
251 for (size_type j = 0; j < n; ++j)
255 for (size_type i = j + 1; i < m; ++i)
256 sum +=
static_cast<number2
>(storage(i, j)) * aux(i);
259 for (size_type i = j + 1; i < m; ++i)
260 aux(i) -=
sum *
static_cast<number2
>(storage(i, j));
264 for (size_type i = n; i < m; ++i)
265 sum += aux(i) * aux(i);
269 storage.backward(dst, aux);
276template <
typename number>
277template <
typename number2>
286 const size_type m = storage.m(), n = storage.n();
295 for (size_type j = 0; j < n; ++j)
299 for (size_type i = j + 1; i < m; ++i)
300 sum += storage(i, j) * aux(i);
303 for (size_type i = j + 1; i < m; ++i)
304 aux(i) -=
sum * storage(i, j);
308 for (size_type i = n; i < m; ++i)
309 sum += *aux(i) * aux(i);
317 storage.backward(v_dst, v_aux);
325template <
typename number>
326template <
typename VectorType>
330 least_squares(dst, src);
334template <
typename number>
335template <
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
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()
#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