[julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Fred
Hi, I have a this kind of data structure : type Ions_frag{} mz::Float64 intensity::Float64 charge::Int64 end I read in performance tips that it is better to define the type of the data structure but I cannot find the good one for my data structure. I tried : type Ions_frag{DataType}

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Yichao Yu
On Tue, Jul 12, 2016 at 10:56 AM, Fred wrote: > Hi, > > I have a this kind of data structure : > > type Ions_frag{} > mz::Float64 > intensity::Float64 > charge::Int64 > end > > > I read in performance tips that it is better to define the type of the data Which one are you referring to? > s

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Fred
I am referring to all 3, ie the type of Ions_frag :) Initially I used : type Ions_frag mz::Float64 intensity::Float64 charge::Int64 end and it works. But, after reading the documentation I "understood" that it is not optimal in performances. Le mardi 12 juillet 2016 16:59:57 UTC+2, Y

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Yichao Yu
On Tue, Jul 12, 2016 at 11:10 AM, Fred wrote: > I am referring to all 3, ie the type of Ions_frag :) Well, can you quote the performance tip? There's nothing wrong with the type you are using in terms of performance so I'd like to know which part of the doc is misleading. > Initially I used : >

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Jeffrey Sarnoff
You may be misreading the guidance. There is no advantage to putting a parameter into the type when that parameter is not used anywhere. type Ions_frag mz::Float64 intensity::Float64 charge::Int64 end if your use involves changing the fields' values after creating an ions_frag typed

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Fred
I use a dictionary to store values : for example : d = Dict() d["key1"] = Ions_frag(501.5, 1500, 3) Then to obtain the values : d["key1"].mz # = 501.5 My problem was to store many values in one object. So I found this solution, I don't know if it is the best and I hope this approach is corr

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Fred
I tried that "change" because of this part of the documentation (in http://docs.julialang.org/en/release-0.4/manual/performance-tips/) : For example: julia> type MyType{T<:AbstractFloat} a::T end This is a better choice than julia> type MyStillAmbiguousType a::AbstractF

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Yichao Yu
On Tue, Jul 12, 2016 at 12:23 PM, Fred wrote: > I tried that "change" because of this part of the documentation (in > http://docs.julialang.org/en/release-0.4/manual/performance-tips/) : > > For example: > > julia> type MyType{T<:AbstractFloat} > a::T >end > This is a better choic

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Tim Holy
What might be missing is to note the important difference between abstract and concrete types. Otherwise it might indeed be interpreted as advice to use curly-brackets in your type definitions. Best, --Tim On Tuesday, July 12, 2016 12:36:28 PM CDT Yichao Yu wrote: > On Tue, Jul 12, 2016 at 12:2

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Fred
Thank you very much Yichao, Tim and Jeffrey for your answers ! I try to summarize. If I understand well, this type definition is correct and gives the maximum performances : type Ions_frag mz::Float64 intensity::Float64 charge::Int64 end But if I use : d = Dict() d["key1"] = Ions_f

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Yichao Yu
On Tue, Jul 12, 2016 at 1:21 PM, Fred wrote: > Thank you very much Yichao, Tim and Jeffrey for your answers ! > > I try to summarize. If I understand well, this type definition is correct > and gives the maximum performances : It is the best for performance in terms of the field types. If you rep

Re: [julia-users] How to determine the type of a complex data structure

2016-07-12 Thread Fred
Thank you very much Yichao, I will try : Dict{Any,Ions_frag} and immutable Ions_frag mz::Float64 intensity::Float64 charge::Int64 end

Re: [julia-users] How to determine the type of a complex data structure

2016-07-20 Thread Fred
Hi ! Here are the results : type Ions_frag{} mz::Float64 intensity::Float64 charge::Int64 end computation time : 26.88 s immutable Ions_frag mz::Float64 intensity::Float64 charge::Int64 end computation time : 27.00 s Ions = Dict{ASCIIString, Ions_frag}() immutable Ion