Skip to content

Commit 5105364

Browse files
committed
1 parent 8560117 commit 5105364

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/_utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ def rv(fn):
110110
def coords_to_float(r: int, c: int) -> float:
111111
"""Encode a (row,col) position as a float.
112112
113-
``r`` is placed to the left of the decimal, while ``c`` is placed to the right with its digits reversed (otherwise
114-
``(10,10)`` and ``(10,1)`` would collide).
113+
``r`` is placed to the left of the decimal, while ``c`` is placed to the right, shifted 4 places.
115114
"""
116-
return float(f"{r}.{str(c)[::-1]}")
115+
assert c < 1e4
116+
return r + c * 1e-4
117117

118118

119119
def pytorch_x_value_gen(obs_range: range, var_range: range) -> coo_matrix:
@@ -126,11 +126,11 @@ def pytorch_x_value_gen(obs_range: range, var_range: range) -> coo_matrix:
126126
assert_array_equal(
127127
pytorch_x_value_gen(range(5), range(5)),
128128
[
129-
[ 0 , 0.1 , 0 , 0.3 , 0 ],
130-
[ 1 , 0 , 1.2 , 0 , 1.4 ],
131-
[ 0 , 2.1 , 0 , 2.3 , 0 ],
132-
[ 3 , 0 , 3.2 , 0 , 3.4 ],
133-
[ 0 , 4.1 , 0 , 4.3 , 0 ],
129+
[ 0 , 0.0001 , 0 , 0.0003 , 0 ],
130+
[ 1 , 0 , 1.0002 , 0 , 1.0004 ],
131+
[ 0 , 2.0001 , 0 , 2.0003 , 0 ],
132+
[ 3 , 0 , 3.0002 , 0 , 3.0004 ],
133+
[ 0 , 4.0001 , 0 , 4.0003 , 0 ],
134134
]
135135
)
136136
```

0 commit comments

Comments
 (0)