Factorization tools

spalor.matrix_tools.factorization_util.partXY(U, V, X)[source]

returns a vector of a sparse set of entries of UV^T np.sum(np.multiply(U[X[0][:], :],V[X[1][:],:]), axis=1) :param U: :param V: :param X: (2,n) nparray of indices for the entries of UV^T needed :return: y (n,) nparray of entries of UV^T

spalor.matrix_tools.factorization_util.svd_from_factorization(U, V)[source]

Orthonormalizes U and V to obtain the singular decomposition of UV^T

Parameters
  • U – (d1,r) numpy array

  • V – (d2,r) numpy array

Returns

(U,Sigma,V) - the singular value decomposition of UV^T

spalor.matrix_tools.factorization_util.svd_low_rank_plus_sparse(U, Sigma, V, S, eps=1e-06, max_iter=100)[source]

Uses power iteration method to find the truncated singular value decompositon of the rank-r approximation to the matrix U Sigma V^T +S efficiently

Parameters
  • U – (d1,r)

  • Sigma – (r,r)

  • V – (d2,r)

  • S – sparse matrix (d1, d2)

:return’