Skip to content

Commit

Permalink
Denisfy the matrices for flattening in testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitSolomonPrinceton committed Jul 18, 2024
1 parent 29b87a3 commit 85e0c36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/osqp/tests/nn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def f(P):

return 0.5 * np.sum(np.square(x_hat - true_x))

dP_fd = approx_fprime(P.tolil().reshape((1,n*n)), f, epsilon=EPS)
dP_fd = approx_fprime(P.toarray().flatten(), f, epsilon=EPS)
if verbose:
print('dP_fd: ', np.round(dP_fd, decimals=4))
print('dP: ', np.round(dP, decimals=4))
Expand Down Expand Up @@ -164,7 +164,7 @@ def f(A):

return 0.5 * np.sum(np.square(x_hat - true_x))

dA_fd = approx_fprime(A.tolil().reshape((1,m*n)), f, epsilon=EPS)
dA_fd = approx_fprime(A.toarray().flatten(), f, epsilon=EPS)
if verbose:
print('dA_fd: ', np.round(dA_fd, decimals=4))
print('dA: ', np.round(dA, decimals=4))
Expand Down

0 comments on commit 85e0c36

Please sign in to comment.