@@ -53,35 +53,36 @@ for z in 1:length(allmatrices_md.content[1].rows)
5353 mtx_copy = copy(A)
5454
5555 @info "$n × $n"
56- n > 500 && error("Skipping too large matrices")
56+ n > 100 && error("Skipping too large matrices")
5757
5858 rows, cols = size(mtx_copy)
5959 new_rows = div(rows, 2)
6060 new_cols = div(cols, 2)
6161 condensed = zeros(Int, new_rows, new_cols)
6262
63- while size(condensed, 1) > 32 || size(condensed, 2) > 32
63+ while size(mtx_copy, 1) > 32 || size(mtx_copy, 2) > 32
64+
6465 rows, cols = size(mtx_copy)
6566 new_rows = div(rows, 2)
6667 new_cols = div(cols, 2)
6768 condensed = sparse(zeros(Int, new_rows, new_cols))
6869
6970 for r in 1:2:rows-1
7071 for c in 1:2:cols-1
71- block = sparse( mtx_copy[r:r+1, c: c+1])
72- condensed[div(r-1, 2) + 1, div(c-1, 2) + 1] = (length(nonzeros(block)) >= 3 ) ? 1 : 0
72+ block = mtx_copy[r:min( r+1, rows), c:min( c+1, cols)]
73+ condensed[div(r-1, 2) + 1, div(c-1, 2) + 1] = (length(nonzeros(block)) >= 2 ) ? 1 : 0
7374 end
7475 end
75-
76+
7677 mtx_copy = condensed
78+
7779 end
78-
80+
7981
8082 percentage_sparsity[z] = length(nonzeros(A)) / n^2
8183
8284 spaced_out_sparsity[z] = length(nonzeros(mtx_copy)) * percentage_sparsity[z]
8385
84-
8586
8687 b = rand(rng, n)
8788 u0 = rand(rng, n)
@@ -107,7 +108,17 @@ for z in 1:length(allmatrices_md.content[1].rows)
107108 end
108109end
109110
110- print(percentage_sparsity)
111+ percentage_sparsity = percentage_sparsity[.!isnan.(percentage_sparsity)]
112+ spaced_out_sparsity = spaced_out_sparsity[.!isnan.(spaced_out_sparsity)]
113+ spaced_out_sparsity = replace(spaced_out_sparsity, 0 => 1e-10)
114+ matrix_size = matrix_size[.!isnan.(matrix_size)]
115+ new_times = []
116+ for row in eachrow(times)
117+ if !any(isnan, row) # Check if the row does not contain NaN values
118+ push!(new_times, row) # Append the row to the list
119+ end
120+ end
121+ times = new_times
111122```
112123
113124```julia
0 commit comments