On 13 October 2014 20:39, <[email protected]> wrote:
>
> 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.
Here is a quick stab at an example.
type Bar
i::Vector{Float64}
end
Bar() = Bar(rand(17))
type Foo
a::Int
b::Matrix{Bar}
end
function Foo()
b = Array(Bar, 17, 17)
for j in 1:size(b, 2)
for i in 1:size(b, 1)
b[i, j] = Bar()
end
end
Foo(4711, b)
end
Hopefully this helps.
Pontus