File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -151,12 +151,8 @@ def _compute_diagonal(
151
151
n_A = T_A .shape [0 ]
152
152
n_B = T_B .shape [0 ]
153
153
m_inverse = 1.0 / m
154
- m_inverse_half = 0.5 * m_inverse
155
-
156
154
constant = (m - 1 ) * m_inverse * m_inverse # (m - 1)/(m * m)
157
155
158
- x = np .empty (m , dtype = np .float64 )
159
- y = np .empty (m , dtype = np .float64 )
160
156
for diag_idx in range (diags_start_idx , diags_stop_idx ):
161
157
k = diags [diag_idx ]
162
158
@@ -197,16 +193,15 @@ def _compute_diagonal(
197
193
if pearson > ρ [thread_idx , i , 0 ] or (
198
194
ignore_trivial and pearson > ρ [thread_idx , i + k , 0 ]
199
195
):
200
- x [:] = (T_A [ i : i + m ] - μ_Q [ i ]) * σ_Q_inverse [ i ]
201
- y [:] = ( T_B [ i + k : i + k + m ] - M_T [ i + k ]) * Σ_T_inverse [
202
- i + k
203
- ]
204
- D_squared = (
205
- np . sum ( np . square ( x ))
206
- + np . sum ( np . square ( y ))
207
- - 2 * np . dot ( x , y )
196
+ pearson = (
197
+ np . dot (
198
+ ( T_B [ i + k : i + k + m ] - M_T [ i + k ]),
199
+ ( T_A [ i : i + m ] - μ_Q [ i ]),
200
+ )
201
+ * m_inverse
202
+ * Σ_T_inverse [ i + k ]
203
+ * σ_Q_inverse [ i ]
208
204
)
209
- pearson = 1.0 - m_inverse_half * D_squared
210
205
211
206
if pearson > 1.0 :
212
207
pearson = 1.0
You can’t perform that action at this time.
0 commit comments