Logging

The Python interface for Fulqrum has verbose logging functionality built in. Here we show an example of logging inside the Jupyter notebook from which this docuement is generated.

[1]:
import fulqrum as fq

Formatting the logger

Here we show how to format the logger for useful output. Importantly, when using Jupyter notebooks we need to include force=True in the config in order to have the logs show up in the cell output

[2]:
import logging

logging.basicConfig(
    level=logging.INFO,
    force=True,
    format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
)

Small example

Here we load a molecule, transform it, build a subspace, and finally put them all together in a SubspaceHamiltonian. Having set the logging config above, the ouput from each logger entry will be displayed in the cell output.

[3]:
fop = fq.FermionicOperator.from_json("./data/lih.json")
op = fop.extended_jw_transformation()

counts = []
for kk in range(2**op.width):
    counts.append(bin(kk)[2:].zfill(op.width))

S = fq.Subspace([counts])
Hsub = fq.SubspaceHamiltonian(op, S)
2026-09-09 17:34:39,285 - INFO - fulqrum.core.fermi_operator - Extended JW time: 1.32 ms
2026-09-09 17:34:39,287 - INFO - fulqrum.core.subspace - Initializing Subspace
2026-09-09 17:34:39,289 - INFO - fulqrum.core.subspace - Full subspace bit-strings
2026-09-09 17:34:39,290 - INFO - fulqrum.core.subspace - Subspace size: 4096
2026-09-09 17:34:39,291 - INFO - fulqrum.core.subspace - Number of bits: 12
2026-09-09 17:34:39,291 - INFO - fulqrum.core.subspace - Using all bitset blocks: True
2026-09-09 17:34:39,292 - INFO - fulqrum.core.subspace - Reserve multiplier: 2
2026-09-09 17:34:39,294 - INFO - fulqrum.core.subspace - Subspace total init time: 4.767 ms
2026-09-09 17:34:39,295 - INFO - fulqrum.core.linear_operator - Initializing SubspaceHamiltonian
2026-09-09 17:34:39,296 - INFO - fulqrum.core.linear_operator - Number of qubits: 12
2026-09-09 17:34:39,297 - INFO - fulqrum.core.linear_operator - Num. diagonal terms 78
2026-09-09 17:34:39,298 - INFO - fulqrum.core.linear_operator - Num. off-diagonal terms 552
2026-09-09 17:34:39,299 - INFO - fulqrum.core.qubit_operator - Term grouping time: 0.128 ms
2026-09-09 17:34:39,300 - INFO - fulqrum.core.linear_operator - Term grouping time: 1.691 ms
2026-09-09 17:34:39,301 - INFO - fulqrum.core.qubit_operator - Starting ladder int grouping, ladder_width = 2
2026-09-09 17:34:39,302 - INFO - fulqrum.core.qubit_operator - Ladder int grouping time: 0.071 ms
2026-09-09 17:34:39,303 - INFO - fulqrum.core.linear_operator - Num. off-diagonal groups: 83
2026-09-09 17:34:39,304 - INFO - fulqrum.core.spmv - Initializing FulqrumSpMV
2026-09-09 17:34:39,305 - INFO - fulqrum.core.spmv - Operator is real
2026-09-09 17:34:39,306 - INFO - fulqrum.core.spmv - Operator type = 2
2026-09-09 17:34:39,307 - INFO - fulqrum.core.spmv - FulqrumSpMV total init time: 2.045 ms
2026-09-09 17:34:39,307 - INFO - fulqrum.core.linear_operator - SubspaceHamiltonian total init time: 10.902 ms
[ ]: