Skip to content

Commit

Permalink
is row scaling the interpolation matrix sensible?
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Oct 2, 2024
1 parent 64ef89b commit 2dbd27c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions LoopStructural/interpolators/_discrete_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ def add_constraints_to_least_squares(self, A, B, idc, w=1.0, name="undefined"):
B = B.reshape((A.shape[0]))
# w = w.reshape((A.shape[0]))
# normalise by rows of A
length = np.linalg.norm(A, axis=1) # .getcol(0).norm()
# Should this be done? It should make the solution more stable
length = np.linalg.norm(A, axis=1)
B[length > 0] /= length[length > 0]
# going to assume if any are nan they are all nan
mask = np.any(np.isnan(A), axis=1)
Expand All @@ -214,9 +215,6 @@ def add_constraints_to_least_squares(self, A, B, idc, w=1.0, name="undefined"):
raise BaseException("w must be a numpy array")

if w.shape[0] != A.shape[0]:
# # make w the same size as A
# w = np.tile(w,(A.shape[1],1)).T
# else:
raise BaseException("Weight array does not match number of constraints")
if np.any(np.isnan(idc)) or np.any(np.isnan(A)) or np.any(np.isnan(B)):
logger.warning("Constraints contain nan not adding constraints: {}".format(name))
Expand Down

0 comments on commit 2dbd27c

Please sign in to comment.