ensign.cp_decomp.reconstruct_into¶
-
reconstruct_into(decomp, tensor, comp_ids=None, orig_entries=False)[source]¶ Reconstructs a CP decomposition ‘into’ a sparse tensor.
Reconstructs a tensor from a decomposition
decompby computing and summing selected outer products. If a list of component IDs is given incomp_idsthen only components in this list will contribute to the reconstruction. Only nonzero indices oftensorare included in the reconstructed tensor.- Parameters
- decompCPDecomp
Decompostion to reconstruct using sum-of-outer-products.
- tensorSPTensor
The sparse tensor that contains the nonzero entries to reconstruct into.
- comp_idslist, optional
A list of components to reconstruct the SPTensor from. If
None(default), all components are used.- orig_entriesbool, optional
This parameter controls the value of entries in the reconstructed tensor. When
True, nonzero values in the sum-of-outer-products reconstruction are given the same value astensorregardless of reconstructed value. WhenFalse(default) nonzero values are given the value produced by the sum-of-outer-products reconstruction.
- Returns
- reconstructed_sptSPTensor
The sparse tensor produced by reconstructing selected components of
decompinto nonzero values oftensor.