Am 07.12.20 um 17:59 schrieb Tito SanĂ²:
Regarding the solution of linear algebraic equations I noticed a big
difference in the computation

time in Python compared to the old fortran language.

I have compared both the linelg and lapack.dgesv-lapack.zgesv modules with
the fortan: dgelg and f04adf.

The difference in computation time is enormous:

for example for 430 degrees of freedom it is about 24 min in Python versus
about 1 sec in fortran.

There must be something seriously wrong. If I understand correctly, you want to solve an 430x430 matrix with LU decompositino (that is what dgesv from LAPACK does). The following code takes less than a second on my machine:

==============430.py==============
import numpy as np

# create a 430x430 random matrix
A = np.random.randn(430,430)

# right hand side
b = np.ones(430)

# solve it

x = np.linalg.solve(A, b)

print(x)
====================================


time python3 430.py
real    0m0.318s
user    0m0.292s
sys     0m0.046s

If it takes longer than 1s, there is something wrong with your system.

        Christian
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to