Closed AntonioWR closed 2 years ago
Hi Antonio,
Many thanks for raising this, and apologies for not getting back to you earlier.
I think your approach works well, because I haven't found a scipy
alternative to solve the Lyapunov equation for sparse matrices.
If you want you can open a pull request to fix this little issue with your solution. We would greatly appreciate that! (maybe you can add a warning message if the matrices are sparse saying that they need to be dense and that you are transforming them, or something along those lines)
Thanks, Norberto
Describe the bug In librom.py under balreal_direct_py, Scipy Schur() decomposition, solve_discrete_lyapunov() and svd() do not accept csr_matrix type for state matrix A.
My temporal way of dealing with it is to transfer it to a dense matrix by the todense() function shown below.
if Schur:
decompose A
else:
A is a sparse matrix in csr_matrix format, can not be directly passed into scipy _solver.py so is transformed here first.
To Reproduce I am using the Goland wing example, but I change the ROM method to direct balancing method.
If model related, please try and reproduce with one of the provided models (found in
/cases/
). Else, please provided the input files (a.fem.h5
,aero.h5
andcase.sharpy
).Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
System Info (please complete the following information):
Additional context Add any other context about the problem here.