Boring but non allocating like list comprehension and anonymous function:
m = typemin(Int16)
for TUnit in TUnitS
m = max(m,TUnit.tau_max)
end
On Thursday, May 7, 2015 at 5:49:49 PM UTC+2, Michela Di Lullo wrote:
>
> Hello everyone,
>
> I have to compute the maximum value of tau_max, attribute of TUnit which
> is declared as follows:
>
> immutable TUnit
>
> Node::Int16
>
> a::Float64
>
> b::Float64
>
> c::Float64
>
> inf::Float64
>
> sup::Float64
>
> ton::Int16
>
> toff::Int16
>
> storia0::Int16
>
> pt0::Float64
>
> rampa_up::Float64
>
> rampa_dwn::Float64
>
> rampa_up_str::Float64
>
> rampa_dwn_str::Float64
>
> SUC_C::Float64
>
> tau_max::Int16
>
> end
>
>
> TUnitS = Array(TUnit,size(generators,1))
>
>
> for j in 1:size(generators,1)
>
> #println(generators[j,1:end])
>
> #FL:This call the contructor, see all the discussion in the manual
> "Parametric Constructors" section
>
> #to understand the whole (complex story) of the syntax with "..."
>
> TUnitS[j] = TUnit(generators[j,1:end]...)
>
> println("TUnit = ", j, "\t Node[$j]= ", TUnitS[j].Node, "\t a[$j] = ",
> TUnitS[j].a, "\t ...", "\t tau_max[$j] = ", TUnitS[j].tau_max)
>
> end
>
>
> I tried with both maximum(TUnitS.tau_max) and maximum(TUnitS[j].tau_max,
> j=[1:gmax]), but it doesn't work..
>
>
> Any idea about how to make it?
>
>
> Thank you very much for any suggestion,
>
>
> Michela
>