  Sparse coding provides a versatile framework for efficiently capturing and
representing crucial data (information) concisely, which plays an essential
role in various computer science fields, including data compression, feature
extraction, and general signal processing. In this study, we propose a
symmetric quantum neural network for realizing sparse coding and decoding
algorithms. Our networks consist of multi-layer, two-level unitary
transformations that are naturally suited for optical circuits. Each gate is
described by two real parameters, corresponding to reflectivity and phase
shift. Specifically, the two networks can be efficiently trained together or
separately using a quantum natural gradient descent algorithm, either
simultaneously or independently. Utilizing the trained model, we achieve sparse
coding and decoding of binary and grayscale images in classical problems, as
well as that of complex quantum states in quantum problems separately. The
results demonstrate an accuracy of 98.77\% for image reconstruction and a
fidelity of 97.68\% for quantum state revivification. Our quantum sparse coding
and decoding model offers improved generalization and robustness compared to
the classical model, laying the groundwork for widespread practical
applications in the emerging quantum era.
