From 466676f920756d751090fc66ded43c832365aa81 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Tue, 26 Sep 2023 09:26:04 +0200 Subject: [PATCH 01/10] Adapt to Documenter v1 --- docs/Project.toml | 3 +++ docs/make.jl | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index dfa65cd1..d31eb643 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,2 +1,5 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" + +[compat] +Documenter = "1" \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index de3381c5..5474d070 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -9,9 +9,7 @@ makedocs( pages = Any[ "SparseArrays" => "index.md", "Sparse Linear Algebra" => "solvers.md", - ]; - # strict = true, - strict = Symbol[:doctest], + ] ) deploydocs(repo = "github.com/JuliaSparse/SparseArrays.jl.git") From 07019d3595c16f5032fd54695a284a5f5ff98562 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Tue, 26 Sep 2023 12:19:46 +0200 Subject: [PATCH 02/10] fix (some) docs issues --- docs/make.jl | 3 ++- docs/src/index.md | 20 ++++++++++---------- docs/src/solvers.md | 4 +++- src/solvers/cholmod.jl | 25 +++++++++++++------------ src/solvers/spqr.jl | 4 ++-- src/solvers/umfpack.jl | 18 +++++++++--------- src/sparsematrix.jl | 2 +- 7 files changed, 40 insertions(+), 36 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 5474d070..33115902 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -9,7 +9,8 @@ makedocs( pages = Any[ "SparseArrays" => "index.md", "Sparse Linear Algebra" => "solvers.md", - ] + ]; + warnonly = [:missing_docs], ) deploydocs(repo = "github.com/JuliaSparse/SparseArrays.jl.git") diff --git a/docs/src/index.md b/docs/src/index.md index f0eb9652..de18768c 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -48,7 +48,7 @@ In some applications, it is convenient to store explicit zero values in a `Spars mutating operations). Such explicitly stored zeros are treated as structural nonzeros by many routines. The [`nnz`](@ref) function returns the number of elements explicitly stored in the sparse data structure, including non-structural zeros. In order to count the exact number of -numerical nonzeros, use [`count(!iszero, x)`](@ref), which inspects every stored element of a sparse +numerical nonzeros, use [`Base.count(!iszero, x)`](@ref), which inspects every stored element of a sparse matrix. [`dropzeros`](@ref), and the in-place [`dropzeros!`](@ref), can be used to remove stored zeros from the sparse matrix. @@ -86,7 +86,7 @@ stored zeros. (See [Sparse Matrix Storage](@ref man-csc).). ## Sparse Vector and Matrix Constructors -The simplest way to create a sparse array is to use a function equivalent to the [`zeros`](@ref) +The simplest way to create a sparse array is to use a function equivalent to the [`Base.zeros`](@ref) function that Julia provides for working with dense arrays. To produce a sparse array instead, you can use the same name with an `sp` prefix: @@ -122,7 +122,7 @@ julia> R = sparsevec(I,V) The inverse of the [`sparse`](@ref) and [`sparsevec`](@ref) functions is [`findnz`](@ref), which retrieves the inputs used to create the sparse array. -[`findall(!iszero, x)`](@ref) returns the Cartesian indices of non-zero entries in `x` +[`Base.findall(!iszero, x)`](@ref) returns the Cartesian indices of non-zero entries in `x` (including stored entries equal to zero). ```jldoctest sparse_function @@ -165,7 +165,7 @@ julia> sparse([1.0, 0.0, 1.0]) [3] = 1.0 ``` -You can go in the other direction using the [`Array`](@ref) constructor. The [`issparse`](@ref) +You can go in the other direction using the [`Base.Array`](@ref) constructor. The [`issparse`](@ref) function can be used to query if a matrix is sparse. ```jldoctest @@ -195,12 +195,12 @@ section of the standard library reference. | Sparse | Dense | Description | |:-------------------------- |:---------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`spzeros(m,n)`](@ref) | [`zeros(m,n)`](@ref) | Creates a *m*-by-*n* matrix of zeros. ([`spzeros(m,n)`](@ref) is empty.) | -| [`sparse(I,n,n)`](@ref) | [`Matrix(I,n,n)`](@ref)| Creates a *n*-by-*n* identity matrix. | -| [`sparse(A)`](@ref) | [`Array(S)`](@ref) | Interconverts between dense and sparse formats. | -| [`sprand(m,n,d)`](@ref) | [`rand(m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed uniformly on the half-open interval ``[0, 1)``. | -| [`sprandn(m,n,d)`](@ref) | [`randn(m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed according to the standard normal (Gaussian) distribution. | -| [`sprandn(rng,m,n,d)`](@ref) | [`randn(rng,m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements generated with the `rng` random number generator | +| [`spzeros(m,n)`](@ref) | [`Base.zeros(m,n)`](@ref) | Creates a *m*-by-*n* matrix of zeros. ([`spzeros(m,n)`](@ref) is empty.) | +| [`sparse(I,n,n)`](@ref) | [`Base.Matrix(I,n,n)`](@ref)| Creates a *n*-by-*n* identity matrix. | +| [`sparse(A)`](@ref) | [`Base.Array(S)`](@ref) | Interconverts between dense and sparse formats. | +| [`sprand(m,n,d)`](@ref) | [`Base.rand(m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed uniformly on the half-open interval ``[0, 1)``. | +| [`sprandn(m,n,d)`](@ref) | [`Base.randn(m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed according to the standard normal (Gaussian) distribution. | +| [`sprandn(rng,m,n,d)`](@ref) | [`Base.randn(rng,m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements generated with the `rng` random number generator | # [SparseArrays API](@id stdlib-sparse-arrays) diff --git a/docs/src/solvers.md b/docs/src/solvers.md index b8447b4c..5168605a 100644 --- a/docs/src/solvers.md +++ b/docs/src/solvers.md @@ -14,7 +14,9 @@ Sparse matrix solvers call functions from [SuiteSparse](http://suitesparse.com). Other solvers such as [Pardiso.jl](https://github.com/JuliaSparse/Pardiso.jl/) are available as external packages. [Arpack.jl](https://julialinearalgebra.github.io/Arpack.jl/stable/) provides `eigs` and `svds` for iterative solution of eigensystems and singular value decompositions. -These factorizations are described in more detail in [`Linear Algebra`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/) section of the manual: +These factorizations are described in more detail in the +[`Linear Algebra`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/) +section of the manual: 1. [`cholesky`](@ref SparseArrays.CHOLMOD.cholesky) 2. [`ldlt`](@ref SparseArrays.CHOLMOD.ldlt) 3. [`lu`](@ref SparseArrays.UMFPACK.lu) diff --git a/src/solvers/cholmod.jl b/src/solvers/cholmod.jl index 78247620..ce6ec302 100644 --- a/src/solvers/cholmod.jl +++ b/src/solvers/cholmod.jl @@ -18,7 +18,8 @@ using LinearAlgebra using LinearAlgebra: RealHermSymComplexHerm, AdjOrTrans import LinearAlgebra: (\), AdjointFactorization, cholesky, cholesky!, det, diag, ishermitian, isposdef, - issuccess, issymmetric, ldlt, ldlt!, logdet, lowrankdowndate! + issuccess, issymmetric, ldlt, ldlt!, logdet, + lowrankdowndate, lowrankdowndate!, lowrankupdate, lowrankupdate! using SparseArrays using SparseArrays: getcolptr, AbstractSparseVecOrMat @@ -1292,8 +1293,8 @@ end cholesky!(F::CHOLMOD.Factor, A::SparseMatrixCSC; shift = 0.0, check = true) -> CHOLMOD.Factor Compute the Cholesky (``LL'``) factorization of `A`, reusing the symbolic -factorization `F`. `A` must be a [`SparseMatrixCSC`](@ref) or a [`Symmetric`](@ref)/ -[`Hermitian`](@ref) view of a `SparseMatrixCSC`. Note that even if `A` doesn't +factorization `F`. `A` must be a [`SparseMatrixCSC`](@ref) or a `Symmetric`/ +`Hermitian` view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. See also [`cholesky`](@ref). @@ -1328,13 +1329,13 @@ end cholesky(A::SparseMatrixCSC; shift = 0.0, check = true, perm = nothing) -> CHOLMOD.Factor Compute the Cholesky factorization of a sparse positive definite matrix `A`. -`A` must be a [`SparseMatrixCSC`](@ref) or a [`Symmetric`](@ref)/[`Hermitian`](@ref) +`A` must be a [`SparseMatrixCSC`](@ref) or a `Symmetric`/`Hermitian` view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. If `perm` is not given, a fill-reducing permutation is used. `F = cholesky(A)` is most frequently used to solve systems of equations with `F\\b`, -but also the methods [`diag`](@ref), [`det`](@ref), and -[`logdet`](@ref) are defined for `F`. +but also the methods [`LinearAlgebra.diag`](@ref), [`LinearAlgebra.det`](@ref), and +[`LinearAlgebra.logdet`](@ref) are defined for `F`. You can also extract individual factors from `F`, using `F.L`. However, since pivoting is on by default, the factorization is internally represented as `A == P'*L*L'*P` with a permutation matrix `P`; @@ -1345,7 +1346,7 @@ it's typically preferable to extract "combined" factors like `PtL = F.PtL` When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via [`issuccess`](@ref)) lies with the user. +validity (via [`LinearAlgebra.issuccess`](@ref)) lies with the user. Setting the optional `shift` keyword argument computes the factorization of `A+shift*I` instead of `A`. If the `perm` argument is provided, @@ -1454,7 +1455,7 @@ end ldlt!(F::CHOLMOD.Factor, A::SparseMatrixCSC; shift = 0.0, check = true) -> CHOLMOD.Factor Compute the ``LDL'`` factorization of `A`, reusing the symbolic factorization `F`. -`A` must be a [`SparseMatrixCSC`](@ref) or a [`Symmetric`](@ref)/[`Hermitian`](@ref) +`A` must be a [`SparseMatrixCSC`](@ref) or a `Symmetric`/`Hermitian` view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. @@ -1496,13 +1497,13 @@ end ldlt(A::SparseMatrixCSC; shift = 0.0, check = true, perm=nothing) -> CHOLMOD.Factor Compute the ``LDL'`` factorization of a sparse matrix `A`. -`A` must be a [`SparseMatrixCSC`](@ref) or a [`Symmetric`](@ref)/[`Hermitian`](@ref) +`A` must be a [`SparseMatrixCSC`](@ref) or a `Symmetric`/`Hermitian` view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. A fill-reducing permutation is used. `F = ldlt(A)` is most frequently used to solve systems of equations `A*x = b` with `F\\b`. The returned -factorization object `F` also supports the methods [`diag`](@ref), -[`det`](@ref), [`logdet`](@ref), and [`inv`](@ref). +factorization object `F` also supports the methods [`LinearAlgebra.diag`](@ref), +[`LinearAlgebra.det`](@ref), [`LinearAlgebra.logdet`](@ref), and [`Base.inv`](@ref). You can extract individual factors from `F` using `F.L`. However, since pivoting is on by default, the factorization is internally represented as `A == P'*L*D*L'*P` with a permutation matrix `P`; @@ -1514,7 +1515,7 @@ The complete list of supported factors is `:L, :PtL, :D, :UP, :U, :LD, :DU, :PtL When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via [`issuccess`](@ref)) lies with the user. +validity (via [`LinearAlgebra.issuccess`](@ref)) lies with the user. Setting the optional `shift` keyword argument computes the factorization of `A+shift*I` instead of `A`. If the `perm` argument is provided, diff --git a/src/solvers/spqr.jl b/src/solvers/spqr.jl index d1a09f90..6a3b3853 100644 --- a/src/solvers/spqr.jl +++ b/src/solvers/spqr.jl @@ -153,11 +153,11 @@ _default_tol(A::AbstractSparseMatrixCSC) = Compute the `QR` factorization of a sparse matrix `A`. Fill-reducing row and column permutations are used such that `F.R = F.Q'*A[F.prow,F.pcol]`. The main application of this type is to -solve least squares or underdetermined problems with [`\\`](@ref). The function calls the C library SPQR[^ACM933]. +solve least squares or underdetermined problems with [`Base.(\\)`](@ref). The function calls the C library SPQR[^ACM933]. !!! note `qr(A::SparseMatrixCSC)` uses the SPQR library that is part of [SuiteSparse](https://github.com/DrTimothyAldenDavis/SuiteSparse). - As this library only supports sparse matrices with [`Float64`](@ref) or + As this library only supports sparse matrices with `Float64` or `ComplexF64` elements, as of Julia v1.4 `qr` converts `A` into a copy that is of type `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{ComplexF64}` as appropriate. diff --git a/src/solvers/umfpack.jl b/src/solvers/umfpack.jl index 26d6c8d6..ef5e1775 100644 --- a/src/solvers/umfpack.jl +++ b/src/solvers/umfpack.jl @@ -326,12 +326,12 @@ show_umf_info(F::UmfpackLU, level::Real=2.0) = Compute the LU factorization of a sparse matrix `A`. For sparse `A` with real or complex element type, the return type of `F` is -`UmfpackLU{Tv, Ti}`, with `Tv` = [`Float64`](@ref) or `ComplexF64` respectively and -`Ti` is an integer type ([`Int32`](@ref) or [`Int64`](@ref)). +`UmfpackLU{Tv, Ti}`, with `Tv` = `Float64` or `ComplexF64` respectively and +`Ti` is an integer type (`Int32` or `Int64`). When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via [`issuccess`](@ref)) lies with the user. +validity (via [`LinearAlgebra.issuccess`](@ref)) lies with the user. The permutation `q` can either be a permutation vector or `nothing`. If no permutation vector is provided or `q` is `nothing`, UMFPACK's default is used. If the permutation is not zero-based, a @@ -358,15 +358,15 @@ The relation between `F` and `A` is `F` further supports the following functions: -- [`\\`](@ref) -- [`det`](@ref) +- [`Base.(\\)`](@ref) +- [`LinearAlgebra.det`](@ref) -See also [`lu!`](@ref) +See also [`LinearAlgebra.lu!`](@ref) !!! note `lu(A::AbstractSparseMatrixCSC)` uses the UMFPACK[^ACM832] library that is part of [SuiteSparse](https://github.com/DrTimothyAldenDavis/SuiteSparse). - As this library only supports sparse matrices with [`Float64`](@ref) or + As this library only supports sparse matrices with `Float64` or `ComplexF64` elements, `lu` converts `A` into a copy that is of type `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{ComplexF64}` as appropriate. @@ -410,7 +410,7 @@ be resized accordingly. When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via [`issuccess`](@ref)) lies with the user. +validity (via [`LinearAlgebra.issuccess`](@ref)) lies with the user. The permutation `q` can either be a permutation vector or `nothing`. If no permutation vector is provided or `q` is `nothing`, UMFPACK's default is used. If the permutation is not zero based, a @@ -420,7 +420,7 @@ See also [`lu`](@ref) !!! note `lu!(F::UmfpackLU, A::AbstractSparseMatrixCSC)` uses the UMFPACK library that is part of - SuiteSparse. As this library only supports sparse matrices with [`Float64`](@ref) or + SuiteSparse. As this library only supports sparse matrices with `Float64` or `ComplexF64` elements, `lu!` will automatically convert the types to those set by the LU factorization or `SparseMatrixCSC{ComplexF64}` as appropriate. diff --git a/src/sparsematrix.jl b/src/sparsematrix.jl index e2dfacce..bd706f23 100644 --- a/src/sparsematrix.jl +++ b/src/sparsematrix.jl @@ -2073,7 +2073,7 @@ LinearAlgebra.fillstored!(S::AbstractSparseMatrixCSC, x) = (fill!(nzvalview(S), Create a sparse vector of length `m` or sparse matrix of size `m x n`. This sparse array will not contain any nonzero values. No storage will be allocated -for nonzero values during construction. The type defaults to [`Float64`](@ref) if not +for nonzero values during construction. The type defaults to `Float64` if not specified. # Examples From 43461775b0a149ef49dbd59e775dfe0465178d71 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Tue, 26 Sep 2023 13:08:44 +0200 Subject: [PATCH 03/10] fix more docs issues --- docs/src/index.md | 20 ++++++++++---------- src/solvers/cholmod.jl | 14 +++++++------- src/solvers/spqr.jl | 2 +- src/solvers/umfpack.jl | 12 ++++++------ src/sparsematrix.jl | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index de18768c..b81f3133 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -48,7 +48,7 @@ In some applications, it is convenient to store explicit zero values in a `Spars mutating operations). Such explicitly stored zeros are treated as structural nonzeros by many routines. The [`nnz`](@ref) function returns the number of elements explicitly stored in the sparse data structure, including non-structural zeros. In order to count the exact number of -numerical nonzeros, use [`Base.count(!iszero, x)`](@ref), which inspects every stored element of a sparse +numerical nonzeros, use `count(!iszero, x)`, which inspects every stored element of a sparse matrix. [`dropzeros`](@ref), and the in-place [`dropzeros!`](@ref), can be used to remove stored zeros from the sparse matrix. @@ -86,7 +86,7 @@ stored zeros. (See [Sparse Matrix Storage](@ref man-csc).). ## Sparse Vector and Matrix Constructors -The simplest way to create a sparse array is to use a function equivalent to the [`Base.zeros`](@ref) +The simplest way to create a sparse array is to use a function equivalent to the `Base.zeros` function that Julia provides for working with dense arrays. To produce a sparse array instead, you can use the same name with an `sp` prefix: @@ -122,7 +122,7 @@ julia> R = sparsevec(I,V) The inverse of the [`sparse`](@ref) and [`sparsevec`](@ref) functions is [`findnz`](@ref), which retrieves the inputs used to create the sparse array. -[`Base.findall(!iszero, x)`](@ref) returns the Cartesian indices of non-zero entries in `x` +`findall(!iszero, x)` returns the Cartesian indices of non-zero entries in `x` (including stored entries equal to zero). ```jldoctest sparse_function @@ -165,7 +165,7 @@ julia> sparse([1.0, 0.0, 1.0]) [3] = 1.0 ``` -You can go in the other direction using the [`Base.Array`](@ref) constructor. The [`issparse`](@ref) +You can go in the other direction using the `Array` constructor. The [`issparse`](@ref) function can be used to query if a matrix is sparse. ```jldoctest @@ -195,12 +195,12 @@ section of the standard library reference. | Sparse | Dense | Description | |:-------------------------- |:---------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`spzeros(m,n)`](@ref) | [`Base.zeros(m,n)`](@ref) | Creates a *m*-by-*n* matrix of zeros. ([`spzeros(m,n)`](@ref) is empty.) | -| [`sparse(I,n,n)`](@ref) | [`Base.Matrix(I,n,n)`](@ref)| Creates a *n*-by-*n* identity matrix. | -| [`sparse(A)`](@ref) | [`Base.Array(S)`](@ref) | Interconverts between dense and sparse formats. | -| [`sprand(m,n,d)`](@ref) | [`Base.rand(m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed uniformly on the half-open interval ``[0, 1)``. | -| [`sprandn(m,n,d)`](@ref) | [`Base.randn(m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed according to the standard normal (Gaussian) distribution. | -| [`sprandn(rng,m,n,d)`](@ref) | [`Base.randn(rng,m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements generated with the `rng` random number generator | +| [`spzeros(m,n)`](@ref) | `zeros(m,n)` | Creates a *m*-by-*n* matrix of zeros. ([`spzeros(m,n)`](@ref) is empty.) | +| [`sparse(I,n,n)`](@ref) | `Matrix(I,n,n)`| Creates a *n*-by-*n* identity matrix. | +| [`sparse(A)`](@ref) | `Array(S)` | Interconverts between dense and sparse formats. | +| [`sprand(m,n,d)`](@ref) | `rand(m,n)` | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed uniformly on the half-open interval ``[0, 1)``. | +| [`sprandn(m,n,d)`](@ref) | `randn(m,n)` | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed according to the standard normal (Gaussian) distribution. | +| [`sprandn(rng,m,n,d)`](@ref) | `randn(rng,m,n)` | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements generated with the `rng` random number generator | # [SparseArrays API](@id stdlib-sparse-arrays) diff --git a/src/solvers/cholmod.jl b/src/solvers/cholmod.jl index ce6ec302..83a47dc7 100644 --- a/src/solvers/cholmod.jl +++ b/src/solvers/cholmod.jl @@ -1334,8 +1334,8 @@ view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. If `perm` is not given, a fill-reducing permutation is used. `F = cholesky(A)` is most frequently used to solve systems of equations with `F\\b`, -but also the methods [`LinearAlgebra.diag`](@ref), [`LinearAlgebra.det`](@ref), and -[`LinearAlgebra.logdet`](@ref) are defined for `F`. +but also the methods `LinearAlgebra.diag`, `LinearAlgebra.det`, and +`LinearAlgebra.logdet` are defined for `F`. You can also extract individual factors from `F`, using `F.L`. However, since pivoting is on by default, the factorization is internally represented as `A == P'*L*L'*P` with a permutation matrix `P`; @@ -1346,7 +1346,7 @@ it's typically preferable to extract "combined" factors like `PtL = F.PtL` When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via [`LinearAlgebra.issuccess`](@ref)) lies with the user. +validity (via `LinearAlgebra.issuccess`) lies with the user. Setting the optional `shift` keyword argument computes the factorization of `A+shift*I` instead of `A`. If the `perm` argument is provided, @@ -1502,8 +1502,8 @@ view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. A fill-reducing permutation is used. `F = ldlt(A)` is most frequently used to solve systems of equations `A*x = b` with `F\\b`. The returned -factorization object `F` also supports the methods [`LinearAlgebra.diag`](@ref), -[`LinearAlgebra.det`](@ref), [`LinearAlgebra.logdet`](@ref), and [`Base.inv`](@ref). +factorization object `F` also supports the methods `LinearAlgebra.diag`, +`LinearAlgebra.det`, `LinearAlgebra.logdet`, and `inv`. You can extract individual factors from `F` using `F.L`. However, since pivoting is on by default, the factorization is internally represented as `A == P'*L*D*L'*P` with a permutation matrix `P`; @@ -1515,7 +1515,7 @@ The complete list of supported factors is `:L, :PtL, :D, :UP, :U, :LD, :DU, :PtL When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via [`LinearAlgebra.issuccess`](@ref)) lies with the user. +validity (via `LinearAlgebra.issuccess`) lies with the user. Setting the optional `shift` keyword argument computes the factorization of `A+shift*I` instead of `A`. If the `perm` argument is provided, @@ -1549,7 +1549,7 @@ factor will be `L*L' == P*A*P' + C'*C` `update`: `Cint(1)` for `A + CC'`, `Cint(0)` for `A - CC'` """ -lowrankdowndate! +lowrankupdowndate! #Helper functions for rank updates lowrank_reorder(V::AbstractArray,p) = Sparse(sparse(V[p,:])) diff --git a/src/solvers/spqr.jl b/src/solvers/spqr.jl index 6a3b3853..385bcd02 100644 --- a/src/solvers/spqr.jl +++ b/src/solvers/spqr.jl @@ -153,7 +153,7 @@ _default_tol(A::AbstractSparseMatrixCSC) = Compute the `QR` factorization of a sparse matrix `A`. Fill-reducing row and column permutations are used such that `F.R = F.Q'*A[F.prow,F.pcol]`. The main application of this type is to -solve least squares or underdetermined problems with [`Base.(\\)`](@ref). The function calls the C library SPQR[^ACM933]. +solve least squares or underdetermined problems with `\\`. The function calls the C library SPQR[^ACM933]. !!! note `qr(A::SparseMatrixCSC)` uses the SPQR library that is part of [SuiteSparse](https://github.com/DrTimothyAldenDavis/SuiteSparse). diff --git a/src/solvers/umfpack.jl b/src/solvers/umfpack.jl index ef5e1775..a8f0699a 100644 --- a/src/solvers/umfpack.jl +++ b/src/solvers/umfpack.jl @@ -331,7 +331,7 @@ For sparse `A` with real or complex element type, the return type of `F` is When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via [`LinearAlgebra.issuccess`](@ref)) lies with the user. +validity (via `LinearAlgebra.issuccess`) lies with the user. The permutation `q` can either be a permutation vector or `nothing`. If no permutation vector is provided or `q` is `nothing`, UMFPACK's default is used. If the permutation is not zero-based, a @@ -358,10 +358,10 @@ The relation between `F` and `A` is `F` further supports the following functions: -- [`Base.(\\)`](@ref) -- [`LinearAlgebra.det`](@ref) +- `\\` +- `LinearAlgebra.det` -See also [`LinearAlgebra.lu!`](@ref) +See also `LinearAlgebra.lu!`. !!! note `lu(A::AbstractSparseMatrixCSC)` uses the UMFPACK[^ACM832] library that is part of @@ -410,13 +410,13 @@ be resized accordingly. When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via [`LinearAlgebra.issuccess`](@ref)) lies with the user. +validity (via `LinearAlgebra.issuccess`) lies with the user. The permutation `q` can either be a permutation vector or `nothing`. If no permutation vector is provided or `q` is `nothing`, UMFPACK's default is used. If the permutation is not zero based, a zero based copy is made. -See also [`lu`](@ref) +See also `LinearAlgebra.lu`. !!! note `lu!(F::UmfpackLU, A::AbstractSparseMatrixCSC)` uses the UMFPACK library that is part of diff --git a/src/sparsematrix.jl b/src/sparsematrix.jl index bd706f23..44df7420 100644 --- a/src/sparsematrix.jl +++ b/src/sparsematrix.jl @@ -1992,7 +1992,7 @@ The optional `rng` argument specifies a random number generator, see [Random Num The optional `T` argument specifies the element type, which defaults to `Float64`. By default, nonzero values are sampled from a uniform distribution using -the [`rand`](@ref) function, i.e. by `rand(T)`, or `rand(rng, T)` if `rng` +the `rand` function, i.e. by `rand(T)`, or `rand(rng, T)` if `rng` is supplied; for the default `T=Float64`, this corresponds to nonzero values sampled uniformly in `[0,1)`. From f02d0085188323a8ad0054465f673d2bce0d5ee9 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Tue, 26 Sep 2023 15:13:43 +0200 Subject: [PATCH 04/10] fix reference to random numbers --- src/sparsematrix.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sparsematrix.jl b/src/sparsematrix.jl index 44df7420..8aec248b 100644 --- a/src/sparsematrix.jl +++ b/src/sparsematrix.jl @@ -1988,7 +1988,8 @@ end Create a random length `m` sparse vector or `m` by `n` sparse matrix, in which the probability of any element being nonzero is independently given by `p` (and hence the mean density of nonzeros is also exactly `p`). -The optional `rng` argument specifies a random number generator, see [Random Numbers](@ref). +The optional `rng` argument specifies a random number generator, see the section on +"Random Numbers" in the Julia documentation. The optional `T` argument specifies the element type, which defaults to `Float64`. By default, nonzero values are sampled from a uniform distribution using @@ -2044,7 +2045,8 @@ sprand(::Type{T}, m::Integer, n::Integer, density::AbstractFloat) where {T} = Create a random sparse vector of length `m` or sparse matrix of size `m` by `n` with the specified (independent) probability `p` of any entry being nonzero, where nonzero values are sampled from the normal distribution. The optional `rng` -argument specifies a random number generator, see [Random Numbers](@ref). +argument specifies a random number generator, see the section on "Random Numbers" +in the Julia documentation. !!! compat "Julia 1.1" Specifying the output element type `Type` requires at least Julia 1.1. From 1497260867c6733b3d3ae4850c4241c51d1fb2dd Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 6 Oct 2023 10:42:33 +0200 Subject: [PATCH 05/10] warnonly --- docs/Project.toml | 2 +- docs/make.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index d31eb643..1814eb33 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,4 +2,4 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" [compat] -Documenter = "1" \ No newline at end of file +Documenter = "1" diff --git a/docs/make.jl b/docs/make.jl index 33115902..53843712 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -10,7 +10,7 @@ makedocs( "SparseArrays" => "index.md", "Sparse Linear Algebra" => "solvers.md", ]; - warnonly = [:missing_docs], + warnonly = [:missing_docs, :cross_references], ) deploydocs(repo = "github.com/JuliaSparse/SparseArrays.jl.git") From 87d02ffc470ae7665c7a870913c35da5a7e80b74 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 6 Oct 2023 10:59:41 +0200 Subject: [PATCH 06/10] revert docs changes --- docs/src/index.md | 24 ++++++++++++------------ docs/src/solvers.md | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index b81f3133..2a63e5b0 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -48,7 +48,7 @@ In some applications, it is convenient to store explicit zero values in a `Spars mutating operations). Such explicitly stored zeros are treated as structural nonzeros by many routines. The [`nnz`](@ref) function returns the number of elements explicitly stored in the sparse data structure, including non-structural zeros. In order to count the exact number of -numerical nonzeros, use `count(!iszero, x)`, which inspects every stored element of a sparse +numerical nonzeros, use [`count(!iszero, x)`](@ref), which inspects every stored element of a sparse matrix. [`dropzeros`](@ref), and the in-place [`dropzeros!`](@ref), can be used to remove stored zeros from the sparse matrix. @@ -86,7 +86,7 @@ stored zeros. (See [Sparse Matrix Storage](@ref man-csc).). ## Sparse Vector and Matrix Constructors -The simplest way to create a sparse array is to use a function equivalent to the `Base.zeros` +The simplest way to create a sparse array is to use a function equivalent to the [`zeros`](@ref) function that Julia provides for working with dense arrays. To produce a sparse array instead, you can use the same name with an `sp` prefix: @@ -121,9 +121,9 @@ julia> R = sparsevec(I,V) ``` The inverse of the [`sparse`](@ref) and [`sparsevec`](@ref) functions is -[`findnz`](@ref), which retrieves the inputs used to create the sparse array. -`findall(!iszero, x)` returns the Cartesian indices of non-zero entries in `x` -(including stored entries equal to zero). +[`findnz`](@ref), which retrieves the inputs used to create the sparse array (including stored entries equal to zero). +[`findall(!iszero, x)`](@ref) returns the Cartesian indices of non-zero entries in `x` +(not including stored entries equal to zero). ```jldoctest sparse_function julia> findnz(S) @@ -165,7 +165,7 @@ julia> sparse([1.0, 0.0, 1.0]) [3] = 1.0 ``` -You can go in the other direction using the `Array` constructor. The [`issparse`](@ref) +You can go in the other direction using the [`Array`](@ref) constructor. The [`issparse`](@ref) function can be used to query if a matrix is sparse. ```jldoctest @@ -195,12 +195,12 @@ section of the standard library reference. | Sparse | Dense | Description | |:-------------------------- |:---------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`spzeros(m,n)`](@ref) | `zeros(m,n)` | Creates a *m*-by-*n* matrix of zeros. ([`spzeros(m,n)`](@ref) is empty.) | -| [`sparse(I,n,n)`](@ref) | `Matrix(I,n,n)`| Creates a *n*-by-*n* identity matrix. | -| [`sparse(A)`](@ref) | `Array(S)` | Interconverts between dense and sparse formats. | -| [`sprand(m,n,d)`](@ref) | `rand(m,n)` | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed uniformly on the half-open interval ``[0, 1)``. | -| [`sprandn(m,n,d)`](@ref) | `randn(m,n)` | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed according to the standard normal (Gaussian) distribution. | -| [`sprandn(rng,m,n,d)`](@ref) | `randn(rng,m,n)` | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements generated with the `rng` random number generator | +| [`spzeros(m,n)`](@ref) | [`zeros(m,n)`](@ref) | Creates a *m*-by-*n* matrix of zeros. ([`spzeros(m,n)`](@ref) is empty.) | +| [`sparse(I,n,n)`](@ref) | [`Matrix(I,n,n)`](@ref)| Creates a *n*-by-*n* identity matrix. | +| [`sparse(A)`](@ref) | [`Array(S)`](@ref) | Interconverts between dense and sparse formats. | +| [`sprand(m,n,d)`](@ref) | [`rand(m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed uniformly on the half-open interval ``[0, 1)``. | +| [`sprandn(m,n,d)`](@ref) | [`randn(m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements distributed according to the standard normal (Gaussian) distribution. | +| [`sprandn(rng,m,n,d)`](@ref) | [`randn(rng,m,n)`](@ref) | Creates a *m*-by-*n* random matrix (of density *d*) with iid non-zero elements generated with the `rng` random number generator | # [SparseArrays API](@id stdlib-sparse-arrays) diff --git a/docs/src/solvers.md b/docs/src/solvers.md index 5168605a..e633be9d 100644 --- a/docs/src/solvers.md +++ b/docs/src/solvers.md @@ -17,6 +17,7 @@ Other solvers such as [Pardiso.jl](https://github.com/JuliaSparse/Pardiso.jl/) a These factorizations are described in more detail in the [`Linear Algebra`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/) section of the manual: + 1. [`cholesky`](@ref SparseArrays.CHOLMOD.cholesky) 2. [`ldlt`](@ref SparseArrays.CHOLMOD.ldlt) 3. [`lu`](@ref SparseArrays.UMFPACK.lu) From 68a4bdd8cf3e7b33bd119e5f0464aacfef9fdb8a Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 6 Oct 2023 11:04:32 +0200 Subject: [PATCH 07/10] fix cholmod docstrings --- src/solvers/cholmod.jl | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/solvers/cholmod.jl b/src/solvers/cholmod.jl index 83a47dc7..45ab04d5 100644 --- a/src/solvers/cholmod.jl +++ b/src/solvers/cholmod.jl @@ -1293,8 +1293,8 @@ end cholesky!(F::CHOLMOD.Factor, A::SparseMatrixCSC; shift = 0.0, check = true) -> CHOLMOD.Factor Compute the Cholesky (``LL'``) factorization of `A`, reusing the symbolic -factorization `F`. `A` must be a [`SparseMatrixCSC`](@ref) or a `Symmetric`/ -`Hermitian` view of a `SparseMatrixCSC`. Note that even if `A` doesn't +factorization `F`. `A` must be a [`SparseMatrixCSC`](@ref) or a [`Symmetric`](@ref)/ +[`Hermitian`](@ref) view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. See also [`cholesky`](@ref). @@ -1329,13 +1329,13 @@ end cholesky(A::SparseMatrixCSC; shift = 0.0, check = true, perm = nothing) -> CHOLMOD.Factor Compute the Cholesky factorization of a sparse positive definite matrix `A`. -`A` must be a [`SparseMatrixCSC`](@ref) or a `Symmetric`/`Hermitian` +`A` must be a [`SparseMatrixCSC`](@ref) or a [`Symmetric`](@ref)/[`Hermitian`](@ref) view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. If `perm` is not given, a fill-reducing permutation is used. `F = cholesky(A)` is most frequently used to solve systems of equations with `F\\b`, -but also the methods `LinearAlgebra.diag`, `LinearAlgebra.det`, and -`LinearAlgebra.logdet` are defined for `F`. +but also the methods [`diag`](@ref), [`det`](@ref), and +[`logdet`](@ref) are defined for `F`. You can also extract individual factors from `F`, using `F.L`. However, since pivoting is on by default, the factorization is internally represented as `A == P'*L*L'*P` with a permutation matrix `P`; @@ -1346,7 +1346,7 @@ it's typically preferable to extract "combined" factors like `PtL = F.PtL` When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via `LinearAlgebra.issuccess`) lies with the user. +validity (via [`issuccess`](@ref)) lies with the user. Setting the optional `shift` keyword argument computes the factorization of `A+shift*I` instead of `A`. If the `perm` argument is provided, @@ -1455,7 +1455,7 @@ end ldlt!(F::CHOLMOD.Factor, A::SparseMatrixCSC; shift = 0.0, check = true) -> CHOLMOD.Factor Compute the ``LDL'`` factorization of `A`, reusing the symbolic factorization `F`. -`A` must be a [`SparseMatrixCSC`](@ref) or a `Symmetric`/`Hermitian` +`A` must be a [`SparseMatrixCSC`](@ref) or a [`Symmetric`](@ref)/[`Hermitian`](@ref) view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. @@ -1497,13 +1497,13 @@ end ldlt(A::SparseMatrixCSC; shift = 0.0, check = true, perm=nothing) -> CHOLMOD.Factor Compute the ``LDL'`` factorization of a sparse matrix `A`. -`A` must be a [`SparseMatrixCSC`](@ref) or a `Symmetric`/`Hermitian` +`A` must be a [`SparseMatrixCSC`](@ref) or a [`Symmetric`](@ref)/[`Hermitian`](@ref) view of a `SparseMatrixCSC`. Note that even if `A` doesn't have the type tag, it must still be symmetric or Hermitian. A fill-reducing permutation is used. `F = ldlt(A)` is most frequently used to solve systems of equations `A*x = b` with `F\\b`. The returned -factorization object `F` also supports the methods `LinearAlgebra.diag`, -`LinearAlgebra.det`, `LinearAlgebra.logdet`, and `inv`. +factorization object `F` also supports the methods [`diag`](@ref), +[`det`](@ref), [`logdet`](@ref), and [`inv`](@ref). You can extract individual factors from `F` using `F.L`. However, since pivoting is on by default, the factorization is internally represented as `A == P'*L*D*L'*P` with a permutation matrix `P`; @@ -1515,7 +1515,7 @@ The complete list of supported factors is `:L, :PtL, :D, :UP, :U, :LD, :DU, :PtL When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via `LinearAlgebra.issuccess`) lies with the user. +validity (via [`issuccess`](@ref)) lies with the user. Setting the optional `shift` keyword argument computes the factorization of `A+shift*I` instead of `A`. If the `perm` argument is provided, @@ -1598,7 +1598,7 @@ lowrankupdate(F::Factor{Tv}, V::AbstractArray{Tv}) where {Tv<:VTypes} = lowrankupdate!(copy(F), V) """ - lowrankupdate(F::CHOLMOD.Factor, C::AbstractArray) -> FF::CHOLMOD.Factor + lowrankdowndate(F::CHOLMOD.Factor, C::AbstractArray) -> FF::CHOLMOD.Factor Get an `LDLt` Factorization of `A + C*C'` given an `LDLt` or `LLt` factorization `F` of `A`. From c3b786b3a5661449b7b017495e4694d627ce4de9 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 6 Oct 2023 11:05:53 +0200 Subject: [PATCH 08/10] revert spqr changes --- src/solvers/spqr.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solvers/spqr.jl b/src/solvers/spqr.jl index 385bcd02..d1a09f90 100644 --- a/src/solvers/spqr.jl +++ b/src/solvers/spqr.jl @@ -153,11 +153,11 @@ _default_tol(A::AbstractSparseMatrixCSC) = Compute the `QR` factorization of a sparse matrix `A`. Fill-reducing row and column permutations are used such that `F.R = F.Q'*A[F.prow,F.pcol]`. The main application of this type is to -solve least squares or underdetermined problems with `\\`. The function calls the C library SPQR[^ACM933]. +solve least squares or underdetermined problems with [`\\`](@ref). The function calls the C library SPQR[^ACM933]. !!! note `qr(A::SparseMatrixCSC)` uses the SPQR library that is part of [SuiteSparse](https://github.com/DrTimothyAldenDavis/SuiteSparse). - As this library only supports sparse matrices with `Float64` or + As this library only supports sparse matrices with [`Float64`](@ref) or `ComplexF64` elements, as of Julia v1.4 `qr` converts `A` into a copy that is of type `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{ComplexF64}` as appropriate. From de902a0ffa258fe249f308b67d1e00228ff59363 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 6 Oct 2023 11:07:35 +0200 Subject: [PATCH 09/10] revert umfpack changes --- src/solvers/umfpack.jl | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/solvers/umfpack.jl b/src/solvers/umfpack.jl index a8f0699a..9f6f4741 100644 --- a/src/solvers/umfpack.jl +++ b/src/solvers/umfpack.jl @@ -47,6 +47,7 @@ import ..LibSuiteSparse: UMFPACK_PRL, UMFPACK_DENSE_ROW, UMFPACK_DENSE_COL, + UMFPACK_PIVOT_TOLERANCE, UMFPACK_BLOCK_SIZE, UMFPACK_ORDERING, UMFPACK_FIXQ, @@ -81,6 +82,7 @@ import ..LibSuiteSparse: const JL_UMFPACK_PRL = UMFPACK_PRL + 1 const JL_UMFPACK_DENSE_ROW = UMFPACK_DENSE_ROW + 1 const JL_UMFPACK_DENSE_COL = UMFPACK_DENSE_COL + 1 +const JL_UMFPACK_PIVOT_TOLERANCE = UMFPACK_PIVOT_TOLERANCE + 1 const JL_UMFPACK_BLOCK_SIZE = UMFPACK_BLOCK_SIZE + 1 const JL_UMFPACK_ORDERING = UMFPACK_ORDERING + 1 const JL_UMFPACK_FIXQ = UMFPACK_FIXQ + 1 @@ -326,20 +328,27 @@ show_umf_info(F::UmfpackLU, level::Real=2.0) = Compute the LU factorization of a sparse matrix `A`. For sparse `A` with real or complex element type, the return type of `F` is -`UmfpackLU{Tv, Ti}`, with `Tv` = `Float64` or `ComplexF64` respectively and -`Ti` is an integer type (`Int32` or `Int64`). +`UmfpackLU{Tv, Ti}`, with `Tv` = [`Float64`](@ref) or `ComplexF64` respectively and +`Ti` is an integer type ([`Int32`](@ref) or [`Int64`](@ref)). When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via `LinearAlgebra.issuccess`) lies with the user. +validity (via [`issuccess`](@ref)) lies with the user. The permutation `q` can either be a permutation vector or `nothing`. If no permutation vector is provided or `q` is `nothing`, UMFPACK's default is used. If the permutation is not zero-based, a zero-based copy is made. -The `control` vector defaults to the package's default configuration for UMFPACK, but can be changed by passing a -vector of length `UMFPACK_CONTROL`. See the UMFPACK manual for possible configurations. The corresponding -variables are named `JL_UMFPACK_` since Julia uses one-based indexing. +The `control` vector defaults to the Julia SparseArrays package's default configuration for UMFPACK (NB: this is modified from the UMFPACK defaults to +disable iterative refinement), but can be changed by passing a vector of length `UMFPACK_CONTROL`, see the UMFPACK manual for possible configurations. +For example to reenable iterative refinement: + + umfpack_control = SparseArrays.UMFPACK.get_umfpack_control(Float64, Int64) # read Julia default configuration for a Float64 sparse matrix + SparseArrays.UMFPACK.show_umf_ctrl(umfpack_control) # optional - display values + umfpack_control[SparseArrays.UMFPACK.JL_UMFPACK_IRSTEP] = 2.0 # reenable iterative refinement (2 is UMFPACK default max iterative refinement steps) + + Alu = lu(A; control = umfpack_control) + x = Alu \\ b # solve Ax = b, including UMFPACK iterative refinement The individual components of the factorization `F` can be accessed by indexing: @@ -358,15 +367,15 @@ The relation between `F` and `A` is `F` further supports the following functions: -- `\\` -- `LinearAlgebra.det` +- [`\\`](@ref) +- [`det`](@ref) -See also `LinearAlgebra.lu!`. +See also [`lu!`](@ref) !!! note `lu(A::AbstractSparseMatrixCSC)` uses the UMFPACK[^ACM832] library that is part of [SuiteSparse](https://github.com/DrTimothyAldenDavis/SuiteSparse). - As this library only supports sparse matrices with `Float64` or + As this library only supports sparse matrices with [`Float64`](@ref) or `ComplexF64` elements, `lu` converts `A` into a copy that is of type `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{ComplexF64}` as appropriate. @@ -410,17 +419,17 @@ be resized accordingly. When `check = true`, an error is thrown if the decomposition fails. When `check = false`, responsibility for checking the decomposition's -validity (via `LinearAlgebra.issuccess`) lies with the user. +validity (via [`issuccess`](@ref)) lies with the user. The permutation `q` can either be a permutation vector or `nothing`. If no permutation vector is provided or `q` is `nothing`, UMFPACK's default is used. If the permutation is not zero based, a zero based copy is made. -See also `LinearAlgebra.lu`. +See also [`lu`](@ref) !!! note `lu!(F::UmfpackLU, A::AbstractSparseMatrixCSC)` uses the UMFPACK library that is part of - SuiteSparse. As this library only supports sparse matrices with `Float64` or + SuiteSparse. As this library only supports sparse matrices with [`Float64`](@ref) or `ComplexF64` elements, `lu!` will automatically convert the types to those set by the LU factorization or `SparseMatrixCSC{ComplexF64}` as appropriate. From 200f0e618c53fe85251f8176ed9312e19ae8205e Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 6 Oct 2023 11:08:33 +0200 Subject: [PATCH 10/10] revert sparsematrix changes --- src/sparsematrix.jl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sparsematrix.jl b/src/sparsematrix.jl index 8aec248b..e2dfacce 100644 --- a/src/sparsematrix.jl +++ b/src/sparsematrix.jl @@ -1988,12 +1988,11 @@ end Create a random length `m` sparse vector or `m` by `n` sparse matrix, in which the probability of any element being nonzero is independently given by `p` (and hence the mean density of nonzeros is also exactly `p`). -The optional `rng` argument specifies a random number generator, see the section on -"Random Numbers" in the Julia documentation. +The optional `rng` argument specifies a random number generator, see [Random Numbers](@ref). The optional `T` argument specifies the element type, which defaults to `Float64`. By default, nonzero values are sampled from a uniform distribution using -the `rand` function, i.e. by `rand(T)`, or `rand(rng, T)` if `rng` +the [`rand`](@ref) function, i.e. by `rand(T)`, or `rand(rng, T)` if `rng` is supplied; for the default `T=Float64`, this corresponds to nonzero values sampled uniformly in `[0,1)`. @@ -2045,8 +2044,7 @@ sprand(::Type{T}, m::Integer, n::Integer, density::AbstractFloat) where {T} = Create a random sparse vector of length `m` or sparse matrix of size `m` by `n` with the specified (independent) probability `p` of any entry being nonzero, where nonzero values are sampled from the normal distribution. The optional `rng` -argument specifies a random number generator, see the section on "Random Numbers" -in the Julia documentation. +argument specifies a random number generator, see [Random Numbers](@ref). !!! compat "Julia 1.1" Specifying the output element type `Type` requires at least Julia 1.1. @@ -2075,7 +2073,7 @@ LinearAlgebra.fillstored!(S::AbstractSparseMatrixCSC, x) = (fill!(nzvalview(S), Create a sparse vector of length `m` or sparse matrix of size `m x n`. This sparse array will not contain any nonzero values. No storage will be allocated -for nonzero values during construction. The type defaults to `Float64` if not +for nonzero values during construction. The type defaults to [`Float64`](@ref) if not specified. # Examples