Skip to content

Commit

Permalink
slightly simpler code
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelDavidMohr committed May 15, 2023
1 parent 22d7059 commit 0e76c13
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Modules/ModulesGraded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -981,13 +981,13 @@ function Base.show(io::IO, b::BettiTable)
end
col_keys = sort(unique((k -> k[1]).(keys(bt_table))))
row_keys = sort(unique((k -> k[2]).(keys(bt_table))), by = x -> first(x.coeff))
mat = Array{Int}(undef, (length(row_keys)+1, length(col_keys)))
for i in 1:size(mat,1)-1
mat = Array{Int}(undef, (length(row_keys), length(col_keys)))
for i in 1:size(mat,1)
for j in 1:size(mat,2)
mat[i, j] = get(bt_table, (col_keys[j], row_keys[i]), 0)
end
end
mat[end, :] = (sum).([mat[1:end-1, j] for j in 1:length(col_keys)])
mat = vcat(mat, sum(mat, dims=1))
pretty_table(io, (BettiTableIntWrapper).(mat),
tf = tf_mysql,
vlines = [1],
Expand Down

0 comments on commit 0e76c13

Please sign in to comment.