pyQBTNs package

Subpackages

Submodules

pyQBTNs.pyQBTNs module

This software was developed as a tool to factor tensors using quantum annealers. Right now this software includes 5 different tensor factorization methods, making up three distinct types of tensor networks.

The software allows the user to specify local solvers that do not require a connection to a quantum annealer, but still solve the optimization problems the annealer would solve during the factorization algorithm.

In order to use a D-Wave quantum annealer as the solver for this software, the user must set up a D-Wave configuration file.

class pyQBTNs.pyQBTNs.QBTNs(**parameters)[source]

Bases: object

fit(Tensor, Rank, **parameters)[source]

Computes the factors and score for a given factorization method of the input Tensor with the specified rank.

Parameters
  • Tensor (numpy.array(dtype=bool)) – Boolean numpy array with at least two dimensions.

  • Rank (int) – Rank of the factors. Rank >= 2. The size of the quantum annealing hardware limits the size of the rank. For the LANL D-Wave 2000Q, the safe limit is rank 8, although in some cases much higher rank factorization can be achieved.

  • dimensions (list, optional) – Optional argument which supplies the tensor dimensions. Required for Hierarchical tucker because the input is a dict of an HT structure

  • ranks (list, optional) – Optional argument which supplies the tensor factorization ranks. Required for Hierarchical tucker

Returns

Return type

None.

get_factors()[source]

Returns factors computed by the factorization algorithm.

Returns

returns some sort of data structure containing the computed factors. Each factorization algorithm returns slightly different formats for the factors.

Return type

list or dict or tuple

get_reconstructed_tensor()[source]

Gets the boolean numpy array consstructed from the factors found by the tensor factorization algorithm.

Returns

Boolean numpy array that has been recontructed from the computed factors.

Return type

numpy.array(dtype=bool)

get_score()[source]

Returns the hamming distance of the fitted factors to the original tensor

Returns

Hamming distance between the input tensor and the factors found by the given algorithm. The smaller the hamming distance is, the more accurate the factorization process was.

Return type

integer

pyQBTNs.version module

pyQBTNs version.

Module contents

© 2021. Triad National Security, LLC. All rights reserved. This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S. Department of Energy/National Nuclear Security Administration. All rights in the program are reserved by Triad National Security, LLC, and the U.S. Department of Energy/National Nuclear Security Administration. The Government is granted for itself and others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide license in this material to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so.