Hmm, tried my luck ... but

If I add this to bitarray.jl

find(B::BitArray) = find(Int[], B::BitArray)

function find(indexes, B::BitArray)
    l = length(B)
    nnzB = countnz(B)
#    I = Array(Int, nnzB)
    I = similar(indexes, nnzB)

it works but I also get these strange warnings when rebuilding. And I say 
strange because I don't even find any *findbitarray.jl* in my Julia 
instalation

Warning: New definition
    findbitarray.jl
 could not show value of type Tupleintset.jl
 at bitarray.jl:1330dict.jl

is ambiguous with:
    findset.jl
 could not show value of type Tuplehashing.jl
 at array.jl:1052iterator.jl
.
To fix, define
    findinference.jl
 could not show value of type Tupleosutils.jl

before the new definition.
char.jl
Warning: New definition
    findascii.jl
 could not show value of type Tupleutf8.jl
 at bitarray.jl:1330utf16.jl

is ambiguous with:
    findutf32.jl
 could not show value of type Tupleiobuffer.jl
 at array.jl:1077string.jl
.
To fix, define
    findutf8proc.jl
 could not show value of type Tupleregex.jl






Domingo, 13 de Julho de 2014 19:52:48 UTC+1, Tim Holy escreveu:
>
> But actually your point is a good one, and is one more argument for 
> https://github.com/JuliaLang/julia/issues/1115 
> Over time more and more functions have been modified to have this type of 
> interface, so certainly there is room for a 
>     find!(indexes, testf::Function, x) 
> function. `find` could then be written as 
>     find(testf::Function, x) = find!(Int[], testf, x) 
>
> Since this matters to you, care to prepare a pull request for this and any 
> others that annoy you? 
>
> --Tim 
>
> On Sunday, July 13, 2014 11:38:46 AM J Luis wrote: 
> > Thanks. That's what I intend to do but I confess that I find the default 
> to 
> > Int64 a bit annoying (for example when writing wrappers to C functions 
> whre 
> > the Int(s) arguments are almost never Int64) 
> > 
> > Domingo, 13 de Julho de 2014 10:50:12 UTC+1, Tim Holy escreveu: 
> > > If this really matters to you, check out the implementations of find 
> in 
> > > base/array.jl. It's so short, you can trivially implement whatever 
> > > behavior 
> > > you want. For example, you could pass in an empty output array and 
> have it 
> > > push! the indexes into it. 
> > > 
> > > --Tim 
> > > 
> > > On Saturday, July 12, 2014 12:43:29 PM J Luis wrote: 
> > > > > julia> find(x->x>5,a) 
> > > > > 
> > > > > 5-element Array{Int64,1}: 
> > > > >   1 
> > > > >   2 
> > > > >   7 
> > > > >   8 
> > > > >   
> > > > >  10 
> > > > 
> > > > which very very sadly are Int64. When dealing with large matrices 
> this 
> > > 
> > > may 
> > > 
> > > > lead to a large memory waste. These almost mandatory 64 bits issue 
> is 
> > > 
> > > one 
> > > 
> > > > the things that annoyed me more in Matlab for many times it was the 
> > > > difference between having something work ... or not 
>
>

Reply via email to