Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
159 views
in Technique[技术] by (71.8m points)

juno ide - Julia not returning the same value when executing a function or every of its lines

I am a very new Julia user (coming from Matlab), so forgive me if I ask a very dumb question.

I currently have a julia code, which works (it runs fine) though it provides different results if I execute it as a function or if I run every of the function lines interactively. My script is mostly about linear algebra and uses Arrays and Dicts.

As I have some trouble making use of the Juno debugger, I did not find another way to debug my code, which is quite a shame.

I spent the last three hours on this and I still have no clue why these results differ. I suspect I don't understand some very basic working process of julia related to variable allocation but I'm flying blind here.

Does anyone have a explaination for this behavior ?

I can't provide the code here but here is the base structure of the code. Basically the M matrix returned by childfunction is wrong. a is a scalar a dict is a dictionary.

  • calling function
function motherfunction(...)
    M = childfunction(a,dict)
end
  • child function
function childfunction(...)
...
    M = *some linear algebra*
return M
end
question from:https://stackoverflow.com/questions/66068423/julia-not-returning-the-same-value-when-executing-a-function-or-every-of-its-lin

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...