Skip to content

Conversation

@mcabbott
Copy link
Contributor

@mcabbott mcabbott commented Dec 26, 2021

This wants to make A * B work with OffsetArrays with minimal changes. The easy part is always to call similar(..., axes(A), ...) and never size.

The messier part is that it adapts the fallback generic_matmatmul! to allow offsets. The plan would be never to hit that fallback, by adding a method generic_matmatmul!(C::OffsetArray, ...) which removes offsets, and then calls mul!. That will allow an offset adjoint strided array (etc) will dispatch to the right place, after the offset is removed, without duplication or ambiguities. So perhaps the fallback need not exist?

Third, if we want to un-wrap the OffsetArrays and call mul! again, then we need α,β not MulAdd(α,β). I thought that the extra stage (and instability?) of making that twice was causing an extra allocation, so I added a step to call generic_matmatmul! without it, first. This does not seem to remove the allocaiton but might be the right thing to do anyway.

Finally, it might also be worth making generic_matmatmul! accept functions like adjoint instead of characters 'C'. In many cases this information is in the type domain when it is called, but α,β are not. (Last commit which does this unfortunately adds an ambiguity, right now.)

@dkarrasch dkarrasch added the linear algebra Linear algebra label Dec 27, 2021
@DilumAluthge
Copy link
Member

We have moved the LinearAlgebra stdlib to an external repo: https://github.com/JuliaLang/LinearAlgebra.jl

@mcabbott If you think that this PR is still relevant, please open a new PR on the LinearAlgebra.jl repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear algebra Linear algebra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants