Kokkos Node API and Local Linear Algebra Kernels Version of the Day
Public Member Functions
TSQR::DistTsqr< LocalOrdinal, Scalar > Class Template Reference

Internode part of TSQR. More...

#include <Tsqr_DistTsqr.hpp>

Inheritance diagram for TSQR::DistTsqr< LocalOrdinal, Scalar >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DistTsqr (const Teuchos::RCP< Teuchos::ParameterList > &plist)
 Constructor (that accepts a parameter list).
 DistTsqr ()
 Constructor (that uses default parameters).
void init (const Teuchos::RCP< MessengerBase< scalar_type > > &messenger)
 Finish initialization using the messenger object.
rank_type rank () const
 Rank of this (MPI) process.
rank_type size () const
 Total number of MPI processes in this communicator.
virtual ~DistTsqr ()
 Destructor.
bool QR_produces_R_factor_with_nonnegative_diagonal () const
 Does the R factor have a nonnegative diagonal?
void factorExplicit (matview_type R_mine, matview_type Q_mine, const bool forceNonnegativeDiagonal=false)
 Internode TSQR with explicit Q factor.
void getFactorExplicitTimings (std::vector< TimeStats > &stats) const
 Get cumulative timings for factorExplicit().
void getFactorExplicitTimingLabels (std::vector< std::string > &labels) const
 Get labels for timings for factorExplicit().
FactorOutput factor (matview_type R_mine)
 Compute QR factorization of R factors, one per MPI process.
void apply (const ApplyType &apply_type, const ordinal_type ncols_C, const ordinal_type ncols_Q, scalar_type C_mine[], const ordinal_type ldc_mine, const FactorOutput &factor_output)
 Apply the result of factor() to the distributed matrix C.
void explicit_Q (const ordinal_type ncols_Q, scalar_type Q_mine[], const ordinal_type ldq_mine, const FactorOutput &factor_output)
 Apply the result of factor() to compute the explicit Q factor.

Detailed Description

template<class LocalOrdinal, class Scalar>
class TSQR::DistTsqr< LocalOrdinal, Scalar >

Internode part of TSQR.

Author:
Mark Hoemmen
Template Parameters:
LocalOrdinalIndex type for dense matrices of Scalar.
ScalarValue type for matrices to factor.

This class combines the square R factors computed by the intranode TSQR factorization (NodeTsqr subclass) on individual MPI processes.

It should be possible to instantiate DistTsqr<LocalOrdinal,Scalar> for any LocalOrdinal and Scalar types for which Combine<LocalOrdinal, Scalar> and LAPACK<LocalOrdinal, Scalar> can be instantiated.

Definition at line 73 of file Tsqr_DistTsqr.hpp.


Constructor & Destructor Documentation

template<class LocalOrdinal, class Scalar>
TSQR::DistTsqr< LocalOrdinal, Scalar >::DistTsqr ( const Teuchos::RCP< Teuchos::ParameterList > &  plist) [inline]

Constructor (that accepts a parameter list).

Parameters:
plist[in/out] List of parameters for configuring TSQR. The specific parameter keys that are read depend on the TSQR implementation. For details, call getValidParameters() and examine the documentation embedded therein.

Definition at line 93 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
TSQR::DistTsqr< LocalOrdinal, Scalar >::DistTsqr ( ) [inline]

Constructor (that uses default parameters).

Definition at line 99 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
virtual TSQR::DistTsqr< LocalOrdinal, Scalar >::~DistTsqr ( ) [inline, virtual]

Destructor.

The destructor doesn't need to do anything, thanks to smart pointers.

Definition at line 165 of file Tsqr_DistTsqr.hpp.


Member Function Documentation

template<class LocalOrdinal, class Scalar>
void TSQR::DistTsqr< LocalOrdinal, Scalar >::init ( const Teuchos::RCP< MessengerBase< scalar_type > > &  messenger) [inline]

Finish initialization using the messenger object.

Parameters:
messenger[in/out] An object handling communication between (MPI) process(es).

Definition at line 128 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
rank_type TSQR::DistTsqr< LocalOrdinal, Scalar >::rank ( ) const [inline]

Rank of this (MPI) process.

Rank is computed via MPI_Comm_rank() on the underlying communicator, if the latter is an MPI communicator. If it's a serial "communicator," the rank is always zero.

Definition at line 140 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
rank_type TSQR::DistTsqr< LocalOrdinal, Scalar >::size ( ) const [inline]

