I have a fortran type I defined as mean_covar like below,
type :: mean_covar
real(kind=r8), allocatable :: mu(:,:)
real(kind=r8), allocatable :: sigma(:,:)
real(kind=r8) :: w
end type
So that I can set some variable as type Mean_covar.
I want to define the same thing in Julia, I know Julia has something called struct, with mutable property its fields can be changed. So I did a very simply thing like,
mutable struct Mean_covar
mu::Array{Float64,2}
sigma::Array{Float64,2}
w::Int64
end
Then I define,
musigma = Mean_covar(Array{Float64,2}(undef,2,2),Array{Float64,2}(undef,2,2), 0.0)
so I can then set musigma.mu as any 2d array I want.
But I just wonder, does it has to be so cumbersome when defining musigma (need to set the value of each fields)? Can I just simply do
musigma::Mean_covar
But this give me an error,
UndefVarError: musigma not defined
Thank you very much!