Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 9 -1
Lines 764 770 +6
=========================================
+ Hits 764 770 +6 ☔ View full report in Codecov by Sentry. |
gdalle
commented
Sep 26, 2024
| """ | ||
| function Base.transpose(g::Graph{loops,T}) where {loops,T} | ||
| S = SparseMatrixCSC{T,T}(g.m, g.n, g.colptr, g.rowval, g.rowval) | ||
| Sᵀ = convert(SparseMatrixCSC, transpose(S)) # TODO: use ftranspose! without segfault? |
Member
Author
There was a problem hiding this comment.
@amontoison my initial idea was to use ftranspose! as follows:
new_colptr = Vector{T}(undef, g.m + 1)
new_rowval = similar(g.rowval)
Sᵀ = SparseMatrixCSC{T,T}(g.n, g.m, new_colptr, new_rowval, g.rowval)
ftranspose!(Sᵀ, S, identity)This would avoid any non-necessary allocation, but unfortunately it causes segfaults. Presumably because Sᵀ and S share their vector of nzval, which I thought wouldn't be a problem but it is.
Contributor
Benchmark Results
|
Collaborator
|
@gdalle Please wait that I have a have a look before merging... |
amontoison
added a commit
that referenced
this pull request
Sep 26, 2024
This reverts commit 939c9df.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Graphstructurenb_verticesandnb_edgesin lieu oflengthandnnzto avoid confusiontranspose_graph(::AbstractMatrix)from Manual graph transposition #107 asBase.transpose(::Graph)nzval), instead of a custom handwritten loop (at least I think so)