QRFactorization
#include <poplin/experimental/QRFactorization.hpp>
Decomposition of a matrix into an orthogonal matrix Q and upper triangular matrix R.
-
namespace poplin
Linear algebra functions.
-
namespace experimental
Functions
-
std::array<poplar::Tensor, 2> createQRFactorizationMatrices(poplar::Graph &graph, const poplar::Type &type, const std::size_t m, const std::size_t n, const poplar::DebugContext &debugContext)
Create a tensor that is used as the output Q operand of QR factorization.
This will create matrices A and Q (2D tensors) in the graph. The number of matrix A rows must be greater or equal to the number of columns. Matrix Q is a square matrix. The ordering and tile mapping of the matrices will be set to make a QR factorization with these matrices as the input and output efficiency.
- Parameters
graph – The Poplar graph.
type – The data type of the returned tensor.
m – The number of rows of the input matrix A. This is also used to shape the square Q matrix.
n – The number of columns of the input matrix A.
debugContext – Debug information.
- Returns
The matrices A and Q of type
type
and shapedimensionA
anddimensionQ
respectively. The matrices will be include a mapping to tiles.
-
void QRFactorization(poplar::Graph &graph, poplar::Tensor &A, poplar::Tensor &Q, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
Calculates the QR factorization for the given matrix.
This will compute the QR factorization for the input matrix A. The number of matrix A rows must be greater or equal to the number of columns. The output matrix R will overwrite matrix A. For matrix Q, the identity matrix should be passed.
Supported options:
rowsPerIteration
A hint for the size of rows block to be calculated per iteration. The QRFactorization() function uses a hybrid approach, balancing the number of programs generated and the number of iterations performed by each program. A higher value of this parameter results in a shorter compilation time at the expense of performance.
The default value is 32.
- Parameters
graph – The Poplar graph.
A – Tensor of floating-point type with shape [M, N].
Q – Identity matrix of the same type with shape [M, M].
prog – A reference to a program sequence which the code to perform the arrangement will be appended to.
debugContext – Optional debug information.
options – The implementation options of the triangular solver.
-
std::array<poplar::Tensor, 2> createQRFactorizationMatrices(poplar::Graph &graph, const poplar::Type &type, const std::size_t m, const std::size_t n, const poplar::DebugContext &debugContext)
-
namespace experimental