Skip to content

Commit

Permalink
fixing small changes requested by parth
Browse files Browse the repository at this point in the history
  • Loading branch information
William Zijie Zhang committed Sep 25, 2024
1 parent cdd24e1 commit 08d3aaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 3 additions & 8 deletions cvxpy/expressions/leaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""
from __future__ import annotations

from typing import TYPE_CHECKING, Iterable, List
from typing import TYPE_CHECKING, Iterable, List, Optional

if TYPE_CHECKING:
from cvxpy import Constant, Parameter, Variable
Expand Down Expand Up @@ -459,15 +459,10 @@ def save_value(self, val) -> None:
self._value = val

@property
def value(self):
"""np.ndarray or None: The numeric value of the expression."""
def value(self) -> Optional[np.ndarray]:
"""The numeric value of the expression."""
return self._value

@property
def sparse_value(self):
"""np.ndarray or None: The sparse numeric value of the expression."""
return self._sparse_value

@value.setter
def value(self, val) -> None:
self.save_value(self._validate_value(val))
Expand Down
4 changes: 2 additions & 2 deletions cvxpy/reductions/cvx_attr2constr.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
'PSD',
'NSD',
'bounds',
'sparsity'
'sparsity',
]

# Attributes that define lower and upper bounds.
Expand Down Expand Up @@ -148,7 +148,7 @@ def apply(self, problem):
id2new_var[var.id] = upper_tri
fill_coeff = Constant(upper_tri_to_full(n))
full_mat = fill_coeff @ upper_tri
obj = reshape(full_mat, (n, n))
obj = reshape(full_mat, (n, n), order='F')
elif var.attributes['sparsity']:
n = len(var.sparse_idx[0])
sparse_var = Variable(n, var_id=var.id, **new_attr)
Expand Down

0 comments on commit 08d3aaf

Please sign in to comment.