Skip to content

Commit 2479eff

Browse files
committed
switch to rsqrt
1 parent 4f2bbb7 commit 2479eff

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

docs/release-notes/0.15.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
```{rubric} Bug fixes
99
```
1010
* Fixes `tl.rank_genes_groups` returning NaN/zero `logfoldchanges`/`pvals` with `groups=[subset]` and `reference='rest'` {pr}`651` {smaller}`S Dicks`
11-
* Fixes float64 precision loss in the sparse Pearson-residual kernels: ``pp.normalize_pearson_residuals`` (and ``pp.highly_variable_genes`` with ``flavor='pearson_residuals'``) on CSR/CSC input divided by the single-precision intrinsic ``sqrtf``, silently capping the float64 path at ~7 significant digits {pr}`658` {smaller}`A Mikaeili`
11+
* Fixes float64 precision loss in `pp.normalize_pearson_residuals` on CSR/CSC input {pr}`658` {smaller}`A Mikaeili & S Dicks`
1212

1313
```{rubric} Misc
1414
```

src/rapids_singlecell/_cuda/pr/kernels_pr.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ __global__ void sparse_norm_res_csc_kernel(
2424
++sparse_idx;
2525
}
2626
residuals[res_index] -= mu;
27-
residuals[res_index] /= sqrt(mu + mu * mu * inv_theta);
27+
residuals[res_index] *= rsqrt(mu + mu * mu * inv_theta);
2828
// clamp to [-clip, clip]
2929
if (residuals[res_index] < -clip) residuals[res_index] = -clip;
3030
if (residuals[res_index] > clip) residuals[res_index] = clip;
@@ -53,7 +53,7 @@ __global__ void sparse_norm_res_csr_kernel(
5353
++sparse_idx;
5454
}
5555
residuals[res_index] -= mu;
56-
residuals[res_index] /= sqrt(mu + mu * mu * inv_theta);
56+
residuals[res_index] *= rsqrt(mu + mu * mu * inv_theta);
5757

5858
if (residuals[res_index] < -clip) residuals[res_index] = -clip;
5959
if (residuals[res_index] > clip) residuals[res_index] = clip;

0 commit comments

Comments
 (0)