diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 8de5720..966a629 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-06-04T16:22:13","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-08T05:12:04","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 38b545c..e792f0d 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,5 +1,5 @@ -API reference · SparseMatrixColorings.jl

API reference

Public, exported

SparseMatrixColorings.SparseMatrixColoringsModule
SparseMatrixColorings

SparseMatrixColorings.jl

Build Status Stable Documentation Dev Documentation Coverage Code Style: Blue

Coloring algorithms for sparse Jacobian and Hessian matrices.

Getting started

To install this package, run the following in a Julia Pkg REPL:

pkg> add SparseMatrixColorings

Background

The algorithms implemented in this package are taken from the following articles:

Some parts of the articles (like definitions) are thus copied verbatim in the documentation.

Alternatives

source
ADTypes.column_coloringFunction
column_coloring(A::AbstractMatrix, algo::GreedyColoringAlgorithm)

Compute a partial distance-2 coloring of the columns in the bipartite graph of the matrix A.

Function defined by ADTypes, re-exported by SparseMatrixColorings.

Example

using SparseMatrixColorings, SparseArrays
+API reference · SparseMatrixColorings.jl

API reference

Public, exported

SparseMatrixColorings.SparseMatrixColoringsModule
SparseMatrixColorings

SparseMatrixColorings.jl

Build Status Stable Documentation Dev Documentation Coverage Code Style: Blue

Coloring algorithms for sparse Jacobian and Hessian matrices.

Getting started

To install this package, run the following in a Julia Pkg REPL:

pkg> add SparseMatrixColorings

Background

The algorithms implemented in this package are taken from the following articles:

Some parts of the articles (like definitions) are thus copied verbatim in the documentation.

Alternatives

source
ADTypes.column_coloringFunction
column_coloring(A::AbstractMatrix, algo::GreedyColoringAlgorithm)

Compute a partial distance-2 coloring of the columns in the bipartite graph of the matrix A.

Function defined by ADTypes, re-exported by SparseMatrixColorings.

Example

using SparseMatrixColorings, SparseArrays
 
 algo = GreedyColoringAlgorithm(SparseMatrixColorings.LargestFirst())
 
@@ -19,7 +19,7 @@
  2
  1
  2
- 3
source
ADTypes.row_coloringFunction
row_coloring(A::AbstractMatrix, algo::GreedyColoringAlgorithm)

Compute a partial distance-2 coloring of the rows in the bipartite graph of the matrix A.

Function defined by ADTypes, re-exported by SparseMatrixColorings.

Example

using SparseMatrixColorings, SparseArrays
+ 3
source
ADTypes.row_coloringFunction
row_coloring(A::AbstractMatrix, algo::GreedyColoringAlgorithm)

Compute a partial distance-2 coloring of the rows in the bipartite graph of the matrix A.

Function defined by ADTypes, re-exported by SparseMatrixColorings.

Example

using SparseMatrixColorings, SparseArrays
 
 algo = GreedyColoringAlgorithm(SparseMatrixColorings.LargestFirst())
 
@@ -38,41 +38,41 @@
  2
  2
  3
- 1
source
ADTypes.symmetric_coloringFunction
symmetric_coloring(A::AbstractMatrix, algo::GreedyColoringAlgorithm)

Compute a star coloring of the columns in the adjacency graph of the symmetric matrix A.

Function defined by ADTypes, re-exported by SparseMatrixColorings.

Example

Warning

Work in progress.

source

Public, not exported

Orders

Decompression

SparseMatrixColorings.color_groupsFunction
color_groups(color)

Return group::Vector{Vector{Int}} such that i ∈ group[c] iff color[i] == c.

Assumes the colors are contiguously numbered from 1 to some cmax.

source
ADTypes.symmetric_coloringFunction
symmetric_coloring(A::AbstractMatrix, algo::GreedyColoringAlgorithm)

Compute a star coloring of the columns in the adjacency graph of the symmetric matrix A.

Function defined by ADTypes, re-exported by SparseMatrixColorings.

Example

Warning

Work in progress.

source

Public, not exported

Orders

Decompression

SparseMatrixColorings.color_groupsFunction
color_groups(color)

Return group::Vector{Vector{Int}} such that i ∈ group[c] iff color[i] == c.

Assumes the colors are contiguously numbered from 1 to some cmax.

source
SparseMatrixColorings.decompress_columnsFunction
decompress_columns(
     S::AbstractMatrix{Bool},
     B::AbstractMatrix{R},
     color::AbstractVector{<:Integer}
-) where {R<:Real}

Decompress the thin matrix B into a new fat matrix A with the same sparsity pattern as S.

Here, color is a column coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

source
SparseMatrixColorings.decompress_columns!Function
decompress_columns!(
+) where {R<:Real}

