Improve performance of matrix_equal function (#5356)
Improve performance of matrix_equal function (#5356)

Improve performance of matrix_equal function by approx 4x by preventing copying array inports and preventing unnecessarily iterating over the full array to find the first non-zero entry.

Co-authored-by: mergify[bot] <b09a6ee808b67e98a221404e7aaa52e0398a4954@users.noreply.github.com>
Co-authored-by: Kevin Krsulich <78cdb98aeddd45630046ff39f0a19d75c82aaaa7@ibm.com>
Co-authored-by: Matthew Treinish <4efabb057cc143e1042444743947010c1661479a@kortar.org>
QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py