Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PEPit/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def add_constraints_from_two_lists_of_points(self, list_of_points_1, list_of_poi
constraint_name (str): generic name for this constraint.
set_class_constraint_i_j (Callable): a function that takes two points in input
and returns a :class:`Constraint`.
symmetry (bool or int, optional): A boolean specifying if the constraint function is symmetric or not. If equals -1, means a skew symmetric constraint.
symmetry (bool, optional): A boolean specifying if the constraint function is symmetric or not.
If so, the number of constraints is divided by 2.
Set to False by default.

Expand Down Expand Up @@ -418,7 +418,7 @@ def add_constraints_from_two_lists_of_points(self, list_of_points_1, list_of_poi
if xj_id is None:
xj_id = "Point_{}".format(j)

if (i == j and symmetry != -1) or (i > j and symmetry):
if i == j or (i > j and symmetry):
row_of_constraints.append(0)

else:
Expand Down
18 changes: 17 additions & 1 deletion PEPit/operators/skew_symmetric_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ def set_antisymmetric_linear_constraint_i_j(xi, gi, fi,

return constraint

@staticmethod
def set_diagonal_linear_constraint_i(xi, gi, fi,
):
"""
Formulates the list of interpolation constraints for self (Skew-symmetric linear operator).
"""
# Interpolation conditions of symmetric linear operators class
constraint = (xi * gi == 0)

return constraint

def add_class_constraints(self):
"""
Formulates the list of necessary and sufficient conditions for interpolation of self
Expand All @@ -90,8 +101,13 @@ def add_class_constraints(self):
constraint_name="antisymmetric_linearity",
set_class_constraint_i_j=
self.set_antisymmetric_linear_constraint_i_j,
symmetry=-1,
symmetry=True,
)
self.add_constraints_from_one_list_of_points(list_of_points=self.list_of_points,
constraint_name="diagonal_linearity",
set_class_constraint_i=
self.set_diagonal_linear_constraint_i,
)

# Create a PSD matrix to enforce the singular values to be smaller than L
N = len(self.list_of_points)
Expand Down
2 changes: 2 additions & 0 deletions docs/source/whatsnew/0.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ What's new in PEPit 0.4.0
- Corrected example: SGD's closed-form solution has been updated.

- The support of functions of the class :class:`ConvexIndicatorFunction` can be constrained through a radius in addition to a diameter.

- Fix: The :class:`SkewSymmetricLinearOperator` constraints have been completed with the formerly missing "xi * gi == 0".
2 changes: 1 addition & 1 deletion tests/test_functions_and_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def test_add_constraints(self):
self.assertEqual(len(self.operator8.list_of_class_constraints), num_points_eval * (num_points_eval - 1) / 2)
self.assertEqual(len(self.operator9.list_of_class_constraints), num_points_eval)
self.assertEqual(len(self.operator10.list_of_class_constraints), num_points_eval * (num_points_eval - 1) / 2)
self.assertEqual(len(self.operator11.list_of_class_constraints), num_points_eval * (num_points_eval - 1) / 2)
self.assertEqual(len(self.operator11.list_of_class_constraints), num_points_eval * (num_points_eval + 1) / 2)
self.assertEqual(len(self.new_operator.list_of_class_constraints), 0)

def test_name(self):
Expand Down