Cholesky

#include <poplin/Cholesky.hpp>

Factorise a positive definite matrix using Cholesky decomposition.

namespace poplin

Linear algebra functions.

Decomposition of a matrix into an lower triangular matrix L and upper triangular matrix U.

Functions

std::vector<std::pair<MatMulParams, poplar::OptionFlags>> getCholeskyMatMulPrePlanParameters(const poplar::Type &type, const std::vector<std::size_t> &shape, bool lower, poplar::OptionFlags options)

Plan matrix multiplication for the Cholesky factoriser.

Supported options:

  • blockSize: A hint for the size of the block to be used.

See also

matMul() for additional options.

Parameters
  • type – The data type of the input tensor.

  • shape – The shape of the input tensor.

  • lower – If true, return a lower triangular matrix, else return an upper triangular matrix.

  • options – A structure describing options on how the decomposition should be implemented.

Returns

Preplan parameters for matMul().

poplar::Tensor createCholeskyInput(poplar::Graph &graph, const poplar::Type &type, const std::vector<std::size_t> &shape, bool lower, const poplar::DebugContext &debugContext, const poplar::OptionFlags &options = {}, PlanningCache *cache = nullptr)

Create a tensor that is used as the input for the Cholesky factoriser.

Supported options:

  • blockSize: A hint for the size of the block to be used.

This will create a 2D/3D tensor in the graph. The ordering and tile mapping of the tensor will be set to make a triangular factoriser with this tensor as the left argument efficient.

See also

matMul() for additional options.

Parameters
  • graph – The Poplar graph.

  • type – The input data type.

  • shape – The shape of the tensor.

  • lower – If true, return a lower triangular matrix, else return an upper triangular matrix.

  • debugContext – Debug information.

  • options – A structure describing options on how the decomposition should be implemented.

  • cache – Optional pointer to a planning cache to use.

Returns

A matrix of type type and shape shape. The tensor will have been mapped to tiles.

poplar::Tensor cholesky(poplar::Graph &graph, const poplar::Tensor &a, bool lower, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, poplar::OptionFlags options = {}, PlanningCache *cache = nullptr)

Computes Cholesky factor for a symmetric positive definite matrix.

Supported options:

  • blockSize: A hint for the size of the block to be used.

See also

matMul() for additional options.

Parameters
  • graph – The Poplar graph.

  • a – A tensor of floating-point type with shape […, N,N].

  • lower – If true, return a lower triangular matrix, else return an upper triangular matrix.

  • prog – A reference to a program sequence which the code to perform the arrangement will be appended to.

  • debugContext – Optional debug information.

  • options – A structure describing options on how the decomposition should be implemented.

  • cache – Optional pointer to a planning cache to use.

Returns

A tensor with the same shape as a with a triangular factor.

void choleskyInPlace(poplar::Graph &graph, const poplar::Tensor &a, bool lower, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, poplar::OptionFlags options = {}, PlanningCache *cache = nullptr)

Computes Cholesky factor in place for a symmetric positive definite matrix.

Supported options:

  • blockSize: A hint for the size of the block to be used.

See also

matMul() for additional options.

Parameters
  • graph – The Poplar graph.

  • a – A tensor of floating-point type with shape […, N,N].

  • lower – If true, return a lower triangular matrix, else return an upper triangular matrix.

  • prog – A reference to a program sequence which the code to perform the arrangement will be appended to.

  • debugContext – Optional debug information.

  • options – A structure describing options on how the decomposition should be implemented.

  • cache – Optional pointer to a planning cache to use.

Returns

None.