MCPcopy Create free account
hub / github.com/dcharatan/flowmap / round_values

Function round_values

paper/table.py:10–21  ·  view source on GitHub ↗

Round values to the specified precision.

(
    values: Float[np.ndarray, "row col"],
    precisions: Int[np.ndarray, " col"],
)

Source from the content-addressed store, hash-verified

8
9
10def round_values(
11 values: Float[np.ndarray, "row col"],
12 precisions: Int[np.ndarray, " col"],
13) -> Float[np.ndarray, "row col"]:
14 """Round values to the specified precision."""
15 quantized = np.zeros_like(values)
16 r, _ = values.shape
17 precisions = repeat(precisions, "c -> r c", r=r)
18 for precision in np.unique(precisions):
19 mask = precisions == precision
20 quantized[mask] = np.round(values[mask], precision)
21 return quantized
22
23
24def compute_ranks_for_column(

Callers 1

make_latex_tableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected