Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions anastruct/fem/system_components/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from typing import TYPE_CHECKING, Optional

import numpy as np
from scipy import linalg # type: ignore

from anastruct.basic import converge

if TYPE_CHECKING:
Expand Down Expand Up @@ -112,7 +110,11 @@ def det_linear_buckling(system: "SystemElements") -> float:
kg = system.reduced_system_matrix - k0
# solve (k -λkg)x = 0

eigenvalues = np.abs(linalg.eigvals(k0, kg))
# The following two lines are equivalent to the cleaner
# scipy.linalg.eigvals(k0, kg), but doing this allows us
# to drop the scipy dependency
invkg_k0 = np.linalg.inv(kg) * k0
eigenvalues = np.abs(np.linalg.eigvals(invkg_k0))
return float(np.min(eigenvalues))


Expand Down
Loading