PyFinitDiff 1.2.3__py3-none-any.whl → 1.3.1.post0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. PyFinitDiff/__init__.py +8 -0
  2. PyFinitDiff/_version.py +16 -0
  3. PyFinitDiff/finite_difference_1D/__init__.py +6 -6
  4. PyFinitDiff/finite_difference_1D/boundaries.py +113 -30
  5. PyFinitDiff/finite_difference_1D/derivative.py +44 -0
  6. PyFinitDiff/finite_difference_1D/diagonals.py +4 -3
  7. PyFinitDiff/finite_difference_1D/finite_difference.py +21 -7
  8. PyFinitDiff/finite_difference_1D/utils.py +40 -4
  9. PyFinitDiff/finite_difference_2D/__init__.py +5 -7
  10. PyFinitDiff/finite_difference_2D/boundaries.py +103 -23
  11. PyFinitDiff/finite_difference_2D/dense.py +15 -9
  12. PyFinitDiff/finite_difference_2D/derivative.py +18 -29
  13. PyFinitDiff/finite_difference_2D/diagonals.py +147 -91
  14. PyFinitDiff/finite_difference_2D/finite_difference.py +67 -56
  15. PyFinitDiff/finite_difference_2D/utils.py +51 -5
  16. {PyFinitDiff-1.2.3.dist-info → PyFinitDiff-1.3.1.post0.dist-info}/METADATA +31 -11
  17. PyFinitDiff-1.3.1.post0.dist-info/RECORD +28 -0
  18. {PyFinitDiff-1.2.3.dist-info → PyFinitDiff-1.3.1.post0.dist-info}/WHEEL +1 -1
  19. {PyFinitDiff-1.2.3.dist-info → PyFinitDiff-1.3.1.post0.dist-info}/top_level.txt +0 -1
  20. PyFinitDiff/VERSION +0 -1
  21. PyFinitDiff/__pycache__/__init__.cpython-311.pyc +0 -0
  22. PyFinitDiff/__pycache__/triplet.cpython-311.pyc +0 -0
  23. PyFinitDiff/__pycache__/utils.cpython-311.pyc +0 -0
  24. PyFinitDiff/coefficients/__pycache__/__init__.cpython-311.pyc +0 -0
  25. PyFinitDiff/coefficients/__pycache__/backward.cpython-311.pyc +0 -0
  26. PyFinitDiff/coefficients/__pycache__/central.cpython-311.pyc +0 -0
  27. PyFinitDiff/coefficients/__pycache__/forward.cpython-311.pyc +0 -0
  28. PyFinitDiff/finite_difference_1D/__pycache__/__init__.cpython-311.pyc +0 -0
  29. PyFinitDiff/finite_difference_1D/__pycache__/boundaries.cpython-311.pyc +0 -0
  30. PyFinitDiff/finite_difference_1D/__pycache__/derivatives.cpython-311.pyc +0 -0
  31. PyFinitDiff/finite_difference_1D/__pycache__/diagonals.cpython-311.pyc +0 -0
  32. PyFinitDiff/finite_difference_1D/__pycache__/finite_difference.cpython-311.pyc +0 -0
  33. PyFinitDiff/finite_difference_1D/__pycache__/meshes.cpython-311.pyc +0 -0
  34. PyFinitDiff/finite_difference_1D/__pycache__/utils.cpython-311.pyc +0 -0
  35. PyFinitDiff/finite_difference_1D/derivatives.py +0 -53
  36. PyFinitDiff/finite_difference_1D/meshes.py +0 -41
  37. PyFinitDiff/finite_difference_2D/__pycache__/__init__.cpython-311.pyc +0 -0
  38. PyFinitDiff/finite_difference_2D/__pycache__/boundaries.cpython-311.pyc +0 -0
  39. PyFinitDiff/finite_difference_2D/__pycache__/derivative.cpython-311.pyc +0 -0
  40. PyFinitDiff/finite_difference_2D/__pycache__/diagonals.cpython-311.pyc +0 -0
  41. PyFinitDiff/finite_difference_2D/__pycache__/finite_difference.cpython-311.pyc +0 -0
  42. PyFinitDiff/finite_difference_2D/__pycache__/meshes.cpython-311.pyc +0 -0
  43. PyFinitDiff/finite_difference_2D/__pycache__/utils.cpython-311.pyc +0 -0
  44. PyFinitDiff/finite_difference_2D/meshes.py +0 -50
  45. PyFinitDiff-1.2.3.dist-info/RECORD +0 -65
  46. tests/1D/__init__.py +0 -0
  47. tests/1D/__pycache__/__init__.cpython-311.pyc +0 -0
  48. tests/1D/__pycache__/test_api.cpython-311-pytest-8.2.2.pyc +0 -0
  49. tests/1D/__pycache__/test_derivative.cpython-311-pytest-8.2.2.pyc +0 -0
  50. tests/1D/test_api.py +0 -36
  51. tests/1D/test_derivative.py +0 -60
  52. tests/2D/__init__.py +0 -0
  53. tests/2D/__pycache__/__init__.cpython-311.pyc +0 -0
  54. tests/2D/__pycache__/test_api.cpython-311-pytest-8.2.2.pyc +0 -0
  55. tests/2D/__pycache__/test_derivative.cpython-311-pytest-8.2.2.pyc +0 -0
  56. tests/2D/__pycache__/test_eigen.cpython-311-pytest-8.2.2.pyc +0 -0
  57. tests/2D/test_api.py +0 -44
  58. tests/2D/test_derivative.py +0 -76
  59. tests/2D/test_eigen.py +0 -58
  60. {PyFinitDiff-1.2.3.dist-info → PyFinitDiff-1.3.1.post0.dist-info}/LICENSE +0 -0
@@ -2,26 +2,32 @@ import numpy as np
2
2
  import numpy
3
3
  import matplotlib.pyplot as plt
4
4
  from scipy import sparse
5
- from dataclasses import dataclass, field
6
- from typing import Dict
5
+ from dataclasses import field
6
+ from typing import Dict, Optional
7
+
8
+ from pydantic.dataclasses import dataclass
9
+ from pydantic import ConfigDict
7
10
 
8
11
  from PyFinitDiff.utils import NameSpace
9
12
  from PyFinitDiff.coefficients import FinitCoefficients
10
13
 
11
14
 
12
- @dataclass
15
+ config_dict = ConfigDict(extra='forbid', strict=True, kw_only=True, frozen=True)
16
+
17
+
18
+ @dataclass(config=config_dict)
13
19
  class FiniteDifference():
14
20
  """
15
21
  Reference : ['math.toronto.edu/mpugh/Teaching/Mat1062/notes2.pdf']
16
22
  """
17
23
  n_x: int
18
24
  n_y: int
19
- dx: float = 1
20
- dy: float = 1
21
- derivative: int = 1
22
- accuracy: int = 2
23
- naive: bool = False
24
- symmetries: Dict[str, str] = field(default_factory=lambda: ({'left': 0, 'right': 0, 'top': 0, 'bottom': 0}))
25
+ dx: Optional[float] = 1
26
+ dy: Optional[float] = 1
27
+ derivative: Optional[int] = 1
28
+ accuracy: Optional[int] = 2
29
+ naive: Optional[bool] = False
30
+ symmetries: Dict[str, int] = field(default_factory=lambda: ({'left': 0, 'right': 0, 'top': 0, 'bottom': 0}))
25
31
 
26
32
  def __post_init__(self):
