JuliaLinearAlgebra / LinearMaps.jl

A Julia package for defining and working with linear maps, also known as linear transformations or linear operators acting on vectors. The only requirement for a LinearMap is that it can act on a vector (by multiplication) efficiently.
Other
303 stars 42 forks source link

Handle dependencies via Pkg extensions #208

Closed dkarrasch closed 1 year ago

dkarrasch commented 1 year ago

This handles the two dependencies SparseArrays.jl and Statistics.jl as weak dependencies. Indeed, the only reason LinearMaps.jl depended on these was to overload their functions. Otherwise, LinearMaps.jl has always been independent from these two. Moreover, users could not call, say, sparse without loading SparseArrays.jl, so this is a clear case. This brings package load time of pure LinearMaps.jl down to below 20 ms (from about 300 ms, if not 500 ms and more) on current Julia nightly with SparseArrays.jl out of the sysimage).

Resolves #207.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f522a8f) 99.67% compared to head (98d1014) 99.67%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #208 +/- ## ======================================= Coverage 99.67% 99.67% ======================================= Files 19 21 +2 Lines 1538 1540 +2 ======================================= + Hits 1533 1535 +2 Misses 5 5 ``` | [Impacted Files](https://app.codecov.io/gh/JuliaLinearAlgebra/LinearMaps.jl/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra) | Coverage Δ | | |---|---|---| | [src/LinearMaps.jl](https://app.codecov.io/gh/JuliaLinearAlgebra/LinearMaps.jl/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-c3JjL0xpbmVhck1hcHMuamw=) | `100.00% <ø> (ø)` | | | [src/conversion.jl](https://app.codecov.io/gh/JuliaLinearAlgebra/LinearMaps.jl/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-c3JjL2NvbnZlcnNpb24uamw=) | `100.00% <ø> (ø)` | | | [src/linearcombination.jl](https://app.codecov.io/gh/JuliaLinearAlgebra/LinearMaps.jl/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-c3JjL2xpbmVhcmNvbWJpbmF0aW9uLmps) | `100.00% <ø> (ø)` | | | [src/wrappedmap.jl](https://app.codecov.io/gh/JuliaLinearAlgebra/LinearMaps.jl/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-c3JjL3dyYXBwZWRtYXAuamw=) | `100.00% <ø> (ø)` | | | [ext/LinearMapsSparseArraysExt.jl](https://app.codecov.io/gh/JuliaLinearAlgebra/LinearMaps.jl/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-ZXh0L0xpbmVhck1hcHNTcGFyc2VBcnJheXNFeHQuamw=) | `100.00% <100.00%> (ø)` | | | [ext/LinearMapsStatisticsExt.jl](https://app.codecov.io/gh/JuliaLinearAlgebra/LinearMaps.jl/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-ZXh0L0xpbmVhck1hcHNTdGF0aXN0aWNzRXh0Lmps) | `100.00% <100.00%> (ø)` | | | [src/blockmap.jl](https://app.codecov.io/gh/JuliaLinearAlgebra/LinearMaps.jl/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaLinearAlgebra#diff-c3JjL2Jsb2NrbWFwLmps) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

dkarrasch commented 1 year ago

@oschulz This should help your package, shouldn't it? It seems like your package doesn't depend on SparseArrays.jl, so you would avoid loading it, at least via LinearMaps.jl.

oschulz commented 1 year ago

@oschulz This should help your package, shouldn't it?

Yes, definitely! I have this MatrixLikeOperator in there only to keep load time down and to experiment with an operator that subtypes AbstractMatrix. I currently use LinearMaps via an extension - as soon as a `MatrixLikeOperator is multipled with a LinearOperator the result is "promoted" to a LinearOperator. But if LinearOperators becomes even more lightweight I may be able to throw this MatrixLikeOperator out completely.

oschulz commented 1 year ago

Nice, LinearMaps loads in 19 ms now. :-)

oschulz commented 1 year ago

Are you tagging a new relase with this @dkarrasch ?