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

WIP: review before version 3 #119

Merged
merged 15 commits into from
Dec 9, 2020
Merged

WIP: review before version 3 #119

merged 15 commits into from
Dec 9, 2020

Conversation

Jutho
Copy link
Collaborator

@Jutho Jutho commented Dec 5, 2020

Part 1, more to go (tomorrow or the days after that).

@codecov
Copy link

codecov bot commented Dec 5, 2020

Codecov Report

Merging #119 (85e350e) into master (b38c1ac) will decrease coverage by 0.00%.
The diff coverage is 99.43%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #119      +/-   ##
==========================================
- Coverage   99.79%   99.78%   -0.01%     
==========================================
  Files          13       13              
  Lines         973      950      -23     
==========================================
- Hits          971      948      -23     
  Misses          2        2              
Impacted Files Coverage Δ
src/blockmap.jl 99.54% <98.41%> (+0.01%) ⬆️
src/LinearMaps.jl 98.80% <100.00%> (-0.02%) ⬇️
src/composition.jl 100.00% <100.00%> (ø)
src/conversion.jl 100.00% <100.00%> (ø)
src/functionmap.jl 100.00% <100.00%> (ø)
src/kronecker.jl 100.00% <100.00%> (ø)
src/linearcombination.jl 100.00% <100.00%> (ø)
src/scaledmap.jl 100.00% <100.00%> (ø)
src/show.jl 100.00% <100.00%> (ø)
src/transpose.jl 100.00% <100.00%> (ø)
... and 3 more

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 b38c1ac...85e350e. Read the comment docs.

Copy link
Member

@dkarrasch dkarrasch left a comment

Choose a reason for hiding this comment

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

Great to see this started!


# properties
Base.size(A::FunctionMap) = (A.M, A.N)
Base.parent(A::FunctionMap) = (A.f, A.fc)
Base.parent(A::FunctionMap) = (A.f, A.fc) # is this meanigful/useful?
Copy link
Member

Choose a reason for hiding this comment

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

IIRC the reason for parent was for manual inspection of wrapped maps, because show is now rather sparse. It may be used in the package only rarely, though.

Copy link
Member

Choose a reason for hiding this comment

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

perhaps any parent-like method would be most useful if it returned all the arguments needed to recreate the object. at a minimum that would include size too. maybe a named tuple would be more useful too.
not sure i would use it much though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From Base:

help?> Base.parent
  parent(A)

  Return the underlying "parent array”. ...

So I see this making sense for WrappedMap, but other than that I am not entirely sure. Where is this used?

Copy link
Member

Choose a reason for hiding this comment

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

I think we use parent only somewhere in kronecker.jl, and then potentially in an inconsistent way. It's not obvious what parent should return given the wide range of LinearMap subtypes. I'd be fine with actually removing it. I introduced this when I cut down the show method to show much less details, and then I used it in one or two places as it was handy. But this is not really crucial.

Copy link
Member

Choose a reason for hiding this comment

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

Another decision to be made: what shall we do with parent? Just remove? I think it's used internally only in one spot in the kronecker code, and could be worked around with a ternary if-clause, as I had it originally.

@Jutho
Copy link
Collaborator Author

Jutho commented Dec 6, 2020

blockmap was a though one, as i was not familiar with the code. Kronecker will have to wait for another day (hopefully tomorrow).

Copy link
Member

@dkarrasch dkarrasch left a comment

Choose a reason for hiding this comment

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

Thanks @Jutho!

Copy link
Member

@dkarrasch dkarrasch left a comment

Choose a reason for hiding this comment

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

👍

@Jutho
Copy link
Collaborator Author

Jutho commented Dec 8, 2020

I've left some more questions. I am otherwise finished; this package has evolved very nicely and has become very mature. I like the show implementation, might mimic this design in other packages where a similar structure could be useful.

I did not review the tests, but given the high coverage, these must be great!

Comment on lines 85 to 88
# Are all these methods below really useful?
# The conversion to matrices is not something that belongs to ordinary use of LinearMaps.
# It's rather for debugging purposes, where efficiency is not the primary concern.
# Also, I don't think they are really that much more efficient
Copy link
Member

Choose a reason for hiding this comment

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

Generally, the Matrix conversion is used in the Kronecker code in the vec trick, which is why I started introducing these methods (at least with the intention to write code that is faster than the columnwise mat-vec-muls):

https://github.com/Jutho/LinearMaps.jl/blob/b38c1ac1900d4751237bbef62927477017f4f7d0/src/kronecker.jl#L121-L131

X there is promoted to a MatrixMap, that's why we have all those MatrixMap conversion methods here.

@Jutho
Copy link
Collaborator Author

Jutho commented Dec 9, 2020

Ok, I thought I already left a message after previous commit, but clearly not. So I think now all comments have been removed (thanks @dkarrasch for checking carefully). The only remaining issue, which I did not address, is how to deal with parent? I leave that up to you. I am fine with this or any further updates of this to become the new version 3.0. Thanks for perfect maintenance and improvement of this package for the last few years.

@dkarrasch
Copy link
Member

I chose to remove parent altogether. We need a clear general API first, and then we can go and implement it for the different types. It hasn't been released yet, so there is no harm removing it.

@dkarrasch dkarrasch merged commit 77f538d into master Dec 9, 2020
@dkarrasch dkarrasch deleted the jhreview3 branch December 9, 2020 20:49
@dkarrasch
Copy link
Member

Thank you so much, Jutho! Now let's discuss the FillMap constructor over at #113, and we're done with v3.0. 😂

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.

3 participants