Skip to content

Commit

Permalink
Removing duplicate rank calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinc0110 committed Jan 21, 2024
1 parent 0c647cd commit 0c83d7e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions skrf/vectorFitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,13 @@ def vector_fit(self, n_poles_real: int = 2, n_poles_cmplx: int = 2, init_pole_sp
logging.info(f'Condition number of coefficient matrix is {int(cond_A)}')
self.history_cond_A.append(cond_A)

rank_A = np.linalg.matrix_rank(A_fast)
self.history_rank_A.append(rank_A)
self.full_rank = np.min(A_fast.shape)
logging.info(f'The rank of the coefficient matrix is {rank_A}. Deficiency is {self.full_rank - rank_A}')

# solve least squares for real parts
x, residuals, rank, singular_vals = np.linalg.lstsq(A_fast, b, rcond=None)

self.history_rank_A.append(rank)
self.full_rank = np.min(A_fast.shape)
logging.info(f'The rank of the coefficient matrix is {rank}. Rank deficiency is {self.full_rank - rank}.')

# assemble individual result vectors from single LS result x
c_res = x[:-1]
d_res = x[-1]
Expand Down

0 comments on commit 0c83d7e

Please sign in to comment.