Hi, I am using version 1.0.1 and solving a value function iteration problem in parallel. I am attempting to pass “pars” to the “pmap” function. However, I encounter the following error that I have been unable to resolve:
MethodError: no method matching Array{Float64,1}(::Array{Float64,2})
I am using Atom on Ubuntu, and the IDE flags the code in two places marked below.
Here are the relevant excerpts of the code:
# Data structure of state and exogenous variables
@everywhere struct modelState
ind::Int64 **# ERROR FLAGGED**
nϵ::Int64
nr::Int64
na::Int64
nh::Int64
T::Int64
age::Int64
Pϵ::Array{Float64,2}
Pr::Array{Float64,2}
agrid::Vector{Float64}
hgrid::Vector{Float64}
ϵgrid::Vector{Float64}
rgrid::Vector{Float64}
β::Float64
V::Array{Float64,4}
w::Float64
end
# CODE OMITTED HERE BUT ALL ELSE RUNS WELL.
for age = T:-1:1
pars = [modelState(ind,nϵ,nr,na,nh,T,age,Pϵ,Pr,agrid,hgrid,ϵgrid,rgrid,β,V_tomorrow,w) for ind in 1:na*nh*nϵ*nr]; **# ERROR FLAGGED**
s = pmap(value,pars)
for ind = 1:na*nh*nϵ*nr
ia = convert(Int, floor((ind-0.05)/(nh*nr*nϵ)))+1;
ih = convert(Int, mod(floor((ind-0.05)/(nr*nϵ)), nh))+1;
iϵ = convert(Int, mod(floor((ind-0.05)/(nr)), nϵ))+1;
ir = convert(Int, floor(mod(ind-0.05, nr))+1);
V[age, ia, ih, iϵ, ir] = s[ind]
V_tomorrow[ia, ih, iϵ, ir] = s[ind]
end
THANK YOU!!! I would appreciate any help.