Skip to content

Commit

Permalink
disallow float for diamatrix values (#1931)
Browse files Browse the repository at this point in the history
  • Loading branch information
phschiele committed Nov 5, 2022
1 parent 643f5e1 commit 86e8508
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cvxpy/atoms/elementwise/elementwise.py
Expand Up @@ -60,7 +60,7 @@ def elemwise_grad_to_diag(value, rows, cols):
"""
if not np.isscalar(value):
value = value.ravel(order='F')
return sp.dia_matrix((value, [0]), shape=(rows, cols)).tocsc()
return sp.dia_matrix((np.atleast_1d(value), [0]), shape=(rows, cols)).tocsc()

@staticmethod
def _promote(arg, shape: Tuple[int, ...]):
Expand Down

0 comments on commit 86e8508

Please sign in to comment.