Skip to content

Commit af5571d

Browse files
committed
api: make eye_() public — rename from _eye_() to eye_()
Downstream code (genesis solver) needs to call eye_() on tile instances. Unlike _load/_store which have slice-syntax equivalents, eye_() has no alternative public API, so it should be public.
1 parent 38ea39f commit af5571d

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

docs/source/user_guide/tile16.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ For padding partial tiles in blocked algorithms:
6565

6666
```python
6767
t = Tile.eye() # create a new identity tile
68-
t._eye_() # or reset an existing tile to identity in-place
68+
t.eye_() # or reset an existing tile to identity in-place
6969
```
7070

7171
Each thread sets its diagonal element to 1.0 and all others to 0.0.
@@ -151,7 +151,7 @@ Not all GPU backends support f64. Use `test_utils.skip_if_f64_unsupported()` in
151151
| `t[:] = arr[i, r0:r1, c0:c1]` | Load from 3D array |
152152
| `arr[r0:r1, c0:c1] = t` | Store to 2D array |
153153
| `arr[i, r0:r1, c0:c1] = t` | Store to 3D array |
154-
| `t._eye_()` | Set to identity matrix (in-place) |
154+
| `t.eye_()` | Set to identity matrix (in-place) |
155155
| `t -= qd.outer(v, v)` | Symmetric rank-1 subtract |
156156
| `t -= qd.outer(a, b)` | General rank-1 subtract |
157157
| `t.cholesky_(eps)` | In-place Cholesky factorization |

python/quadrants/lang/simt/_tile16.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: ... # noqa: E704
2727
def zeros(cls) -> _Tile16x16Proto: ... # noqa: E704
2828
@classmethod
2929
def eye(cls) -> _Tile16x16Proto: ... # noqa: E704
30-
def _eye_(self) -> None: ... # noqa: E704
30+
def eye_(self) -> None: ... # noqa: E704
3131
def cholesky_(self, eps: Any) -> None: ... # noqa: E704
3232
def solve_triangular_(self, B: _Tile16x16Proto, lower: bool = True) -> None: ... # noqa: E704
3333
def _load(self, arr: Any, row_start: Any, row_end: Any, col_start: Any, col_end: Any) -> None: ... # noqa: E704
@@ -299,7 +299,7 @@ def _store3d(self, arr: qd.template(), batch, row_start, row_stop, col_start, co
299299
arr[batch, row, col_start + j] = self._get_col(j)
300300

301301
@qd.func
302-
def _eye_(self):
302+
def eye_(self):
303303
"""Set this tile to the 16x16 identity matrix. Each thread sets its diagonal element to 1.0 and all
304304
others to 0.0."""
305305
tid = qd.simt.subgroup.invocation_id()
@@ -507,7 +507,7 @@ def _augassign(self, other: Any, op: str) -> None:
507507
@qd.func
508508
def _eye():
509509
t = result()
510-
t._eye_() # type: ignore[reportAttributeAccessIssue]
510+
t.eye_() # type: ignore[reportAttributeAccessIssue]
511511
return t
512512

513513
result.eye = _eye # type: ignore[reportAttributeAccessIssue]

tests/python/test_tile16.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def k1(src_arr: Ann, dst_arr: Ann):
9696
for _ in range(_TILE):
9797
t = qd.simt.Tile16x16.zeros(dtype=qd_dtype)
9898
t[:] = src_arr[0:_TILE, 0:_TILE]
99-
t._eye_()
99+
t.eye_()
100100
dst_arr[0:_TILE, 0:_TILE] = t
101101

102102
data = np.arange(_TILE * _TILE, dtype=np_dtype).reshape(_TILE, _TILE) + 100.0

0 commit comments

Comments
 (0)