Skip to content
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

Enh/image basis perf #46

Merged
merged 9 commits into from
Jan 19, 2022
Merged

Enh/image basis perf #46

merged 9 commits into from
Jan 19, 2022

Conversation

kalmarek
Copy link
Owner

@thinh-le have a look if you have any comments on image_basis! for sparse matrices; note that this method (unlike the others) relies on the fact that A is square and symmetric which I'm not enthusiastic about ;)

@codecov
Copy link

codecov bot commented Jan 18, 2022

Codecov Report

Merging #46 (3ff2008) into master (fe363d2) will decrease coverage by 0.20%.
The diff coverage is 80.48%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
- Coverage   85.75%   85.55%   -0.21%     
==========================================
  Files          16       16              
  Lines        1053     1066      +13     
==========================================
+ Hits          903      912       +9     
- Misses        150      154       +4     
Flag Coverage Δ
unittests 85.55% <80.48%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/matrix_projections.jl 79.34% <61.90%> (+0.64%) ⬆️
src/Characters/echelon_form.jl 100.00% <100.00%> (ø)
src/actions.jl 80.00% <100.00%> (-1.97%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe363d2...3ff2008. Read the comment docs.

F = qr(M)
M_rank= rank(F)
result = let tmp = F.Q * Matrix(I, size(F.Q, 2), M_rank)
sparse(tmp[invperm(F.prow), :]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ok when returning Upis as the type will be SparseMatrixCSC with M_rank rows. However, when using this routine inside invariant_vectors(), e.g. when computing invariant_vectors for basis_full without any specialized method for ByPermutations or BySignedPermutations, we may need to convert result to vector of sparsevec.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, as discussed would be nice to make the output type of invariant_vectors same as Upis since it can be regarded as Upis for the trivial subrep, that is SparseMatricSCS. This also includes making the type T in WedderburnDecomposition propagate to the results of invariant_vectors so that SparseMatricSCS{T} is returned (both for Upis and for invariant_vectors). @kalmarek

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thinh-le yeah, I'm convinced that You're suggestion is a good solution, but let change the format of invariant vectors in a separate pull

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kalmarek Thanks. I also believe that users would rarely use invariant vectors individually (if really wanted, views provide nice solution) but as matrix-vector multiplication (which is fast for both sparse and dense BLAS).

Also, I had a look at this issue #39 and for me it does not matter much if the user receive a row or column based Upis:

  • adjoint is lazy
  • matrix multiplication of Upi plays nice with adjoint (and fast when everything is sparse)

Maybe we should pick one that is fast for internals..

@kalmarek kalmarek merged commit 636964f into master Jan 19, 2022
@kalmarek kalmarek deleted the enh/image_basis_perf branch January 19, 2022 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants