qubo_to_matrix

qubo_to_matrix(qubo)[source]

Convert supported QUBO inputs to a square matrix.

Parameters:

qubo (list | ndarray | spmatrix | BinaryQuadraticModel) – QUBO input as list, ndarray, sparse matrix, or BinaryQuadraticModel.

Return type:

ndarray | spmatrix

Returns:

Square QUBO matrix as a dense ndarray or sparse matrix.

Raises:

ValueError – If the input cannot be converted to a square matrix or the BinaryQuadraticModel is not binary.