UndefVarError

Hello Everyone ,
i have been struggling with a program that doesn’t want to run on Julia version 0.7, this is the Program:

struct OrthoNNDist <: DiscreteMultivariateDistribution
	x0::Vector{Int64}
	oc::Array{Int64,2}
	x1s::Array
	prob::Float64
    #return a new uniform distribution with all vectors in x1s orthogonal to oc
	function OrthoNNDist(x0::Vector{Int}, oc::Array{Int,2})
		x1s = []
		for i = 1:size(oc)[2]
			x1 = x0 + oc[:, i]
			if nonneg(x1)
				push!(x1s, x1)
			end
			x1 = x0 - oc[:, i]
			if nonneg(x1)
				push!(x1s, x1)
			end
		end
		new(x0, oc, x1s, 1.0/length(x1s))
	end
end

Base.length(d::OrthoNNDist) = length(d.x0)

Distributions.rand(d::OrthoNNDist) = rand(d.x1s)

Distributions.pdf(d::OrthoNNDist, x::Vector) = x in d.x1s ? d.prob : 0.0
Distributions.pdf(d::OrthoNNDist) = fill(d.prob, size(d.x1s))
Distributions.logpdf(d::OrthoNNDist, x::Vector) = log(pdf(d, x))

and it shows me always UndefVarError: DiscreteMultivariateDistribution not defined

Probably you are missing

using Distributions

Please quote your code.

yeah you are right how can i do such mistake im still a beginner in Julia, it worked anyway thanks. But i still have Problems with Structures and Types i can’t know the exact difference between them and their type like abstract or concrete types or mutable and immutable…

The manual may help.

1 Like