Goode evening
I’m not familiar with Julia programming and I’m trying to run the code below that was made on Julia 0.4.5. I got two errors messages. I’m working on Julia 0.6.4 - Atom 1.29> I suppose I have to import something but I don’t know how the syntax should be. Can Somebody help?
Error in method definition: function Base.sub2ind must be explicited imported to be extended
Error in method definition: function Base.ind2sub must be explicited imported to be extended
unction sub2ind(feat_size,feat_ind)
#================================================================
Get the single index corresponding to the feature indices given
================================================================#
total_feat = length(feat_ind)
index = 0
for i in range(1,total_feat)
if i < total_feat
index = index + (feat_ind[i]-1) * prod(feat_size[i+1:end])
else
index = index + (feat_ind[i]-1)
end
end
return (index+1)
end
function ind2sub(feat_size,index)
#================================================================
Get the feature indices corresponding to the given index
================================================================#
last = length(feat_size);
subscripts = zeros(Int,length(feat_size))
index = index - 1
while last>=1
subscripts[last] = (index % feat_size[last]) + 1
index = floor(Int,index / feat_size[last])
last = last - 1;
end
return subscripts
end