Skip to content

Commit 9af160d

Browse files
committed
Revert "changed if statement to ternary operator and minor changes in return statement"
This reverts commit a063c33.
1 parent a063c33 commit 9af160d

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

pyomo/contrib/doe/utils.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,11 @@ def update_model_from_suffix(suffix_obj: pyo.Suffix, values):
161161

162162
def check_matrix(mat, check_pos_def=True):
163163
"""
164-
Checks that the matrix is square, positive definite, and symmetric.
164+
Checks that the Matrix is square, positive definite, and symmetric.
165165
166166
Parameters
167167
----------
168168
mat: 2D numpy array representing the matrix
169-
check_pos_def: bool, optional
170-
If True, checks if the matrix is positive definite.
171-
Default: True.
172169
173170
Returns
174171
-------
@@ -402,10 +399,11 @@ def compute_correlation_matrix(
402399
correlation_matrix = covariance_matrix / std_dev_matrix
403400

404401
# Set the index to the variable names if provided,
405-
corr_df = (
406-
pd.DataFrame(correlation_matrix, index=var_name, columns=var_name)
407-
if var_name
408-
else correlation_matrix
409-
)
402+
if var_name is not None:
403+
corr_df = pd.DataFrame(correlation_matrix, index=var_name, columns=var_name)
404+
else:
405+
corr_df = correlation_matrix
410406

411-
return corr_df.round(significant_digits) if significant_digits else corr_df
407+
return (
408+
corr_df.round(significant_digits) if significant_digits else correlation_matrix
409+
)

0 commit comments

Comments
 (0)