Mercurial > hg > medcouple
comparison pymedcouple @ 22:f5b4a2ab6204
medcouple_1d: modify the definition of medc_idx to match R's definition
This uses the right (not left) middle in case of an even number of
things and the middle one in case of an odd number.
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sat, 17 Jan 2015 19:56:07 -0500 |
parents | d63e763f8ac1 |
children | 29a178b23219 |
comparison
equal
deleted
inserted
replaced
21:d63e763f8ac1 | 22:f5b4a2ab6204 |
---|---|
151 L = [0]*n_plus | 151 L = [0]*n_plus |
152 R = [n_minus - 1]*n_plus | 152 R = [n_minus - 1]*n_plus |
153 | 153 |
154 Ltot = 0 | 154 Ltot = 0 |
155 Rtot = n_minus*n_plus | 155 Rtot = n_minus*n_plus |
156 medc_idx = (Rtot - 1)//2 | 156 medc_idx = Rtot//2 |
157 | 157 |
158 # kth pair algorithm (Johnson & Mizoguchi) | 158 # kth pair algorithm (Johnson & Mizoguchi) |
159 while Rtot - Ltot > n_plus: | 159 while Rtot - Ltot > n_plus: |
160 | 160 |
161 # First, compute the median inside the given bounds | 161 # First, compute the median inside the given bounds |