You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/check.jl
+248-2Lines changed: 248 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -86,11 +86,15 @@ A partition of the columns of a symmetric matrix `A` is _symmetrically orthogona
86
86
1. the group containing the column `A[:, j]` has no other column with a nonzero in row `i`
87
87
2. the group containing the column `A[:, i]` has no other column with a nonzero in row `j`
88
88
89
+
It is equivalent to a __star coloring__.
90
+
89
91
!!! warning
90
92
This function is not coded with efficiency in mind, it is designed for small-scale tests.
91
93
92
94
# References
93
95
96
+
> [_On the Estimation of Sparse Hessian Matrices_](https://doi.org/10.1137/0716078), Powell and Toint (1979)
97
+
> [_Estimation of sparse hessian matrices and graph coloring problems_](https://doi.org/10.1007/BF02612334), Coleman and Moré (1984)
94
98
> [_What Color Is Your Jacobian? Graph Coloring for Computing Derivatives_](https://epubs.siam.org/doi/10.1137/S0036144504444711), Gebremedhin et al. (2005)
95
99
"""
96
100
functionsymmetrically_orthogonal_columns(
@@ -102,7 +106,7 @@ function symmetrically_orthogonal_columns(
102
106
end
103
107
issymmetric(A) ||returnfalse
104
108
group =group_by_color(color)
105
-
for i inaxes(A, 2), j inaxes(A, 2)
109
+
for i inaxes(A, 1), j inaxes(A, 2)
106
110
iszero(A[i, j]) &&continue
107
111
ci, cj = color[i], color[j]
108
112
check =_bilateral_check(
@@ -126,6 +130,8 @@ A bipartition of the rows and columns of a matrix `A` is _structurally biorthogo
126
130
1. the group containing the column `A[:, j]` has no other column with a nonzero in row `i`
127
131
2. the group containing the row `A[i, :]` has no other row with a nonzero in column `j`
128
132
133
+
It is equivalent to a __star bicoloring__.
134
+
129
135
!!! warning
130
136
This function is not coded with efficiency in mind, it is designed for small-scale tests.
131
137
"""
@@ -138,8 +144,8 @@ function structurally_biorthogonal(
Return `true` if coloring the columns of the symmetric matrix `A` with the vector `color` results in a partition that is substitutable, and `false` otherwise.
277
+
For all nonzeros `A[i, j]`, `rank_nonzeros[i, j]` provides its rank of recovery.
278
+
279
+
A partition of the columns of a symmetric matrix `A` is _substitutable_ if, for every nonzero element `A[i, j]`, either of the following statements holds:
280
+
281
+
1. the group containing the column `A[:, j]` has all nonzeros in row `i` ordered before `A[i, j]`
282
+
2. the group containing the column `A[:, i]` has all nonzeros in row `j` ordered before `A[i, j]`
283
+
284
+
It is equivalent to an __acyclic coloring__.
285
+
286
+
!!! warning
287
+
This function is not coded with efficiency in mind, it is designed for small-scale tests.
288
+
289
+
# References
290
+
291
+
> [_On the Estimation of Sparse Hessian Matrices_](https://doi.org/10.1137/0716078), Powell and Toint (1979)
292
+
> [_The Cyclic Coloring Problem and Estimation of Sparse Hessian Matrices_](https://doi.org/10.1137/0607026), Coleman and Cai (1986)
293
+
> [_What Color Is Your Jacobian? Graph Coloring for Computing Derivatives_](https://epubs.siam.org/doi/10.1137/S0036144504444711), Gebremedhin et al. (2005)
294
+
"""
295
+
functionsubstitutable_columns(
296
+
A::AbstractMatrix,
297
+
rank_nonzeros::AbstractMatrix,
298
+
color::AbstractVector{<:Integer};
299
+
verbose::Bool=false,
300
+
)
301
+
checksquare(A)
302
+
if!proper_length_coloring(A, color; verbose)
303
+
returnfalse
304
+
end
305
+
issymmetric(A) ||returnfalse
306
+
group =group_by_color(color)
307
+
for i inaxes(A, 1), j inaxes(A, 2)
308
+
iszero(A[i, j]) &&continue
309
+
ci, cj = color[i], color[j]
310
+
check =_substitutable_check(
311
+
A, rank_nonzeros; i, j, ci, cj, row_group=group, column_group=group, verbose
Return `true` if bicoloring of the matrix `A` with the vectors `row_color` and `column_color` results in a bipartition that is substitutable, and `false` otherwise.
325
+
For all nonzeros `A[i, j]`, `rank_nonzeros[i, j]` provides its rank of recovery.
326
+
327
+
A bipartition of the rows and columns of a matrix `A` is _substitutable_ if, for every nonzero element `A[i, j]`, either of the following statements holds:
328
+
329
+
1. the group containing the column `A[:, j]` has all nonzeros in row `i` ordered before `A[i, j]`
330
+
2. the group containing the row `A[i, :]` has all nonzeros in column `j` ordered before `A[i, j]`
331
+
332
+
It is equivalent to an __acyclic bicoloring__.
333
+
334
+
!!! warning
335
+
This function is not coded with efficiency in mind, it is designed for small-scale tests.
0 commit comments