Hi,
all you of good will, will you help a newbie in the throes of early learning?
I have a little script
importall adiff
v0 = variate(1.)
v1 = variate([1.,2.,3.])
show(v0)
show(v1)
and a module file
module adiff
importall Base,StaticArrays
export Adiff,variate
immutable Adiff{nd}<: Real
value ::Float64
derivative::Svector{nd}
end
function variate(a::Vector{Float64})
s = size(a)
b = Addif{s}
for i = 1:s
b.value(i) = a(i)
b.derivative(:,i) = 0.
b.derivative(i,i) = 1.
end
return b
end
variate(a::Float64) = Adiff{1}(a,Float64[1.])
function show(io::IO,a::Adiff)
x = a.value
dx = a.derivative
print(io,"Adiff(x=$x,dx=$dx)")
end
end # module adiff
Executing the script, I get “variate not defined”, which puzzles me no end. I get similar things to work on other modules, what am I doing wrong here?
Thanks for your help
Philippe
(JuliaPro 5.1.1 on Windows 7)
LoadError: UndefVarError: variate not defined
while loading C:\Users\philippem\home\GIT\julia\tests\test_adiff.jl, in expression starting on line 5
in include_string(::String, ::String) at loading.jl:441
in include_string(::Module, ::String, ::String) at eval.jl:32
in (::Atom.##59#62{String,String})() at eval.jl:81
in withpath(::Atom.##59#62{String,String}, ::String) at utils.jl:30
in withpath(::Function, ::String) at eval.jl:46
in macro expansion at eval.jl:79 [inlined]
in (::Atom.##58#61{Dict{String,Any}})() at task.jl:60