Total number of MPI processes in this communicator.

The size is communicated via MPI_Comm_size() on the underlying communicator, if the latter is an MPI communicator. If it's a serial "communicator," the size is always one.

Definition at line 153 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
bool TSQR::DistTsqr< LocalOrdinal, Scalar >::QR_produces_R_factor_with_nonnegative_diagonal ( ) const [inline]

Does the R factor have a nonnegative diagonal?

DistTsqr implements a QR factorization (of a distributed matrix with a special structure). Some, but not all, QR factorizations produce an R factor whose diagonal may include negative entries. This Boolean tells you whether DistTsqr promises to compute an R factor whose diagonal entries are all nonnegative.

Definition at line 175 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
void TSQR::DistTsqr< LocalOrdinal, Scalar >::factorExplicit ( matview_type  R_mine,
matview_type  Q_mine,
const bool  forceNonnegativeDiagonal = false 
) [inline]

Internode TSQR with explicit Q factor.

Call this routine, instead of factor() and explicit_Q(), if you want to compute the QR factorization and only want the Q factor in explicit form (i.e., as a matrix).

Parameters:
R_mine[in/out] View of a matrix with at least as many rows as columns. On input: upper triangular matrix (R factor from intranode TSQR); different on each process.. On output: R factor from intranode QR factorization; bitwise identical on all processes, since it is effectively broadcast from Proc 0.
Q_mine[out] View of a matrix with the same number of rows as R_mine has columns. On output: this process' component of the internode Q factor. (Write into the top block of this process' entire Q factor, fill the rest of Q with zeros, and call intranode TSQR's apply() on it, to get the final explicit Q factor.)
forceNonnegativeDiagonal[in] If true, then (if necessary) do extra work (modifying both the Q and R factors) in order to force the R factor to have a nonnegative diagonal.

Definition at line 210 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
void TSQR::DistTsqr< LocalOrdinal, Scalar >::getFactorExplicitTimings ( std::vector< TimeStats > &  stats) const [inline]

Get cumulative timings for factorExplicit().

Fill in the timings vector with cumulative timings from factorExplicit(). The vector gets resized to fit all the timings.

Definition at line 228 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
void TSQR::DistTsqr< LocalOrdinal, Scalar >::getFactorExplicitTimingLabels ( std::vector< std::string > &  labels) const [inline]

Get labels for timings for factorExplicit().

Fill in the labels vector with the string labels for the timings from factorExplicit(). The vector gets resized to fit all the labels.

Definition at line 243 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
FactorOutput TSQR::DistTsqr< LocalOrdinal, Scalar >::factor ( matview_type  R_mine) [inline]

Compute QR factorization of R factors, one per MPI process.

Compute the QR factorization of the P*ncols by ncols matrix consisting of all P nodes' R_mine upper triangular matrices stacked on top of each other. Generally these upper triangular matrices should come from the QR factorization (perhaps computed by sequential or node-parallel TSQR) of a general matrix on each node.

Note:
"ncols" below is the number of columns in the matrix to factor. Should be the same on all nodes.
Parameters:
R_mine[in,out] On input, an ncols by ncols upper triangular matrix with leading dimension ncols, stored unpacked (as a general matrix). Elements below the diagonal are ignored. On output, the final R factor of the QR factorization of all nodes' different R_mine inputs. The final R factor is replicated over all nodes.
Returns:
Two arrays with the same number of elements: first, an array of "local Q factors," and second, an array of "local tau arrays." These together form an implicit representation of the Q factor. They should be passed into the apply() and explicit_Q() functions as the "factorOutput" parameter.

Definition at line 276 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
void TSQR::DistTsqr< LocalOrdinal, Scalar >::apply ( const ApplyType apply_type,
const ordinal_type  ncols_C,
const ordinal_type  ncols_Q,
scalar_type  C_mine[],
const ordinal_type  ldc_mine,
const FactorOutput &  factor_output 
) [inline]

Apply the result of factor() to the distributed matrix C.

Definition at line 301 of file Tsqr_DistTsqr.hpp.

template<class LocalOrdinal, class Scalar>
void TSQR::DistTsqr< LocalOrdinal, Scalar >::explicit_Q ( const ordinal_type  ncols_Q,
scalar_type  Q_mine[],
const ordinal_type  ldq_mine,
const FactorOutput &  factor_output 
) [inline]

Apply the result of factor() to compute the explicit Q factor.

Definition at line 336 of file Tsqr_DistTsqr.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends