Skip to main content

Module tensor_network_bridge

Module tensor_network_bridge 

Source
Expand description

Tensor network bridge for quantum-classical hybrid inference.

This module provides conversion between probabilistic graphical models and quantum tensor network representations, enabling efficient computation of marginals and partition functions.

§Overview

Tensor networks provide a natural bridge between:

  • Classical PGMs (factor graphs, MRFs)
  • Quantum states (MPS, PEPS, MERA)

§Key Concepts

  • MPS (Matrix Product State): 1D tensor network for linear chains
  • PEPS (Projected Entangled Pair State): 2D tensor network
  • Tensor Network Contraction: Computing expectations and marginals

§Example

use tensorlogic_quantrs_hooks::tensor_network_bridge::{
    factor_graph_to_tensor_network, TensorNetwork,
};
use tensorlogic_quantrs_hooks::FactorGraph;

let mut graph = FactorGraph::new();
graph.add_variable_with_card("x".to_string(), "Binary".to_string(), 2);
graph.add_variable_with_card("y".to_string(), "Binary".to_string(), 2);

let tn = factor_graph_to_tensor_network(&graph).unwrap();
println!("Tensor network with {} tensors", tn.num_tensors());

Structs§

MatrixProductState
Matrix Product State (MPS) representation.
Tensor
A tensor in the tensor network.
TensorNetwork
A tensor network representation.
TensorNetworkStats
Statistics about a tensor network.

Functions§

factor_graph_to_tensor_network
Convert a factor graph to a tensor network.
linear_chain_to_mps
Convert a Linear Chain CRF to a Matrix Product State.