Skip to content

Commit b2600f1

Browse files
committed
fixed minor errors
1 parent 1f1ef48 commit b2600f1

File tree

3 files changed

+203
-133
lines changed

3 files changed

+203
-133
lines changed

docs/src/man/discreteInput.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Thus, the parameters that describe the factor graph structure are represented by
2121
#### Build the graphical model by passing arguments
2222
Let us observe the following joint probability density function:
2323
```math
24-
g(\mathcal{X}) = p_1(x_1)p_2(x_1|x_2)p_3(x_1|x_2,x_3),
24+
g(\mathcal{X}) \propto p_1(x_1)p_2(x_1|x_2)p_3(x_1|x_2,x_3),
2525
```
2626
where all variables have two states ``1`` and ``2``. The conditional probability tables can be written in the compact form:
2727

src/discretegraph.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
mutable struct DiscreteSystem
22
probability::Vector{Vector{Int64}}
33
table::Vector{Array{Float64, N} where N}
4-
jacobian::SparseMatrixCSC{Float64,Int64}
5-
jacobianTranspose::SparseMatrixCSC{Float64,Int64}
4+
incidence::SparseMatrixCSC{Float64,Int64}
5+
incidenceTranspose::SparseMatrixCSC{Float64,Int64}
66
data::String
77
end
88

@@ -82,9 +82,9 @@ function readDiscreteArguments(args)
8282
table = args[2]
8383
end
8484

85-
jacobian, jacobianTranspose = incidenceMatrix(probability)
85+
incidence, incidenceTranspose = incidenceMatrix(probability)
8686

87-
return DiscreteSystem(probability, table, jacobian, jacobianTranspose, "noname")
87+
return DiscreteSystem(probability, table, incidence, incidenceTranspose, "noname")
8888
end
8989

9090
########## Load from HDF5 or XLSX files ##########
@@ -152,12 +152,12 @@ function readDiscreteFile(args)
152152
error("The input data is not a valid format.")
153153
end
154154

155-
jacobian, jacobianTranspose = incidenceMatrix(probability)
155+
incidence, incidenceTranspose = incidenceMatrix(probability)
156156

157-
return DiscreteSystem(probability, table, jacobian, jacobianTranspose, dataname)
157+
return DiscreteSystem(probability, table, incidence, incidenceTranspose, dataname)
158158
end
159159

160-
########## Form incidence matrix ##########
160+
########## Incidence matrix ##########
161161
function incidenceMatrix(probabilities)
162162
row = Int64[]; col = Int64[]
163163

@@ -167,16 +167,16 @@ function incidenceMatrix(probabilities)
167167
push!(col, variable)
168168
end
169169
end
170-
jacobian = sparse(row, col, 1)
171-
jacobianTranspose = sparse(col, row, 1)
170+
incidence = sparse(row, col, 1)
171+
incidenceTranspose = sparse(col, row, 1)
172172

173-
return jacobian, jacobianTranspose
173+
return incidence, incidenceTranspose
174174
end
175175

176176
########## Produce the graphical model ##########
177177
function makeDiscreteTreeGraph(system, virtualMessage, root)
178178
### Number of factor and variable nodes
179-
Nfactor, Nvariable = size(system.jacobian)
179+
Nfactor, Nvariable = size(system.incidence)
180180

181181
### Pass through probabilities
182182
Nlink = 0

0 commit comments

Comments
 (0)