  Quantum algorithms have been developed for efficiently solving linear algebra
tasks. However, they generally require deep circuits and hence universal
fault-tolerant quantum computers. In this work, we propose variational
algorithms for linear algebra tasks that are compatible with noisy
intermediate-scale quantum devices. We show that the solutions of linear
systems of equations and matrix-vector multiplications can be translated as the
ground states of the constructed Hamiltonians. Based on the variational quantum
algorithms, we introduce Hamiltonian morphing together with an adaptive ansatz
for efficiently finding the ground state, and show the solution verification.
Our algorithms are especially suitable for linear algebra problems with sparse
matrices, and have wide applications in machine learning and optimisation
problems. The algorithm for matrix multiplications can be also used for
Hamiltonian simulation and open system simulation. We evaluate the cost and
effectiveness of our algorithm through numerical simulations for solving linear
systems of equations. We implement the algorithm on the IBM quantum cloud
device with a high solution fidelity of 99.95%.
