svdbpi

Contents

svdbpi#

Perform a singular value decomposition (SVD) using the block power iteration method. This method is usually better than svd where the matrices are small and batches are large

template<typename AType>
__MATX_INLINE__ auto matx::svdbpi(const AType &A, int max_iters = 10, float tol = 0.0f)#

Perform a SVD decomposition using the block power iteration. This version of SVD works well on small n/m with large batch.

Template Parameters:

AType – Tensor or operator type for output of A input tensors.

Parameters:
  • A – Input tensor or operator for tensor A input with size batches x m x n

  • max_iters – The approximate maximum number of QR iterations to perform.

  • tol – The termination tolerance for the QR iteration. Setting this to 0 will skip the tolerance check.

Examples#

auto A = make_tensor<AType>(Ashape);
auto U = make_tensor<AType>(Ushape);
auto VT = make_tensor<AType>(VTshape);
auto S = make_tensor<SType>(Sshape);

int iterations = 100;

(A = random<AType>(std::move(Ashape), NORMAL)).run(exec);


(U = 0).run(exec);
(S = 0).run(exec);
(VT = 0).run(exec);

(mtie(U, S, VT) = svdbpi(A, iterations)).run(exec);