-
Notifications
You must be signed in to change notification settings - Fork 60
Update some wording in the docstring of cholmod.jl #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #622 +/- ##
=======================================
Coverage 83.95% 83.95%
=======================================
Files 12 12
Lines 9265 9265
=======================================
Hits 7778 7778
Misses 1487 1487 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks for the suggestions, but the original wording is better. |
When I read the existing docstring, I feel that the docstring tells me that it is invalid to do the following, which is actually valid. julia> A = [10 1; 2 10]
2×2 Matrix{Int64}:
10 1
2 10
julia> tagged_A = Symmetric(A)
2×2 Symmetric{Int64, Matrix{Int64}}:
10 1
1 10
julia> cholesky(tagged_A)
Cholesky{Float64, Matrix{Float64}}
U factor:
2×2 UpperTriangular{Float64, Matrix{Float64}}:
3.16228 0.316228
⋅ 3.14643 The existing docstring has a tone to urge me to do julia> A = Matrix(Symmetric(A)) # you must first do this
2×2 Matrix{Int64}:
10 1
1 10
julia> cholesky(Symmetric(A)) # then you can do this
Cholesky{Float64, Matrix{Float64}}
U factor:
2×2 UpperTriangular{Float64, Matrix{Float64}}:
3.16228 0.316228
⋅ 3.14643
julia> cholesky(A) # or do this
Cholesky{Float64, Matrix{Float64}}
U factor:
2×2 UpperTriangular{Float64, Matrix{Float64}}:
3.16228 0.316228
⋅ 3.14643 i.e. "Even if the tag is stripped off, the underlying matrix must still be symmetric", which is needlessly strong. |
The new wording just reads a bit strange. Perhaps it can be updated? |
Well, I think the existing docstring itself is a bit inconsistent. SparseArrays.jl/src/solvers/cholmod.jl Lines 1538 to 1545 in b225a85
Observing line 1539, the arg julia> A::SparseMatrixCSC
3×3 SparseMatrixCSC{Float64, Int64} with 7 stored entries:
10.0 0.519584 0.169799
0.519584 10.0 ⋅
0.169799 ⋅ 10.0
julia> tagged_A = Symmetric(A)
3×3 Symmetric{Float64, SparseMatrixCSC{Float64, Int64}}:
10.0 0.519584 0.169799
0.519584 10.0 ⋅
0.169799 ⋅ 10.0
julia> tagged_A::SparseMatrixCSC
ERROR: TypeError: in typeassert, expected SparseMatrixCSC, got a value of type Symmetric{Float64, SparseMatrixCSC{Float64, Int64}}
Stacktrace:
[1] top-level scope
@ REPL[28]:1 A larger issue concerns the top-level design of LinearAlgebra. In Here are some of my thoughts (far from constructive). I'm still learning these two packages ( |
My point is actually much simpler - that this sentence does not read as correct English - the use of
Maybe something like:
|
IIRC, we simply ignore the lower triangular part if not actually symmetric - but need to look at the code for that. In that case the documentation should be updated accordingly. |
https://discourse.julialang.org/t/what-is-a-recommended-way-to-solve-a-linear-equation/128420/31?u=waltermadelim