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

Add \ #184

Merged
merged 17 commits into from
Oct 27, 2021
Merged

Add \ #184

merged 17 commits into from
Oct 27, 2021

Conversation

AlexRobson
Copy link
Member

@AlexRobson AlexRobson commented Oct 19, 2021

Closes #163

I had a look at this as I hit it leading to #163. There are some (lower/upper) triangular special cases in \ that are handled.

One exception is Diagonal. As right now it seems to lose it's nameddimness, which I didn't deal with:

Diagonal(NamedDimsArray{(:a, :b)}(rand(5, 5)))
5×5 Diagonal{Float64, Vector{Float64}}: # Not a NamedDim
UpperTriangular(NamedDimsArray{(:a, :b)}(rand(5, 5)))
5×5 UpperTriangular{Float64, NamedDimsArray{(:a, :b), Float64, 2, Matrix{Float64}}}: NamedDim

I terms of allocations:

A, r2, b = rand(5, 5), rand(5, 3), rand(5)
b_nda = NamedDimsArray{(:foo,)}(b)
A_nda = NamedDimsArray{(:foo, :bar)}(A)
@btime A \ b # 537.798 ns (3 allocations: 544 bytes
@btime A_nda \ b_nda # 561.098 ns (4 allocations: 560 bytes)

Atril = tril(A)
Atril_nda = NamedDimsArray{(:foo, :bar,)}(Atril)

@btime Atril \ b # 181.387 ns (1 allocation: 128 bytes)
@btime Atril_nda \ b_nda # 196.036 ns (2 allocations: 144 bytes)

and similar for the Triangular specialisations the one extra allocation.

src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 19, 2021

Codecov Report

Merging #184 (f9874a9) into master (be6c28b) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #184      +/-   ##
==========================================
+ Coverage   95.40%   95.48%   +0.07%     
==========================================
  Files          13       13              
  Lines         588      598      +10     
==========================================
+ Hits          561      571      +10     
  Misses         27       27              
Impacted Files Coverage Δ
src/functions_linearalgebra.jl 95.65% <100.00%> (+0.65%) ⬆️
src/name_operations.jl 100.00% <100.00%> (ø)

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 be6c28b...f9874a9. Read the comment docs.

@AlexRobson AlexRobson changed the title WIP: Add \ Add \ Oct 20, 2021
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/name_operations.jl Outdated Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
test/name_operations.jl Outdated Show resolved Hide resolved
test/name_operations.jl Outdated Show resolved Hide resolved
test/name_operations.jl Outdated Show resolved Hide resolved
test/name_operations.jl Outdated Show resolved Hide resolved
@AlexRobson AlexRobson requested a review from glennmoy October 20, 2021 15:57
Project.toml Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
Alex Robson and others added 14 commits October 27, 2021 13:07
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Glenn Moynihan <glenn.moynihan@invenialabs.co.uk>
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
test/functions_linearalgebra.jl Outdated Show resolved Hide resolved
AlexRobson and others added 3 commits October 27, 2021 13:16
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
src/functions_linearalgebra.jl Outdated Show resolved Hide resolved
@AlexRobson AlexRobson merged commit 2fa07ee into master Oct 27, 2021
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.

Support left division i.e. ldiv or \
3 participants