Reputation: 1277
I am trying to use a function from LinearAlgebra.jl which is definde in the dense.jl file.
I expected it to be loaded with using LinearAlgebra
, since it is a part of the LinearAlgebra package (julia/stdlib/LinearAlgebra/src/dense.jl).
However, this seem not to be the case.
Calling a function from dense.jl throws an "UndefVarError" while functions from the main LinearAlgebra.jl file work fine.
So: How do I import/call functions from a "subpackage"?
Upvotes: 3
Views: 358
Reputation: 6086
The answer varies depending on whether the function is part of a separate module. However, in this case you may be able to prepend "LinearAlgebra." to the function name, since the problem may just be that the function was not exported by default into your namespace by the LinearAlgebra module:
julia> using LinearAlgebra
julia> isone
isone (generic function with 13 methods)
julia> _isone_cachefriendly
ERROR: UndefVarError: _isone_cachefriendly not defined
julia> LinearAlgebra._isone_cachefriendly
_isone_cachefriendly (generic function with 1 method)
Upvotes: 3