This repository provides the MATLAB implementation for the paper:
Efficient Generative Modeling with Unitary Matrix Product States Using Riemannian Optimization
The code implements a generative modeling framework based on unitary Matrix Product States (MPS) and Riemannian optimization, and is used for experiments on datasets including Bars and Stripes, and EMNIST (includes the MNIST dataset). Overall, our approach achieves substantially faster convergence—up to 27× higher efficiency compared with the original MPS-based generative model.
- MATLAB (R2022a or later is recommended)
- No additional toolboxes are required
To run the code, please follow the steps below:
-
Add required folders to the MATLAB path
- datasets
- figure
Alternatively, run the following commands in MATLAB:
addpath(genpath('datasets')); addpath(genpath('figure'));
-
Run the main script
Execute:
main_generate_sample_mnist.mThis script trains the unitary MPS generative model and generates samples for the MNIST dataset.
- The Bars and Stripes (BAS) dataset is located in the
datasetsfolder. - The dataset can be generated using:
% H -> height, W -> width generate_bas(H,W)
- Dataset parameters can be adjusted inside the function as needed.
-
The EMNIST dataset can be downloaded from:
https://www.nist.gov/itl/products-and-services/emnist-dataset
-
After downloading, use the following function to read and preprocess the dataset:
save_images_emnist.m
The comparison experiments reported in the paper can be found in the following repository:
https://github.com/congzlwag/UnsupGenModbyMPS
This repository provides baseline implementations for unsupervised generative modeling using Matrix Product States.
If you use this code in your research, please cite the corresponding paper.
"Efficient Generative Modeling with Unitary Matrix Product States Using Riemannian Optimization"
https://arxiv.org/abs/2603.12026
Authors: Haotong Duan, Zhongming Chen, Ngai Wong.