deal.II version GIT relicensing-2289-g1e5549a87a 2024-12-21 21:30:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | List of all members
BaseQR< VectorType > Class Template Referenceabstract

#include <deal.II/lac/qr.h>

Inheritance diagram for BaseQR< VectorType >:
Inheritance graph
[legend]

Public Member Functions

virtual ~BaseQR ()=default
 
virtual bool append_column (const VectorType &column)=0
 
virtual void remove_column (const unsigned int k=0)=0
 
unsigned int size () const
 
const LAPACKFullMatrix< Number > & get_R () const
 
void solve (Vector< Number > &x, const Vector< Number > &y, const bool transpose=false) const
 
virtual void multiply_with_Q (VectorType &y, const Vector< Number > &x) const =0
 
virtual void multiply_with_QT (Vector< Number > &y, const VectorType &x) const =0
 
virtual void multiply_with_A (VectorType &y, const Vector< Number > &x) const =0
 
virtual void multiply_with_AT (Vector< Number > &y, const VectorType &x) const =0
 
boost::signals2::connection connect_givens_slot (const std::function< void(const unsigned int i, const unsigned int j, const std::array< Number, 3 > &csr)> &slot)
 

Protected Member Functions

 BaseQR ()
 
void multiply_with_cols (VectorType &y, const Vector< Number > &x) const
 
void multiply_with_colsT (Vector< Number > &y, const VectorType &x) const
 

Protected Attributes

std::vector< std::unique_ptr< VectorType > > columns
 
LAPACKFullMatrix< NumberR
 
unsigned int current_size
 
boost::signals2::signal< void(const unsigned int i, const unsigned int j, const std::array< Number, 3 > &)> givens_signal
 

Private Types

using Number = typename VectorType::value_type
 

Detailed Description

template<typename VectorType>
class BaseQR< VectorType >

A base class for thin QR implementations.

This class and classes derived from it are meant to build \(Q\) and \(R\) matrices one row/column at a time, i.e., by growing \(R\) matrix from an empty \(0\times 0\) matrix to \(N\times N\), where \(N\) is the number of added column vectors.

As a consequence, matrices which have the same number of rows as each vector (i.e. \(Q\) matrix) is stored as a collection of vectors of VectorType.

Definition at line 43 of file qr.h.

Member Typedef Documentation

◆ Number

template<typename VectorType >
using BaseQR< VectorType >::Number = typename VectorType::value_type
private

Number type for R matrix.

Definition at line 48 of file qr.h.

Constructor & Destructor Documentation

◆ BaseQR()

template<typename VectorType >
BaseQR< VectorType >::BaseQR ( )
protected

Default private constructor.

◆ ~BaseQR()

template<typename VectorType >
virtual BaseQR< VectorType >::~BaseQR ( )
virtualdefault

Destructor.

Member Function Documentation

◆ append_column()

template<typename VectorType >
virtual bool BaseQR< VectorType >::append_column ( const VectorType &  column)
pure virtual

Append column to the QR factorization. Returns true if the result is successful, i.e. the columns are linearly independent. Otherwise the column is rejected and the return value is false.

Implemented in QR< VectorType >, and ImplicitQR< VectorType >.

◆ remove_column()

template<typename VectorType >
virtual void BaseQR< VectorType >::remove_column ( const unsigned int  k = 0)
pure virtual

Remove a column k and update QR factorization.

Implemented in QR< VectorType >, and ImplicitQR< VectorType >.

◆ size()

template<typename VectorType >
unsigned int BaseQR< VectorType >::size ( ) const

Return size of the subspace.

◆ get_R()

template<typename VectorType >
const LAPACKFullMatrix< Number > & BaseQR< VectorType >::get_R ( ) const

Return the current upper triangular matrix R.

◆ solve()

template<typename VectorType >
void BaseQR< VectorType >::solve ( Vector< Number > &  x,
const Vector< Number > &  y,
const bool  transpose = false 
) const

Solve \(Rx=y\). Vectors x and y should be consistent with the current size of the subspace. If transpose is true, \(R^Tx=y\) is solved instead.

◆ multiply_with_Q()

template<typename VectorType >
virtual void BaseQR< VectorType >::multiply_with_Q ( VectorType &  y,
const Vector< Number > &  x 
) const
pure virtual

Set \(y = Qx\). The size of \(x\) should be consistent with the size of the R matrix.

Implemented in QR< VectorType >, and ImplicitQR< VectorType >.

◆ multiply_with_QT()

template<typename VectorType >
virtual void BaseQR< VectorType >::multiply_with_QT ( Vector< Number > &  y,
const VectorType &  x 
) const
pure virtual

Set \(y = Q^Tx\). The size of \(x\) should be consistent with the size of column vectors.

Implemented in QR< VectorType >, and ImplicitQR< VectorType >.

◆ multiply_with_A()

template<typename VectorType >
virtual void BaseQR< VectorType >::multiply_with_A ( VectorType &  y,
const Vector< Number > &  x 
) const
pure virtual

Set \(y = QRx\). The size of \(x\) should be consistent with the size of the R matrix.

Implemented in QR< VectorType >, and ImplicitQR< VectorType >.

◆ multiply_with_AT()

template<typename VectorType >
virtual void BaseQR< VectorType >::multiply_with_AT ( Vector< Number > &  y,
const VectorType &  x 
) const
pure virtual

Set \(y = R^T Q^Tx\). The size of \(x\) should be consistent with the size of column vectors.

Implemented in QR< VectorType >, and ImplicitQR< VectorType >.

◆ connect_givens_slot()

template<typename VectorType >
boost::signals2::connection BaseQR< VectorType >::connect_givens_slot ( const std::function< void(const unsigned int i, const unsigned int j, const std::array< Number, 3 > &csr)> &  slot)

Connect a slot to retrieve a notification when the Givens rotations are performed.

The function takes two indices, i and j, describing the plane of rotation, and a triplet of numbers csr (cosine, sine and radius, see Utilities::LinearAlgebra::givens_rotation()) which represents the rotation matrix.

◆ multiply_with_cols()

template<typename VectorType >
void BaseQR< VectorType >::multiply_with_cols ( VectorType &  y,
const Vector< Number > &  x 
) const
protected

Compute \(y=Hx\) where \(H\) is the matrix formed by the column vectors stored by this object.

◆ multiply_with_colsT()

template<typename VectorType >
void BaseQR< VectorType >::multiply_with_colsT ( Vector< Number > &  y,
const VectorType &  x 
) const
protected

Multiply with transpose columns stored in the object.

Member Data Documentation

◆ columns

template<typename VectorType >
std::vector<std::unique_ptr<VectorType> > BaseQR< VectorType >::columns
protected

A vector of unique pointers to store columns.

Definition at line 159 of file qr.h.

◆ R

template<typename VectorType >
LAPACKFullMatrix<Number> BaseQR< VectorType >::R
protected

Matrix to store R.

Definition at line 164 of file qr.h.

◆ current_size

template<typename VectorType >
unsigned int BaseQR< VectorType >::current_size
protected

Current size (number of columns in Q).

Definition at line 169 of file qr.h.

◆ givens_signal

template<typename VectorType >
boost::signals2::signal<void(const unsigned int i, const unsigned int j, const std::array<Number, 3> &)> BaseQR< VectorType >::givens_signal
protected

Signal used to retrieve a notification when Givens rotations are performed in the (i,j)-plane.

Definition at line 178 of file qr.h.


The documentation for this class was generated from the following file: