Belos Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Types | List of all members
Belos::details::LocalDenseMatrixOps< Scalar > Class Template Reference

Low-level operations on non-distributed dense matrices. More...

#include <BelosProjectedLeastSquaresSolver.hpp>

Public Types

typedef Scalar scalar_type
 The template parameter of this class.
 
typedef Teuchos::ScalarTraits< Scalar >::magnitudeType magnitude_type
 The type of the magnitude of a scalar_type value.
 
typedef Teuchos::SerialDenseMatrix< int, Scalar > mat_type
 The type of a dense matrix (or vector) of scalar_type.
 

Public Member Functions

void conjugateTranspose (mat_type &A_star, const mat_type &A) const
 A_star := (conjugate) transpose of A.
 
void conjugateTransposeOfUpperTriangular (mat_type &L, const mat_type &R) const
 L := (conjugate) transpose of R (upper triangular).
 
void zeroOutStrictLowerTriangle (mat_type &A) const
 Zero out everything below the diagonal of A.
 
void partition (Teuchos::RCP< mat_type > &A_11, Teuchos::RCP< mat_type > &A_21, Teuchos::RCP< mat_type > &A_12, Teuchos::RCP< mat_type > &A_22, mat_type &A, const int numRows1, const int numRows2, const int numCols1, const int numCols2)
 A -> [A_11, A_21, A_12, A_22].
 
void matScale (mat_type &A, const scalar_type &alpha) const
 A := alpha * A.
 
void axpy (mat_type &Y, const scalar_type &alpha, const mat_type &X) const
 Y := Y + alpha * X.
 
void matAdd (mat_type &A, const mat_type &B) const
 A := A + B.
 
void matSub (mat_type &A, const mat_type &B) const
 A := A - B.
 
void rightUpperTriSolve (mat_type &B, const mat_type &R) const
 In Matlab notation: B = B / R, where R is upper triangular.
 
void matMatMult (const scalar_type &beta, mat_type &C, const scalar_type &alpha, const mat_type &A, const mat_type &B) const
 C := beta*C + alpha*A*B.
 
int infNaNCount (const mat_type &A, const bool upperTriangular=false) const
 Return the number of Inf or NaN entries in the matrix A.
 
std::pair< bool, std::pair< magnitude_type, magnitude_type > > isUpperTriangular (const mat_type &A) const
 Is the matrix A upper triangular / trapezoidal?
 
std::pair< bool, std::pair< magnitude_type, magnitude_type > > isUpperHessenberg (const mat_type &A) const
 Is the matrix A upper Hessenberg?
 
void ensureUpperTriangular (const mat_type &A, const char *const matrixName) const
 Throw an exception if A is not upper triangular / trapezoidal.
 
void ensureUpperHessenberg (const mat_type &A, const char *const matrixName) const
 Throw an exception if A is not (strictly) upper Hessenberg.
 
void ensureUpperHessenberg (const mat_type &A, const char *const matrixName, const magnitude_type relativeTolerance) const
 Throw an exception if A is not "approximately" upper Hessenberg.
 
void ensureMinimumDimensions (const mat_type &A, const char *const matrixName, const int minNumRows, const int minNumCols) const
 Ensure that the matrix A is at least minNumRows by minNumCols.
 
void ensureEqualDimensions (const mat_type &A, const char *const matrixName, const int numRows, const int numCols) const
 Ensure that the matrix A is exactly numRows by numCols.
 

Private Types

typedef Teuchos::ScalarTraits< scalar_typeSTS
 
typedef Teuchos::ScalarTraits< magnitude_typeSTM
 
typedef Teuchos::BLAS< int, scalar_typeblas_type
 
typedef Teuchos::LAPACK< int, scalar_typelapack_type
 

Detailed Description

template<class Scalar>
class Belos::details::LocalDenseMatrixOps< Scalar >

Low-level operations on non-distributed dense matrices.

Author
Mark Hoemmen

This class provides a convenient wrapper around some BLAS operations, operating on non-distributed (hence "local") dense matrices.

Definition at line 349 of file BelosProjectedLeastSquaresSolver.hpp.

Member Typedef Documentation

◆ scalar_type

template<class Scalar >
Belos::details::LocalDenseMatrixOps< Scalar >::scalar_type

The template parameter of this class.

Definition at line 353 of file BelosProjectedLeastSquaresSolver.hpp.

◆ magnitude_type

template<class Scalar >
Belos::details::LocalDenseMatrixOps< Scalar >::magnitude_type

The type of the magnitude of a scalar_type value.

Definition at line 356 of file BelosProjectedLeastSquaresSolver.hpp.

◆ mat_type

template<class Scalar >
Belos::details::LocalDenseMatrixOps< Scalar >::mat_type

The type of a dense matrix (or vector) of scalar_type.

Definition at line 359 of file BelosProjectedLeastSquaresSolver.hpp.

◆ STS

template<class Scalar >
typedef Teuchos::ScalarTraits<scalar_type> Belos::details::LocalDenseMatrixOps< Scalar >::STS
private

Definition at line 362 of file BelosProjectedLeastSquaresSolver.hpp.

◆ STM

template<class Scalar >
typedef Teuchos::ScalarTraits<magnitude_type> Belos::details::LocalDenseMatrixOps< Scalar >::STM
private

Definition at line 363 of file BelosProjectedLeastSquaresSolver.hpp.

◆ blas_type

template<class Scalar >
typedef Teuchos::BLAS<int, scalar_type> Belos::details::LocalDenseMatrixOps< Scalar >::blas_type
private

Definition at line 364 of file BelosProjectedLeastSquaresSolver.hpp.

◆ lapack_type

template<class Scalar >
typedef Teuchos::LAPACK<int, scalar_type> Belos::details::LocalDenseMatrixOps< Scalar >::lapack_type
private

Definition at line 365 of file BelosProjectedLeastSquaresSolver.hpp.

Member Function Documentation

◆ conjugateTranspose()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::conjugateTranspose ( mat_type & A_star,
const mat_type & A ) const
inline

A_star := (conjugate) transpose of A.

Definition at line 370 of file BelosProjectedLeastSquaresSolver.hpp.

◆ conjugateTransposeOfUpperTriangular()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::conjugateTransposeOfUpperTriangular ( mat_type & L,
const mat_type & R ) const
inline

L := (conjugate) transpose of R (upper triangular).

Definition at line 381 of file BelosProjectedLeastSquaresSolver.hpp.

◆ zeroOutStrictLowerTriangle()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::zeroOutStrictLowerTriangle ( mat_type & A) const
inline

Zero out everything below the diagonal of A.

Definition at line 394 of file BelosProjectedLeastSquaresSolver.hpp.

◆ partition()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::partition ( Teuchos::RCP< mat_type > & A_11,
Teuchos::RCP< mat_type > & A_21,
Teuchos::RCP< mat_type > & A_12,
Teuchos::RCP< mat_type > & A_22,
mat_type & A,
const int numRows1,
const int numRows2,
const int numCols1,
const int numCols2 )
inline

A -> [A_11, A_21, A_12, A_22].

The first four arguments are the output arguments. They are views of their respective submatrices of A.

Note
SerialDenseMatrix's operator= and copy constructor both always copy the matrix deeply, so I can't make the output arguments "mat_type&".

Definition at line 414 of file BelosProjectedLeastSquaresSolver.hpp.

◆ matScale()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::matScale ( mat_type & A,
const scalar_type & alpha ) const
inline

A := alpha * A.

Definition at line 435 of file BelosProjectedLeastSquaresSolver.hpp.

◆ axpy()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::axpy ( mat_type & Y,
const scalar_type & alpha,
const mat_type & X ) const
inline

Y := Y + alpha * X.

"AXPY" stands for "alpha times X plus y," and is the traditional abbreviation for this operation.

Definition at line 459 of file BelosProjectedLeastSquaresSolver.hpp.

◆ matAdd()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::matAdd ( mat_type & A,
const mat_type & B ) const
inline

A := A + B.

Definition at line 479 of file BelosProjectedLeastSquaresSolver.hpp.

◆ matSub()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::matSub ( mat_type & A,
const mat_type & B ) const
inline

A := A - B.

Definition at line 506 of file BelosProjectedLeastSquaresSolver.hpp.

◆ rightUpperTriSolve()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::rightUpperTriSolve ( mat_type & B,
const mat_type & R ) const
inline

In Matlab notation: B = B / R, where R is upper triangular.

This method only looks at the upper left R.numCols() by R.numCols() part of R.

Definition at line 536 of file BelosProjectedLeastSquaresSolver.hpp.

◆ matMatMult()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::matMatMult ( const scalar_type & beta,
mat_type & C,
const scalar_type & alpha,
const mat_type & A,
const mat_type & B ) const
inline

C := beta*C + alpha*A*B.

This method is a thin wrapper around the BLAS' _GEMM routine. The matrix C is NOT allowed to alias the matrices A or B. This method makes no effort to check for aliasing.

Definition at line 558 of file BelosProjectedLeastSquaresSolver.hpp.

◆ infNaNCount()

template<class Scalar >
int Belos::details::LocalDenseMatrixOps< Scalar >::infNaNCount ( const mat_type & A,
const bool upperTriangular = false ) const
inline

Return the number of Inf or NaN entries in the matrix A.

Parameters
A[in] The matrix to check.
upperTriangular[in] If true, only check the upper triangle / trapezoid of A. Otherwise, check all entries of A.

Definition at line 598 of file BelosProjectedLeastSquaresSolver.hpp.

◆ isUpperTriangular()

template<class Scalar >
std::pair< bool, std::pair< magnitude_type, magnitude_type > > Belos::details::LocalDenseMatrixOps< Scalar >::isUpperTriangular ( const mat_type & A) const
inline

Is the matrix A upper triangular / trapezoidal?

Returns
(is upper triangular?, (squared Frobenius norm of strict lower triangle, squared Frobenius norm of the whole matrix))

Definition at line 625 of file BelosProjectedLeastSquaresSolver.hpp.

◆ isUpperHessenberg()

template<class Scalar >
std::pair< bool, std::pair< magnitude_type, magnitude_type > > Belos::details::LocalDenseMatrixOps< Scalar >::isUpperHessenberg ( const mat_type & A) const
inline

Is the matrix A upper Hessenberg?

Returns
(is upper Hessenberg?, (squared Frobenius norm of the part of A that should be zero if A is upper Hessenberg, squared Frobenius norm of the whole matrix))

Definition at line 658 of file BelosProjectedLeastSquaresSolver.hpp.

◆ ensureUpperTriangular()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::ensureUpperTriangular ( const mat_type & A,
const char *const matrixName ) const
inline

Throw an exception if A is not upper triangular / trapezoidal.

Parameters
A[in] The matrix to test.
matrixName[in] Name of the matrix. Used only to make the exception message more informative.

Definition at line 691 of file BelosProjectedLeastSquaresSolver.hpp.

◆ ensureUpperHessenberg() [1/2]

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::ensureUpperHessenberg ( const mat_type & A,
const char *const matrixName ) const
inline

Throw an exception if A is not (strictly) upper Hessenberg.

Parameters
A[in] The matrix to test.
matrixName[in] Name of the matrix. Used only to make the exception message more informative.

Definition at line 712 of file BelosProjectedLeastSquaresSolver.hpp.

◆ ensureUpperHessenberg() [2/2]

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::ensureUpperHessenberg ( const mat_type & A,
const char *const matrixName,
const magnitude_type relativeTolerance ) const
inline

Throw an exception if A is not "approximately" upper Hessenberg.

"Approximately" in this case means that the Frobenius norm of the part of A that should be zero, divided by the Frobenius norm of all of A, is less than or equal to the given relative tolerance.

Parameters
A[in] The matrix to test.
matrixName[in] Name of the matrix. Used only to make the exception message more informative.
relativeTolerance[in] Amount by which we allow the norm of the part of A that should be zero to deviate from zero, relative to the norm of A.

Definition at line 742 of file BelosProjectedLeastSquaresSolver.hpp.

◆ ensureMinimumDimensions()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::ensureMinimumDimensions ( const mat_type & A,
const char *const matrixName,
const int minNumRows,
const int minNumCols ) const
inline

Ensure that the matrix A is at least minNumRows by minNumCols.

If A has fewer rows than minNumRows, or fewer columns than minNumCols, this method throws an informative exception.

Parameters
A[in] The matrix whose dimensions to check.
matrixName[in] Name of the matrix; used to make the exception message more informative.
minNumRows[in] Minimum number of rows allowed in A.
minNumCols[in] Minimum number of columns allowed in A.

Definition at line 775 of file BelosProjectedLeastSquaresSolver.hpp.

◆ ensureEqualDimensions()

template<class Scalar >
void Belos::details::LocalDenseMatrixOps< Scalar >::ensureEqualDimensions ( const mat_type & A,
const char *const matrixName,
const int numRows,
const int numCols ) const
inline

Ensure that the matrix A is exactly numRows by numCols.

If A has a different number of rows than numRows, or a different number of columns than numCols, this method throws an informative exception.

Parameters
A[in] The matrix whose dimensions to check.
matrixName[in] Name of the matrix; used to make the exception message more informative.
numRows[in] Number of rows that A must have.
numCols[in] Number of columns that A must have.

Definition at line 800 of file BelosProjectedLeastSquaresSolver.hpp.


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