Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23276

I'm having a hard time optimizing my code and most of the time is consumed by the operation linalg.solve

$
0
0

I have a code which is calculating "a" matrix with the size of 101x101 and another RHS with the size of 101, which has to iterate over 500 to 1500 steps depending on the cases.Whenever I'm trying to run the code ,

circ = np.linalg.solve(a, RHS)

The time for the entire code to run should be less than 30 seconds, because the same code is in Julia. But it runs for 5 minutes in python.

So, I've recorded the time taken for the function to calculate using time(), and this is what I found for every iteration, I have a graph for it, iterations vs time in sec.Fig1

Then when I restarted the laptop, this was the case and it was 2 minutes to run the entire code.Fig2

These results are different each time I run them so it is not a calculation problem. Is there any ways to run this faster?

I have tried different ways to solve for Ax=B but all of them take the same time to solve if not even longer.


Viewing all articles
Browse latest Browse all 23276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>