So I have two modules that I wrote, SparseRowEchelon.jl
and SparseBasis.jl
.
SparseRowEchelon
includes a struct
that is also used in SparseBasis
, and this causes a problem when my main file tries to call a function in SparseBasis
.
SparseRowEchelon.jl
looks like this:
module SparseRowEchelon
export foo, SparseRREF
using SparseArrays
struct SparseRREF
T::Vector{SparseVector}
isPiv::BitArray
end
# some functions, including foo()
end
and SparseBasis.jl
looks like this
module SparseBasis
using SparseArrays
include("SparseRowEchelon.jl")
using .SparseRowEchelon
export get_spbasis
function get_spbasis(sparse_rref::SparseRREF)
# blah blah blah
end
end
So SparseBasis
is using a struct that I defined in SparseRowEchelon
.
The problem is when I go to use these modules in another file, called modeling.jl
.
include("SparseRowEchelon.jl")
using .SparseRowEchelon
my_sparce_rref = foo() # does a thing that returns type `SparseRREF`
include("SparseBasis.jl")
using .SparseBasis
get_spbasis(my_sparce_rref)
This returns the error that they cannot find method get_spbasis
.
MethodError: no method matching get_spbasis(::SparseRREF)
Closest candidates are:
get_spbasis(!Matched::Main.SparseBasis.SparseRowEchelon.SparseRREF) at [path to SparseBasis.jl]:10
That is the method I want it to use, but why doesn’t it want to use it? And how can I fix it?
Thanks!