27
33
  self.finit_coefficient = FinitCoefficients(
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
- import numpy
5
-
4
+ import numpy as np
6
5
  import PyFinitDiff.finite_difference_2D as module
7
6
 
8
7
 
9
8
  def get_array_derivative(
10
- array: numpy.ndarray,
9
+ array: np.ndarray,
11
10
  derivative: int,
12
11
  accuracy: int = 4,
13
12
  coefficient_type: str = 'central',
@@ -15,31 +14,23 @@ def get_array_derivative(
15
14
  dy: float = 1,
16
15
  x_derivative: bool = True,
17
16
  y_derivative: bool = True,
18
- boundaries: module.Boundaries = module.Boundaries()) -> float:
17
+ boundaries: module.Boundaries = module.Boundaries()) -> np.ndarray:
19
18
  """
20
- Gets the 2D gradient of an array array.
21
-
22
- :param array: The array of which to compute the nth derivative
23
- :type array: object
24
- :param derivative: The order of the derivative
25
- :type derivative: int
26
- :param accuracy: The accuracy for the derivative
27
- :type accuracy: int
28
- :param coefficient_type: The coefficient type
29
- :type coefficient_type: str
30
- :param dx: The delta value in x direction
31
- :type dx: float
32
- :param dy: The delta value in y direction
33
- :type dy: float
34
- :param x_derivative: Compute the x derivative
35
- :type x_derivative: bool
36
- :param y_derivative: Compute the y derivative
37
- :type y_derivative: bool
38
- :param boundaries: The boundaries conditions
39
- :type boundaries: Boundaries
40
-
41
- :returns: The 2D gradient array.
42
- :rtype: float
19
+ Computes the 2D gradient of a given array using finite differences.
20
+
21
+ Args:
22
+ array (np.ndarray): The array for which to compute the nth derivative.
23
+ derivative (int): The order of the derivative.
24
+ accuracy (int, optional): The accuracy for the derivative. Defaults to 4.
25
+ coefficient_type (str, optional): The coefficient type. Defaults to 'central'.
26
+ dx (float, optional): The delta value in the x direction. Defaults to 1.
27
+ dy (float, optional): The delta value in the y direction. Defaults to 1.
28
+ x_derivative (bool, optional): Whether to compute the x derivative. Defaults to True.
29
+ y_derivative (bool, optional): Whether to compute the y derivative. Defaults to True.
30
+ boundaries (module.Boundaries, optional): The boundary conditions. Defaults to module.Boundaries().
31
+
32
+ Returns:
33
+ np.ndarray: The 2D gradient array.
43
34
  """
44
35
  n_x, n_y = array.shape
45
36
 
@@ -60,5 +51,3 @@ def get_array_derivative(
60
51
  gradient = triplet.to_scipy_sparse() * array.ravel()
61
52
 
62
53
  return gradient.reshape([n_x, n_y])
63
-
64
- # -
@@ -1,39 +1,53 @@
1
- # Built-in imports
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ from __future__ import annotations
5
+
2
6
  from dataclasses import field
3
- from typing import Optional
7
+ from typing import Optional, List
4
8
  from pydantic.dataclasses import dataclass
5
9
  from pydantic import ConfigDict
6
10
 
7
11
 
8
- # Local imports
9
12
  import numpy
10
13
  from PyFinitDiff.triplet import Triplet
11
- import PyFinitDiff.finite_difference_2D as module
12
14
  from PyFinitDiff.finite_difference_2D.utils import MeshInfo
15
+ from PyFinitDiff.finite_difference_2D.boundaries import Boundary
16
+
17
+ config_dict = ConfigDict(
18
+ extra='forbid',
19
+ strict=True,
20
+ kw_only=True,
21
+ frozen=True,
22
+ arbitrary_types_allowed=True
23
+ )
13
24
 
14
25
 
15
- @dataclass(config=ConfigDict(extra='forbid', arbitrary_types_allowed=True))
26
+ @dataclass(config=config_dict)
16
27
  class Diagonal():
17
28
  """
18
- This class is a construction of diagonals element of the finit-difference method.
19
- The class can be initialized with different parameters suchs as it's offset or
29
+ This class represents the diagonal elements of the finite-difference method.
30
+ The class can be initialized with different parameters such as its offset or
20
31
  boundary condition.
21
32
 
33
+ Attributes:
34
+ mesh_info (MeshInfo): Instance describing the meta info on the mesh to be considered.
35
+ offset (int): Offset of the column index for the diagonal.
36
+ values (numpy.ndarray): Values associated with the diagonal.
37
+ boundary (Optional[Boundary]): Instance of the boundary used for that diagonal.
22
38
  """
23
39
  mesh_info: MeshInfo
24
- """ Instance describing the meta info on the mesh to be considered. """
25
40
  offset: int
26
- """ Offset of the column index for the diagonal. """
27
41
  values: numpy.ndarray
28
- """ Value associated with the diagonal. """
29
- boundary: Optional[module.Boundary] = None
30
- """ Instance of the boundary used for that diagonal. """
42
+ boundary: Optional[Boundary] = None
31
43
 
32
44
  @property
33
45
  def triplet(self) -> Triplet:
34
46
  """
35
- Return the Triplet instance of the diagonal.
47
+ Returns the Triplet instance of the diagonal.
36
48
 
49
+ Returns:
50
+ Triplet: The Triplet instance containing the array and shape.
37
51
  """
38
52
  self.array: numpy.ndarray = numpy.c_[self.rows, self.columns, self.values]
39
53
 
@@ -46,14 +60,10 @@ class Diagonal():
46
60
 
47
61
  def compute_triplet(self) -> None:
48
62
  """
49
- Compute the diagonal index and generate a Triplet instance out of it.
63
+ Computes the diagonal index and generates a Triplet instance out of it.
50
64
  The value of the third triplet column depends on the boundary condition.
51
-
52
- :returns: No return
53
- :rtype: None
54
65
  """
55
66
  self.rows: numpy.ndarray = numpy.arange(0, self.mesh_info.size)
56
-
57
67
  self.columns: numpy.ndarray = self.rows + self.offset
58
68
 
59
69
  self.apply_symmetry()
@@ -62,17 +72,10 @@ class Diagonal():
62
72
 
63
73
  def apply_symmetry(self) -> None:
64
74
  """
65
- Return the value of the diabonal index as defined by the boundary condition.
75
+ Adjusts the values of the diagonal index as defined by the boundary condition.
66
76
  If boundary is symmetric the value stays the same, if anti-symmetric a minus sign
67
77
  is added, if zero it returns zero.
68
78
 
69
- :param values: The values
70
- :type values: The initial value
71
- :param shift_array: The shift array
72
- :type shift_array: numpy.ndarray
73
-
74
- :returns: The symmetrized value
75
- :rtype: float
76
79
  """
77
80
  shift_array = self.boundary.get_shift_vector(self.offset)
78
81
 
@@ -80,22 +83,17 @@ class Diagonal():
80
83
  return
81
84
 
82
85
  self.columns = self.columns + 2 * shift_array
83
-
84
86
  self.values[shift_array != 0] *= self.boundary.get_factor()
85
87
 
86
88
  def validate_index(self) -> None:
87
89
  """
88
- Removes all negative index
90
+ Removes all negative indices.
89
91
 
90
- :returns: No return
91
- :rtype: None
92
92
  """
93
93
  valid_index = self.columns >= 0
94
94
 
95
95
  self.columns = self.columns[valid_index]
96
-
97
96
  self.rows = self.rows[valid_index]
98
-
99
97
  self.values = self.values[valid_index]
100
98
 
101
99
  def plot(self) -> None:
@@ -107,7 +105,7 @@ class Diagonal():
107
105
 
108
106
 
109
107
  class ConstantDiagonal(Diagonal):
110
- def __init__(self, offset: int, value: float, mesh_info: list, boundary: module.Boundary):
108
+ def __init__(self, offset: int, value: float, mesh_info: list, boundary: Boundary):
111
109
  super().__init__(
112
110
  offset=offset,
113
111
  mesh_info=mesh_info,
@@ -116,144 +114,202 @@ class ConstantDiagonal(Diagonal):
116
114
  )
117
115
 
118
116
 
119
- @dataclass
117
+ @dataclass(config=config_dict)
120
118
  class DiagonalSet():
121
- mesh_info: object
122
- diagonals: list = field(default_factory=list)
119
+ """
120
+ This class represents a set of diagonals for the finite-difference method. It provides
121
+ various utilities for manipulating and analyzing the set of diagonals.
123
122
 
124
- def append(self, diagonal: Diagonal) -> 'DiagonalSet':
123
+ Attributes:
124
+ mesh_info (object): Meta information about the mesh.
125
+ diagonals (List[Diagonal]): List of Diagonal objects.
126
+ """
127
+ mesh_info: MeshInfo
128
+ diagonals: List[Diagonal] = field(default_factory=list)
129
+
130
+ def append(self, diagonal: Diagonal) -> DiagonalSet:
131
+ """
132
+ Appends a Diagonal to the set.
133
+
134
+ Args:
135
+ diagonal (Diagonal): The diagonal to append.
136
+
137
+ Returns:
138
+ DiagonalSet: The updated DiagonalSet.
139
+ """
125
140
  self.diagonals.append(diagonal)
126
141
  return self
127
142
 
128
- def concatenate(self, other_diagonal_set: 'DiagonalSet') -> 'DiagonalSet':
129
- self.diagonals += other_diagonal_set.diagonals
143
+ def concatenate(self, other_diagonal_set: DiagonalSet) -> DiagonalSet:
144
+ """
145
+ Concatenates another DiagonalSet to this one.
130
146
 
147
+ Args:
148
+ other_diagonal_set (DiagonalSet): The other DiagonalSet to concatenate.
149
+
150
+ Returns:
151
+ DiagonalSet: The updated DiagonalSet.
152
+ """
153
+ self.diagonals += other_diagonal_set.diagonals
131
154
  return self
132
155
 
133
156
  def get_row_nan_bool(self) -> numpy.ndarray:
134
157
  """
135
- Returns a bool array with True where the associated rows has a numpy.nan value.
158
+ Returns a boolean array with True where the associated rows have a NaN value.
136
159
 
137
- :returns: The nan index.
138
- :rtype: numpy.ndarray
160
+ Returns:
161
+ numpy.ndarray: Boolean array indicating NaN rows.
139
162
  """
140
163
  nan_index = self.get_nan_index()
141
-
142
164
  nan_rows = self.triplet.rows[nan_index]
143
165
  nan_index = numpy.isin(self.triplet.rows, nan_rows)
144
-
145
166
  return nan_index
146
167
 
147
168
  def get_list_of_nan_rows(self) -> numpy.ndarray:
148
- nan_index = numpy.isnan(self.triplet.values)
169
+ """
170
+ Gets a list of rows containing NaN values.
149
171
 
172
+ Returns:
173
+ numpy.ndarray: Array of rows with NaN values.
174
+ """
175
+ nan_index = numpy.isnan(self.triplet.values)
150
176
  nan_rows = self.triplet.rows[nan_index]
151
-
152
177
  return numpy.unique(nan_rows)
153
178
 
154
179
  def get_list_of_not_nan_rows(self) -> numpy.ndarray:
155
180
  """
156
- Gets the row list where no nan value is associated.
181
+ Gets a list of rows without NaN values.
157
182
 
158
- :returns: The list of not nan rows.
159
- :rtype: numpy.ndarray
183
+ Returns:
184
+ numpy.ndarray: Array of rows without NaN values.
160
185
  """
161
186
  nan_rows = self.get_list_of_nan_rows()
162
-
163
187
  non_nan_index = ~numpy.isin(self.triplet.rows, nan_rows)
164
-
165
188
  non_nan_rows = self.triplet.rows[non_nan_index]
166
-
167
189
  return non_nan_rows
168
190
 
169
191
  def get_nan_index(self) -> numpy.ndarray:
192
+ """
193
+ Gets a boolean array indicating the indices of NaN values in the triplet.
194
+
195
+ Returns:
196
+ numpy.ndarray: Boolean array indicating NaN indices.
197
+ """
170
198
  return numpy.isnan(self.triplet.values)
171
199
 
172
200
  def get_array_from_rows(self, rows: numpy.ndarray) -> numpy.ndarray:
173
201
  """
174
- Returns the array element which for which the rows is in the given rows input
202
+ Returns the array elements for the specified rows.
175
203
 
176
- :param rows: The rows to search for
177
- :type rows: numpy.ndarray
204
+ Args:
205
+ rows (numpy.ndarray): The rows to search for.
178
206
 
179
- :returns: The array from rows.
180
- :rtype: numpy.ndarray
207
+ Returns:
208
+ numpy.ndarray: The array elements corresponding to the specified rows.
181
209
  """
182
210
  rows_index = numpy.isin(self.triplet.rows, rows)
183
-
184
211
  return self.triplet.array[rows_index]
185
212
 
186
- def remove_nan_rows(self) -> 'DiagonalSet':
187
- nan_rows = self.get_row_nan_bool()
213
+ def remove_nan_rows(self) -> DiagonalSet:
214
+ """
215
+ Removes rows containing NaN values from the triplet.
188
216
 
217
+ Returns:
218
+ DiagonalSet: The updated DiagonalSet with NaN rows removed.
219
+ """
220
+ nan_rows = self.get_row_nan_bool()
189
221
  return self.remove_rows(rows=nan_rows)
190
222
 
191
- def remove_rows(self, rows: numpy.ndarray) -> 'DiagonalSet':
192
- index_to_remove = numpy.isin(self.triplet.rows, rows)
223
+ def remove_rows(self, rows: numpy.ndarray) -> DiagonalSet:
224
+ """
225
+ Removes the specified rows from the triplet.
193
226
 
194
- self.triplet.array = numpy.delete(
195
- arr=self.triplet.array,
196
- obj=index_to_remove,
197
- axis=0
198
- )
227
+ Args:
228
+ rows (numpy.ndarray): The rows to remove.
199
229
 
230
+ Returns:
231
+ DiagonalSet: The updated DiagonalSet with the specified rows removed.
232
+ """
233
+ index_to_remove = numpy.isin(self.triplet.rows, rows)
234
+ self.triplet.array = numpy.delete(self.triplet.array, index_to_remove, axis=0)
200
235
  return self
201
236
 
202
- def replace_nan_rows_with(self, other: 'DiagonalSet') -> 'DiagonalSet':
237
+ def replace_nan_rows_with(self, other: DiagonalSet) -> DiagonalSet:
203
238
  """
204
- Replace the nan rows in self for the equivalent rows in the other_diagonal_set if any.
239
+ Replaces NaN rows in this DiagonalSet with the equivalent rows from another DiagonalSet.
205
240
 
206
- :param other_diagonal_set: The other diagonal set
207
- :type other_diagonal_set: 'DiagonalSet'
241
+ Args:
242
+ other (DiagonalSet): The other DiagonalSet to source non-NaN rows from.
208
243
 
209
- :returns: The self instance
210
- :rtype: 'DiagonalSet'
244
+ Returns:
245
+ DiagonalSet: The updated DiagonalSet with NaN rows replaced.
211
246
  """
212
247
  self_nan_rows = self.get_list_of_nan_rows()
213
-
214
248
  other_not_nan_rows = other.get_list_of_not_nan_rows()
215
-
216
249
  replace_rows = numpy.intersect1d(self_nan_rows, other_not_nan_rows)
217
-
218
250
  self.remove_rows(replace_rows)
219
-
220
251
  add_array = other.get_array_from_rows(self_nan_rows)
221
-
222
252
  self.triplet.append_array(add_array)
253
+ return self
254
+
255
+ def initialize_triplet(self) -> DiagonalSet:
256
+ """
257
+ Initializes the triplet by combining all diagonals in the set.
223
258
 
224
- def initialize_triplet(self) -> 'DiagonalSet':
259
+ Returns:
260
+ DiagonalSet: The initialized DiagonalSet.
261
+ """
225
262
  triplet = Triplet(
226
- array=[0, 0, 0],
263
+ array=numpy.array([0, 0, 0]),
227
264
  shape=self.mesh_info.shape
228
265
  )
229
-
230
266
  for diagonal in self.diagonals:
231
267
  diagonal.compute_triplet()
232
268
  triplet += diagonal.triplet
233
-
234
269
  self.triplet = triplet
235
-
236
270
  return self
237
271
 
238
272
  def get_lowest_nan(self) -> int:
239
- nan_index = self.get_nan_index()
240
-
241
- rows = self.triplet[nan_index]
273
+ """
274
+ Gets the lowest row index containing a NaN value.
242
275
 
276
+ Returns:
277
+ int: The lowest row index with a NaN value.
278
+ """
279
+ nan_index = self.get_nan_index()
280
+ rows = self.triplet.rows[nan_index]
243
281
  return rows.min()
244
282
 
245
283
  def get_highest_nan(self) -> int:
284
+ """
285
+ Gets the highest row index containing a NaN value.
286
+
287
+ Returns:
288
+ int: The highest row index with a NaN value.
289
+ """
246
290
  nan_index = self.get_nan_index()
291
+ rows = self.triplet.rows[nan_index]
292
+ return rows.max()
247
293
 
248
- rows = self.triplet[nan_index]
294
+ def __add__(self, other: DiagonalSet) -> DiagonalSet:
295
+ """
296
+ Adds another DiagonalSet to this one.
249
297
 
250
- return rows.max()
298
+ Args:
299
+ other (DiagonalSet): The other DiagonalSet to add.
251
300
 
252
- def __add__(self, other: 'DiagonalSet') -> 'DiagonalSet':
301
+ Returns:
302
+ DiagonalSet: The updated DiagonalSet.
303
+ """
253
304
  self.diagonals += other.diagonals
254
-
255
305
  return self
256
306
 
257
- def plot(self):
307
+ def plot(self) -> None:
308
+ """
309
+ Plots the Triplet instance.
310
+
311
+ Returns:
312
+ None
313
+ """
258
314
  return self.triplet.plot()
259
315
  # -