Decompress the thin matrix B into a new fat matrix A with the same sparsity pattern as S.

Here, color is a column coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

source
SparseMatrixColorings.decompress_columns!Function
decompress_columns!(
     A::AbstractMatrix{R},
     S::AbstractMatrix{Bool},
     B::AbstractMatrix{R},
     color::AbstractVector{<:Integer}
-) where {R<:Real}

Decompress the thin matrix B into the fat matrix A which must have the same sparsity pattern as S.

Here, color is a column coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

source
SparseMatrixColorings.decompress_rowsFunction
decompress_rows(
+) where {R<:Real}

Decompress the thin matrix B into the fat matrix A which must have the same sparsity pattern as S.

Here, color is a column coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

source
SparseMatrixColorings.decompress_rowsFunction
decompress_rows(
     S::AbstractMatrix{Bool},
     B::AbstractMatrix{R},
     color::AbstractVector{<:Integer}
-) where {R<:Real}

Decompress the small matrix B into a new tall matrix A with the same sparsity pattern as S.

Here, color is a row coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

source
SparseMatrixColorings.decompress_rows!Function
decompress_rows!(
+) where {R<:Real}

Decompress the small matrix B into a new tall matrix A with the same sparsity pattern as S.

Here, color is a row coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

source
SparseMatrixColorings.decompress_rows!Function
decompress_rows!(
     A::AbstractMatrix{R},
     S::AbstractMatrix{Bool},
     B::AbstractMatrix{R},
     color::AbstractVector{<:Integer}
-) where {R<:Real}

Decompress the small matrix B into the tall matrix A which must have the same sparsity pattern as S.

Here, color is a row coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

source
SparseMatrixColorings.decompress_symmetricFunction
decompress_symmetric(
+) where {R<:Real}

Decompress the small matrix B into the tall matrix A which must have the same sparsity pattern as S.

Here, color is a row coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

source
SparseMatrixColorings.decompress_symmetricFunction
decompress_symmetric(
     S::AbstractMatrix{Bool},
     B::AbstractMatrix{R},
     colors::AbstractVector{<:Integer}
-) where {R<:Real}

Decompress the thin matrix B into a new symmetric matrix A with the same sparsity pattern as S.

Here, colors is a symmetric coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

References

Efficient Computation of Sparse Hessians Using Coloring and Automatic Differentiation, Gebremedhin et al. (2009)

source
SparseMatrixColorings.decompress_symmetric!Function
decompress_symmetric!(
     A::AbstractMatrix{R},
     S::AbstractMatrix{Bool},
     B::AbstractMatrix{R},
     color::AbstractVector{<:Integer}
-) where {R<:Real}

Decompress the thin matrix B into the symmetric matrix A which must have the same sparsity pattern as S.

Here, color is a symmetric coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

References

Efficient Computation of Sparse Hessians Using Coloring and Automatic Differentiation, Gebremedhin et al. (2009), Figure 2

source

Private

Matrices

SparseMatrixColorings.respectful_similarFunction
respectful_similar(A::AbstractMatrix)
-respectful_similar(A::AbstractMatrix, ::Type{T})

Like Base.similar but returns a transpose or adjoint when A is a transpose or adjoint.

source
SparseMatrixColorings.same_sparsity_patternFunction
same_sparsity_pattern(A::AbstractMatrix, B::AbstractMatrix)

Perform a partial equality check on the sparsity patterns of A and B:

  • if the return is true, they might have the same sparsity pattern but we're not sure
  • if the return is false, they definitely don't have the same sparsity pattern
source

Graphs

SparseMatrixColorings.GraphType
Graph{T}

Undirected graph structure stored in Compressed Sparse Column (CSC) format.

Fields

  • colptr::Vector{T}: same as for SparseMatrixCSC
  • rowval::Vector{T}: same as for SparseMatrixCSC
source
SparseMatrixColorings.BipartiteGraphType
BipartiteGraph{T}

Undirected bipartite graph structure stored in bidirectional Compressed Sparse Column format (redundancy allows for faster access).

A bipartite graph has two "sides", which we number 1 and 2.

Fields

  • g1::Graph{T}: contains the neighbors for vertices on side 1
  • g2::Graph{T}: contains the neighbors for vertices on side 2
source
SparseMatrixColorings.neighborsFunction
neighbors(bg::BipartiteGraph, Val(side), v::Integer)

Return the neighbors of v (a vertex from the specified side, 1 or 2), in the graph bg.

source

Coloring

SparseMatrixColorings.partial_distance2_coloringFunction
partial_distance2_coloring(bg::BipartiteGraph, ::Val{side}, order::AbstractOrder)

Compute a distance-2 coloring of the given side (1 or 2) in the bipartite graph bg and return a vector of integer colors.

A distance-2 coloring is such that two vertices have different colors if they are at distance at most 2.

The vertices are colored in a greedy fashion, following the order supplied.

See also

References

What Color Is Your Jacobian? Graph Coloring for Computing Derivatives, Gebremedhin et al. (2005), Algorithm 3.2

source
SparseMatrixColorings.star_coloringFunction
star_coloring(g::Graph, order::AbstractOrder)

Compute a star coloring of all vertices in the adjacency graph g and return a vector of integer colors.

A star coloring is a distance-1 coloring such that every path on 4 vertices uses at least 3 colors.

The vertices are colored in a greedy fashion, following the order supplied.

See also

References

New Acyclic and Star Coloring Algorithms with Application to Computing Hessians, Gebremedhin et al. (2007), Algorithm 4.1

source

Testing

SparseMatrixColorings.structurally_orthogonal_columnsFunction
structurally_orthogonal_columns(
+) where {R<:Real}

Decompress the thin matrix B into the symmetric matrix A which must have the same sparsity pattern as S.

Here, color is a symmetric coloring of S, while B is a compressed representation of matrix A obtained by summing the columns that share the same color.

References

Efficient Computation of Sparse Hessians Using Coloring and Automatic Differentiation, Gebremedhin et al. (2009), Figure 2

source

Private

Matrices

SparseMatrixColorings.respectful_similarFunction
respectful_similar(A::AbstractMatrix)
+respectful_similar(A::AbstractMatrix, ::Type{T})

Like Base.similar but returns a transpose or adjoint when A is a transpose or adjoint.

source
SparseMatrixColorings.same_sparsity_patternFunction
same_sparsity_pattern(A::AbstractMatrix, B::AbstractMatrix)

Perform a partial equality check on the sparsity patterns of A and B:

  • if the return is true, they might have the same sparsity pattern but we're not sure
  • if the return is false, they definitely don't have the same sparsity pattern
source

Graphs

SparseMatrixColorings.GraphType
Graph{T}

Undirected graph structure stored in Compressed Sparse Column (CSC) format.

Fields

  • colptr::Vector{T}: same as for SparseMatrixCSC
  • rowval::Vector{T}: same as for SparseMatrixCSC
source
SparseMatrixColorings.BipartiteGraphType
BipartiteGraph{T}

Undirected bipartite graph structure stored in bidirectional Compressed Sparse Column format (redundancy allows for faster access).

A bipartite graph has two "sides", which we number 1 and 2.

Fields

  • g1::Graph{T}: contains the neighbors for vertices on side 1
  • g2::Graph{T}: contains the neighbors for vertices on side 2
source
SparseMatrixColorings.neighborsFunction
neighbors(bg::BipartiteGraph, Val(side), v::Integer)

Return the neighbors of v (a vertex from the specified side, 1 or 2), in the graph bg.

source

Coloring

SparseMatrixColorings.partial_distance2_coloringFunction
partial_distance2_coloring(bg::BipartiteGraph, ::Val{side}, order::AbstractOrder)

Compute a distance-2 coloring of the given side (1 or 2) in the bipartite graph bg and return a vector of integer colors.

A distance-2 coloring is such that two vertices have different colors if they are at distance at most 2.

The vertices are colored in a greedy fashion, following the order supplied.

See also

References

What Color Is Your Jacobian? Graph Coloring for Computing Derivatives, Gebremedhin et al. (2005), Algorithm 3.2

source
SparseMatrixColorings.star_coloringFunction
star_coloring(g::Graph, order::AbstractOrder)

Compute a star coloring of all vertices in the adjacency graph g and return a vector of integer colors.

A star coloring is a distance-1 coloring such that every path on 4 vertices uses at least 3 colors.

The vertices are colored in a greedy fashion, following the order supplied.

See also

References

New Acyclic and Star Coloring Algorithms with Application to Computing Hessians, Gebremedhin et al. (2007), Algorithm 4.1

source

Testing

SparseMatrixColorings.structurally_orthogonal_columnsFunction
structurally_orthogonal_columns(
     A::AbstractMatrix, color::AbstractVector{<:Integer}
     verbose=false
-)

Return true if coloring the columns of the matrix A with the vector color results in a partition that is structurally orthogonal, and false otherwise.

A partition of the columns of a matrix A is structurally orthogonal if, for every nonzero element A[i, j], the group containing column A[:, j] has no other column with a nonzero in row i.

Warning

This function is not coded with efficiency in mind, it is designed for small-scale tests.

References

What Color Is Your Jacobian? Graph Coloring for Computing Derivatives, Gebremedhin et al. (2005)

source
SparseMatrixColorings.symmetrically_orthogonal_columnsFunction
symmetrically_orthogonal_columns(
+)

Return true if coloring the columns of the matrix A with the vector color results in a partition that is structurally orthogonal, and false otherwise.

A partition of the columns of a matrix A is structurally orthogonal if, for every nonzero element A[i, j], the group containing column A[:, j] has no other column with a nonzero in row i.

Warning

This function is not coded with efficiency in mind, it is designed for small-scale tests.

References

What Color Is Your Jacobian? Graph Coloring for Computing Derivatives, Gebremedhin et al. (2005)

source
SparseMatrixColorings.symmetrically_orthogonal_columnsFunction
symmetrically_orthogonal_columns(
     A::AbstractMatrix, color::AbstractVector{<:Integer};
     verbose=false
-)

Return true if coloring the columns of the symmetric matrix A with the vector color results in a partition that is symmetrically orthogonal, and false otherwise.

A partition of the columns of a symmetrix matrix A is symmetrically orthogonal if, for every nonzero element A[i, j], either of the following statements holds:

  1. the group containing the column A[:, j] has no other column with a nonzero in row i
  2. the group containing the column A[:, i] has no other column with a nonzero in row j
Warning

This function is not coded with efficiency in mind, it is designed for small-scale tests.

References

What Color Is Your Jacobian? Graph Coloring for Computing Derivatives, Gebremedhin et al. (2005)

source
SparseMatrixColorings.directly_recoverable_columnsFunction
directly_recoverable_columns(
+)

Return true if coloring the columns of the symmetric matrix A with the vector color results in a partition that is symmetrically orthogonal, and false otherwise.

A partition of the columns of a symmetrix matrix A is symmetrically orthogonal if, for every nonzero element A[i, j], either of the following statements holds:

  1. the group containing the column A[:, j] has no other column with a nonzero in row i
  2. the group containing the column A[:, i] has no other column with a nonzero in row j
Warning

This function is not coded with efficiency in mind, it is designed for small-scale tests.

References

What Color Is Your Jacobian? Graph Coloring for Computing Derivatives, Gebremedhin et al. (2005)

source
SparseMatrixColorings.directly_recoverable_columnsFunction
directly_recoverable_columns(
     A::AbstractMatrix, color::AbstractVector{<:Integer}
     verbose=false
-)

Return true if coloring the columns of the symmetric matrix A with the vector color results in a column-compressed representation that preserves every unique value, thus making direct recovery possible.

Warning

This function is not coded with efficiency in mind, it is designed for small-scale tests.

References

What Color Is Your Jacobian? Graph Coloring for Computing Derivatives, Gebremedhin et al. (2005)

source
+)

Return true if coloring the columns of the symmetric matrix A with the vector color results in a column-compressed representation that preserves every unique value, thus making direct recovery possible.

Warning

This function is not coded with efficiency in mind, it is designed for small-scale tests.

References

What Color Is Your Jacobian? Graph Coloring for Computing Derivatives, Gebremedhin et al. (2005)

source
diff --git a/dev/index.html b/dev/index.html index 9d90e96..62ac28c 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · SparseMatrixColorings.jl

SparseMatrixColorings.jl

Build Status Stable Documentation Dev Documentation Coverage Code Style: Blue

Coloring algorithms for sparse Jacobian and Hessian matrices.

Getting started

To install this package, run the following in a Julia Pkg REPL:

pkg> add SparseMatrixColorings

Background

The algorithms implemented in this package are taken from the following articles:

Some parts of the articles (like definitions) are thus copied verbatim in the documentation.

Alternatives

+Home · SparseMatrixColorings.jl

SparseMatrixColorings.jl

Build Status Stable Documentation Dev Documentation Coverage Code Style: Blue

Coloring algorithms for sparse Jacobian and Hessian matrices.

Getting started

To install this package, run the following in a Julia Pkg REPL:

pkg> add SparseMatrixColorings

Background

The algorithms implemented in this package are taken from the following articles:

Some parts of the articles (like definitions) are thus copied verbatim in the documentation.

Alternatives

diff --git a/dev/objects.inv b/dev/objects.inv index 2ccfb13..c5b403a 100644 --- a/dev/objects.inv +++ b/dev/objects.inv @@ -1,6 +1,6 @@ # Sphinx inventory version 2 # Project: SparseMatrixColorings.jl -# Version: 0.3.3 +# Version: 0.3.4 # The remainder of this file is compressed using zlib. xVMo0 Whz;4 #z7qà,(M[ |#L[Y {I^K'X~g :7'6_35 X7N6L˳&@I힇jӋ]B1OpDW[Qijǩ;M@ <)[x@ћ{HώWC;_nuzþr/s !Ǡ#%C4p™