Hi Pontus,

Thank you for this very clear (!) example. I have worked hours on 
implementing my composite type, but the Julia documentation is not 
particularly informative on more difficult composite types (like mine). 
Could you/or anyone else please explain how to initialize a composite type 
that contains a matrix of another composite type? See below. Any help is 
enormously appreciated. 

Cheers,
Marcel


type Draw 
 efficiency      :: Float64
 V                 :: Vector{Float64}
 expV            :: Vector{Float64}
 sumExpV     :: Vector{Float64}
 P                 :: Vector{Float64}
 PdX             :: Matrix{Float64}
 SumPdX      :: Matrix{Float64}
 ZZ               :: Matrix{Float64}

 Draw(nrTasks,nrParameters)=new( 99,
                                            zeros(14*nrTasks),
                                            zeros(14*nrTasks),
                                            zeros(14*nrTasks),
                                            zeros(14*nrTasks),
                                            zeros(14*nrTasks, nrParameters),
                                            zeros(14*nrTasks, nrParameters),
                                            zeros(nrParameters, 
nrParameters))
end


type Design
 efficiency :: float64
 design     :: Array{Float64}
 X             :: Array{Float64}
 dX           :: Array{Float64}
 draws      :: Matrix{Draw}
 
 Design(nrDraws, nrSubdesigns, nrTasks, nrParameters)=new( 99,
                                                                           
        zeros(nrTasks,12,nrSubdesigns),
                                                                         
          zeros(14*nrTasks,nrParameters,nrSubdesigns),
                                                                        
           zeros(14*nrTasks,nrParameters,nrSubdesigns),
                                                                         
          [Draw(nrTasks,nrParameters) for ... ] ) * # Create a Matrix of 
type "Draw" with dimensions [nrSubdesigns, nrDraws]* *??*
end


design = [Design(nrDraws, nrSubdesigns, nrTasks, nrParameters) for i in 
1:33]



Reply via email to