thanks kevin,
that just cut my run time into half! brilliant.

I'm sure other users would benefit from adding this to the documentation.
then there's so many places where to add documentation in julia that it's
hard to even think about where to start. :-)

cheers
florian


On 14 July 2014 22:01, Kevin Squire <kevin.squ...@gmail.com> wrote:

> For the Ordering parameter, you can use Base.Forward or Base.Reverse.
>
> The plan is for this parameter to go away eventually, to be replaced by,
> e.g., a function (as you tried).  However, there is no specialization on
> functions right now, so the generated code is pretty slow.
>
> Generally, the assumption is that these functions are mostly for internal
> use, and that most people won't be using these versions of the functions,
> so they're not documented.  But your use case seems reasonable.  In fact,
> we could probably add a default value of Base.Forward for the ordering.
>
> You may not need this information, but there are other orderings that are
> specialized for different circumstances (Lexicographic, By, LT, Perm, Left,
> Right), which are used for sorting (and searching) under specific
> circumstances, and each of which has a version of `Base.lt` ("less than")
> defined.
>
> It's also possible to define your own orderings for special circumstances.
>  For example, DataFrames has it's own ordering for sorting the columns of a
> DataFrame.
>
> Cheers,
>    Kevin
>
>
> On Mon, Jul 14, 2014 at 12:50 PM, Florian Oswald <florian.osw...@gmail.com
> > wrote:
>
>> hi all,
>>
>> i'm looking for ways to speed up an operation where i have an ordered
>> array v, and to each index i of v I want to apply searchsortedlast(a,v[i]),
>> where a is another array. obviously i know from v being increasingly
>> ordererd that
>>
>> if searchsortedlast(a,v[i]) returns k
>> then searchsortedlast(a,v[i+1]) >= k
>>
>> i was wondering how to use the arguments lo::Int64,hi::Int64,o::Ordering.
>> Can I tell the function that we know the last index for v[i] already? I'd
>> like to do
>>
>>  searchsortedlast(a,v[i+1],k,n,o::Ordering)
>>
>> in particular, i don't know what to supply as an ordering. that didnt
>> work:
>>
>> *searchsortedlast(linspace(0.0,1.0,8),0.7,5,8,<)*
>>
>> thanks!
>>
>>
>

Reply via email to