# How to optimize my HHL algorithm on qiskit?

I am following this HHL tutorial to solve the $$Ax=b$$ problem and have been using the general (inefficient) approach with the BasicAer simulator that they describe in section 4a. I would now like to run on the actual IBMQ machines but I am finding that my circuit depth and CNOT counts are quite high. To solve this issue, I would like to optimize my circuit. In section 4b of the tutorial they outline a method of optimizing their specific problem which substantially reduces the qubit count, circuit depth, and CNOT count. The problem I am having is figuring out how to extend this to larger matrices $$A$$ than the $$2$$x$$2$$ that they use. Is there a general approach to optimizing an HHL circuit?

In the last page of https://arxiv.org/abs/2009.04484 you can find the circuits for the example mentioned in the textbook and for the case of a $$4\times 4$$ matrix, maybe this helps to run your circuit.