Skip to content

Commit 8bf5f73

Browse files
testing percentage away from banded matrix
1 parent ea6a984 commit 8bf5f73

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

benchmarks/LinearSolve/MatrixDepot.jmd

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ allmatrices_md = listnames("*/*")
3333
times = fill(NaN, length(allmatrices_md.content[1].rows), length(algs))
3434
percentage_sparsity = fill(NaN, length(allmatrices_md.content[1].rows))
3535
matrix_size = fill(NaN, length(allmatrices_md.content[1].rows))
36+
bandedness = fill(NaN, length(allmatrices_md.content[1].rows))
3637
```
3738

3839
```julia
@@ -65,6 +66,22 @@ for z in 1:length(allmatrices_md.content[1].rows)
6566
times[z,j] = bt
6667
end
6768

69+
total_band_positions = 0
70+
non_zero_in_band = 0
71+
bandwidth = 5
72+
for r in 1:n
73+
for c in 1:n
74+
if abs(r - c) <= bandwidth
75+
total_band_positions += 1 # This position belongs to the band
76+
if A[r, c] != 0
77+
non_zero_in_band += 1 # This element is non-zero in the band
78+
end
79+
end
80+
end
81+
end
82+
83+
percentage_filled = non_zero_in_band / total_band_positions * 100
84+
bandedness[z] = percentage_filled
6885
#=
6986
p = bar(algnames, times[z, :];
7087
ylabel = "Time/s",
@@ -110,6 +127,18 @@ p = scatter(percentage_sparsity, times;
110127
legend = :outertopright)
111128
```
112129

130+
```julia
131+
p = scatter(bandedness, times;
132+
ylabel = "Time/s",
133+
yscale = :log10,
134+
xlabel = "Bandedness",
135+
xscale = :log10,
136+
label = algnames_transpose,
137+
title = "Factorization Time vs Bandedness",
138+
fmt = :png,
139+
legend = :outertopright)
140+
```
141+
113142
```julia
114143
p = scatter(matrix_size, times;
115144
ylabel = "Time/s",

0 commit comments

Comments
 (0)