16#ifndef dealii_householder_h
17#define dealii_householder_h
33template <
typename number>
79template <
typename number>
96 template <
typename number2>
104 template <
typename number2>
118 template <
typename number2>
125 template <
typename number2>
134 template <
class VectorType>
136 vmult(VectorType &dst,
const VectorType &src)
const;
142 template <
class VectorType>
144 Tvmult(VectorType &dst,
const VectorType &src)
const;
167template <
typename number>
168template <
typename number2>
172 const size_type m =
M.n_rows(), n =
M.n_cols();
179 Assert(storage.n_cols() <= storage.n_rows(),
182 for (size_type
j = 0;
j < n; ++
j)
187 for (i =
j; i < m; ++i)
188 sigma += storage(i,
j) * storage(i,
j);
191 if (std::fabs(
sigma) < 1.e-15)
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)
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();
248 aux->reinit(src,
true);
254 for (size_type
j = 0;
j < n; ++
j)
258 for (size_type i =
j + 1; i < m; ++i)
259 sum +=
static_cast<number2>(storage(i,
j)) * (*aux)(i);
261 (*aux)(
j) -= sum * diagonal[
j];
262 for (size_type i =
j + 1; i < m; ++i)
263 (*aux)(i) -= sum *
static_cast<number2>(storage(i,
j));
267 for (size_type i = n; i < m; ++i)
268 sum += (*aux)(i) * (*aux)(i);
272 storage.backward(dst, *aux);
279template <
typename number>
280template <
typename number2>
289 const size_type m = storage.m(), n = storage.n();
293 aux->reinit(src,
true);
299 for (size_type
j = 0;
j < n; ++
j)
303 for (size_type i =
j + 1; i < m; ++i)
304 sum += storage(i,
j) * (*aux)(i);
306 (*aux)(
j) -= sum * diagonal[
j];
307 for (size_type i =
j + 1; i < m; ++i)
308 (*aux)(i) -= sum * storage(i,
j);
312 for (size_type i = n; i < m; ++i)
313 sum += (*aux)(i) * (*aux)(i);
332template <
typename number>
333template <
class VectorType>
337 least_squares(dst, src);
341template <
typename number>
342template <
class VectorType>
void reinit(value_type *starting_element, const std::size_t n_elements)
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
double least_squares(Vector< number2 > &dst, const Vector< number2 > &src) const
std::vector< number > diagonal
FullMatrix< double > storage
Householder(const FullMatrix< number2 > &A)
void initialize(const FullMatrix< number2 > &A)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertIsFinite(number)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
@ diagonal
Matrix is diagonal.
types::global_dof_index size_type
T sum(const T &t, const MPI_Comm mpi_communicator)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
unsigned int global_dof_index