I was wondering if there was an easy way to get searchsorted to be "right-continuous" instead of "left-continuous". By continuity, I am talking about the continuity of the function "count" below...
import numpy as N
x = N.arange(20) x.searchsorted(9) 9 import numpy as N
x = N.arange(20)
def count(u): ... return x.searchsorted(u) ... count(9) 9 count(9.01) 10
Thanks, Jonathan -- ------------------------------------------------------------------------ I'm part of the Team in Training: please support our efforts for the Leukemia and Lymphoma Society! http://www.active.com/donate/tntsvmb/tntsvmbJTaylor GO TEAM !!! ------------------------------------------------------------------------ Jonathan Taylor Tel: 650.723.9230 Dept. of Statistics Fax: 650.725.8977 Sequoia Hall, 137 www-stat.stanford.edu/~jtaylo 390 Serra Mall Stanford, CA 94305
Jonathan, I had a patch for this that applied to numarray way back when. If folks feel there is a need, I could probably try to get it running on numpy. Bit of a learning curve (for me), though. Chuck On 6/2/06, Jonathan Taylor <jonathan.taylor@stanford.edu> wrote:
I was wondering if there was an easy way to get searchsorted to be "right-continuous" instead of "left-continuous".
By continuity, I am talking about the continuity of the function "count" below...
import numpy as N
x = N.arange(20) x.searchsorted(9) 9 import numpy as N
x = N.arange(20)
def count(u): ... return x.searchsorted(u) ... count(9) 9 count(9.01) 10
Thanks,
Jonathan
-- ------------------------------------------------------------------------ I'm part of the Team in Training: please support our efforts for the Leukemia and Lymphoma Society!
http://www.active.com/donate/tntsvmb/tntsvmbJTaylor
GO TEAM !!!
------------------------------------------------------------------------ Jonathan Taylor Tel: 650.723.9230 Dept. of Statistics Fax: 650.725.8977 Sequoia Hall, 137 www-stat.stanford.edu/~jtaylo 390 Serra Mall Stanford, CA 94305
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
participants (2)
-
Charles R Harris -
Jonathan Taylor